From fd0e763f00b93ff3c2394798a60cd67824a09260 Mon Sep 17 00:00:00 2001 From: DUC ANH HOANG Date: Mon, 8 Nov 2021 13:51:08 +0100 Subject: [PATCH] pythonpath_reduction.py: minor correction;get absolute path of salome_install_dir, embed paraview pythonpath into python_modules --- bin/pythonpath_reduction.py | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/bin/pythonpath_reduction.py b/bin/pythonpath_reduction.py index 02d6b6bb1..87069f0c3 100644 --- a/bin/pythonpath_reduction.py +++ b/bin/pythonpath_reduction.py @@ -65,6 +65,7 @@ def main(salome_install_dir, context_file_name, env_file_name, ignore=None): ignore = IGNORE[::] # new pythonpath initiation; creation a directory containing all python module for salome + salome_install_dir=os.path.abspath(salome_install_dir) pythonpath_common = os.path.join(salome_install_dir, 'python_modules') if os.path.exists(pythonpath_common): remove(pythonpath_common) @@ -102,23 +103,20 @@ def main(salome_install_dir, context_file_name, env_file_name, ignore=None): with open(os.path.join(pythonpath_common, 'easy-install.pth'), 'w') as easy_install: for dirs in reservedDict[reserved_key[0]]: for d in dirs.split(':'): - if "paraview" not in d.lower(): - egg_dir_list = glob.glob(os.path.join(d, pattern)) - if egg_dir_list: - for egg_dir in egg_dir_list: - egg_file = egg_dir.split('/')[-1] - new_dir = os.path.join(pythonpath_common, egg_file) - copy_or_link(egg_dir, new_dir) - easy_install.write("./%s\n" % egg_file) - else: - for f in os.listdir(d): - if f in ignore: - continue - full_file_srcpath = os.path.join(d, f) - full_file_dstpath = os.path.join(pythonpath_common, f) - copy_or_link(full_file_srcpath, full_file_dstpath) + egg_dir_list = glob.glob(os.path.join(d, pattern)) + if egg_dir_list: + for egg_dir in egg_dir_list: + egg_file = egg_dir.split('/')[-1] + new_dir = os.path.join(pythonpath_common, egg_file) + copy_or_link(egg_dir, new_dir) + easy_install.write("./%s\n" % egg_file) else: - new_pythonpath_list.append(d) + for f in os.listdir(d): + if f in ignore: + continue + full_file_srcpath = os.path.join(d, f) + full_file_dstpath = os.path.join(pythonpath_common, f) + copy_or_link(full_file_srcpath, full_file_dstpath) # In the case of matplotlib, some prerequis are found matplotlib_root. They also need to be put in new directory of module python try: with open(os.path.join(pythonpath_common, 'easy-install.pth'), 'a') as easy_install: -- 2.39.2