]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
pythonpath_reduction.py: install site-patch.py from setuptools
authorGilles DAVID <gilles-g.david@edf.fr>
Fri, 15 Oct 2021 16:43:08 +0000 (18:43 +0200)
committerDUC ANH HOANG <duc-anh-externe.hoang@edf.fr>
Mon, 18 Oct 2021 12:49:10 +0000 (14:49 +0200)
bin/pythonpath_reduction.py

index 04a3a723d133d7ca4deb5ec1b7dbfa462cdc5957..02d6b6bb14e327f0067e4b8d644f4a762f23e3df 100644 (file)
@@ -132,6 +132,16 @@ def main(salome_install_dir, context_file_name, env_file_name, ignore=None):
         logger.debug("Matplotlib isn't compiled with salome or maybe it is in the system package ")
         logger.debug("If matplotlib is compiled with salome, we need define its install path with variable MATPLOTLIB_HOME")
 
+    # Fix for correct imports
+    import setuptools
+    try:
+        setup_tools_path = os.path.dirname(setuptools.__file__)
+    except AttributeError:
+        setup_tools_path = os.path.dirname(setuptools.__path__._path[0])
+    del setuptools
+    site_patch = os.path.join(setup_tools_path, 'site-patch.py')
+    shutil.copyfile(site_patch, os.path.join(pythonpath_common, "site.py"))
+
     # Overwrite salome_context.cfg
     # Backup context and env files
     copy(context_file, backup_context_file)