]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
[bos #41189] Expose relevant DLL directories to ensure SALOME starts bos/41189
authorNabil Ghodbane <nabil.ghodbane@cea.fr>
Thu, 14 Mar 2024 14:32:59 +0000 (15:32 +0100)
committerNabil Ghodbane <nabil.ghodbane@cea.fr>
Thu, 14 Mar 2024 14:32:59 +0000 (15:32 +0100)
src/Basics/KernelBasis.i

index 7e8e2d5f6e6c31d748d7e66dac2082a558d25845..e726a700233e310d5e194c3700093a9c69404ef4 100644 (file)
 %module KernelBasis
 
 %pythonbegin %{
-  # new mechanism introduced in Python 3.8+ about DLL resolution
   import os
   def __add_dll_directory__(path):
     paths = [ p.replace("\\\\", "\\").replace("/", "\\") for p in sys.path]
-    if not path in paths and os.path.exists(path):
+    if not os.path.exists(path):
+      print("ERROR: Directory is reported as non existing: {}".format(path))
+    elif not path in paths:
       os.add_dll_directory(path)
     else:
-      print("DEBUG: directory is already present in {}".format(path))
+      print("DEBUG: Directory is already present in sys.path {}".format(path))
     return
 
   import platform
     if sys.version_info > (3,8) :
       try:
         import os
-        _dll_exposed = os.getenv("KERNEL_DLLs_Exposed", "")
-        if _dll_exposed == "" :
+        _exposed = os.getenv("KERNEL_DLLs_Exposed", "")
+        if _exposed == "" :
           print("INFO: Exposing DLL directories")
-          __add_dll_directory__(os.path.join(os.getenv("KERNEL_ROOT_DIR"),  "lib", "salome"))
-          __add_dll_directory__(os.path.join(os.getenv("GUI_ROOT_DIR"),     "lib", "salome"))
-          __add_dll_directory__(os.path.join(os.getenv("GUI_ROOT_DIR"),     "lib", "salome"))
-          __add_dll_directory__(os.path.join(os.getenv("PTHREAD_ROOT_DIR"), "lib"          ))
-          __add_dll_directory__(os.path.join(os.getenv("PRODUCT_ROOT_DIR"), "W64", "lib"   ))
-          __add_dll_directory__(os.path.join(os.getenv("PRODUCT_ROOT_DIR"), "W64", "bin"   ))
+          __add_dll_directory__(os.path.join(os.getenv("KERNEL_ROOT_DIR"),  "lib", "salome"    ))
+          __add_dll_directory__(os.path.join(os.getenv("GUI_ROOT_DIR"),     "lib", "salome"    ))
+          __add_dll_directory__(os.path.join(os.getenv("GUI_ROOT_DIR"),     "lib", "salome"    ))
+          __add_dll_directory__(os.path.join(os.getenv("PTHREAD_ROOT_DIR"), "lib"              ))
+          __add_dll_directory__(os.path.join(os.getenv("PRODUCT_ROOT_DIR"), "W64", "EXT", "lib"))
+          __add_dll_directory__(os.path.join(os.getenv("PRODUCT_ROOT_DIR"), "W64", "EXT","bin" ))
           __add_dll_directory__(os.getenv("OMNIORB_BIN_DIR"))
           os.environ["KERNEL_DLLs_Exposed"] = "1"
       except Exception: