From 77b3d8a4b4d9c40fa1ee68b9e56436f45a85c89e Mon Sep 17 00:00:00 2001 From: crouzet Date: Tue, 8 Feb 2022 17:40:33 +0100 Subject: [PATCH] integration patch suite retour Pascal --- src/fileEnviron.py | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/src/fileEnviron.py b/src/fileEnviron.py index e74290a..74c4533 100644 --- a/src/fileEnviron.py +++ b/src/fileEnviron.py @@ -908,15 +908,20 @@ launcher_tail_py2="""\ # Load all files extra.env.d/*.py and call the module's init routine] - if os.path.exists("extra.env.d"): - sys.path.insert(0, os.path.join(os.getcwd(), "extra.env.d")) - for filename in os.listdir("extra.env.d"): + extradir=out_dir_Path + r"/extra.env.d" + + if os.path.exists(extradir): + sys.path.insert(0, os.path.join(os.getcwd(), extradir)) + for filename in sorted( + filter(lambda x: os.path.isfile(os.path.join(extradir, x)), + os.listdir(extradir))): + if filename.endswith(".py"): - f = os.path.join("extra.env.d", filename) + f = os.path.join(extradir, filename) module_name = os.path.splitext(os.path.basename(f))[0] fp, path, desc = imp.find_module(module_name) module = imp.load_module(module_name, fp, path, desc) - module.init(context, out_dir_Path) + module.init(context, out_dir_Path) #[manage salome doc command] if len(args) >1 and args[0]=='doc': @@ -956,15 +961,20 @@ launcher_tail_py3="""\ # Load all files extra.env.d/*.py and call the module's init routine] - if os.path.exists("extra.env.d"): - sys.path.insert(0, os.path.join(os.getcwd(), "extra.env.d")) - for filename in os.listdir("extra.env.d"): + extradir=out_dir_Path + r"/extra.env.d" + + if os.path.exists(extradir): + sys.path.insert(0, os.path.join(os.getcwd(), extradir)) + for filename in sorted( + filter(lambda x: os.path.isfile(os.path.join(extradir, x)), + os.listdir(extradir))): + if filename.endswith(".py"): - f = os.path.join("extra.env.d", filename) + f = os.path.join(extradir, filename) module_name = os.path.splitext(os.path.basename(f))[0] fp, path, desc = imp.find_module(module_name) module = imp.load_module(module_name, fp, path, desc) - module.init(context, out_dir_Path) + module.init(context, out_dir_Path) #[manage salome doc command] if len(args) >1 and args[0]=='doc': -- 2.39.2