]> SALOME platform Git repositories - tools/sat_salome.git/commitdiff
Salome HOME
[bos #41189][Windows]: patch Python 3.9.14
authorNabil Ghodbane <nabil.ghodbane@cea.fr>
Thu, 4 Apr 2024 12:02:16 +0000 (14:02 +0200)
committerNabil Ghodbane <nabil.ghodbane@cea.fr>
Thu, 4 Apr 2024 12:02:16 +0000 (14:02 +0200)
products/Python.pyconf
products/patches/python-3.9.14.001-ctype-init.patch [new file with mode: 0644]
products/patches/python-3.9.14.02-os.py.patch [new file with mode: 0644]
products/patches/python-3.9.14.03-getpath.patch [new file with mode: 0644]
products/patches/python-3.9.14.04-dynload_win.patch [new file with mode: 0644]

index 6391bc45ecae8eb4d27d37c9a5279a6ef42aa010..6655b7c38c71db7d595750e99f08bda7d663a34d 100755 (executable)
@@ -144,7 +144,10 @@ version_3_9_14 :
 version_3_9_14_win :
 {
     compil_script : "Python-3.9.bat"
-    patches : []
+    patches : ['python-3.9.14.001-ctype-init.patch',
+               'python-3.9.14.02-os.py.patch',
+               'python-3.9.14.03-getpath.patch',
+               'python-3.9.14.04-dynload_win.patch'
+              ]
     build_depend : ['perl']
 }
diff --git a/products/patches/python-3.9.14.001-ctype-init.patch b/products/patches/python-3.9.14.001-ctype-init.patch
new file mode 100644 (file)
index 0000000..37a56f3
--- /dev/null
@@ -0,0 +1,18 @@
+--- Python-3.9.14-ref/Lib/ctypes/__init__.py   2022-09-06 19:26:16.000000000 +0200
++++ Python-3.9.14-new/Lib/ctypes/__init__.py   2024-04-03 17:34:16.000000000 +0200
+@@ -364,7 +364,14 @@
+                 if '/' in name or '\\' in name:
+                     self._name = nt._getfullpathname(self._name)
+                     mode |= nt._LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR
+-
++                # PATH is how DLL lookup has always worked in the past
++                # in Python on Windows. IMHO both the above mode flags
++                # are not wanted and cause many serious regressions within
++                # the conda ecosystem on Windows. We should however
++                # propagate any PATH changes that have happened to Python
++                # library and that is not yet implemented.
++                LOAD_WITH_ALTERED_SEARCH_PATH = 0x00000008
++                mode = LOAD_WITH_ALTERED_SEARCH_PATH
+         class _FuncPtr(_CFuncPtr):
+             _flags_ = flags
+             _restype_ = self._func_restype_
diff --git a/products/patches/python-3.9.14.02-os.py.patch b/products/patches/python-3.9.14.02-os.py.patch
new file mode 100644 (file)
index 0000000..202a787
--- /dev/null
@@ -0,0 +1,11 @@
+--- Python-3.9.14-ref/Lib/os.py        2022-09-06 19:26:16.000000000 +0200
++++ Python-3.9.14-new/Lib/os.py        2024-04-03 16:58:24.000000000 +0200
+@@ -1107,6 +1107,8 @@
+         Remove the directory by calling close() on the returned object or
+         using it in a with statement.
+         """
++        #FIXME SALOME
++        return
+         import nt
+         cookie = nt._add_dll_directory(path)
+         return _AddedDllDirectory(
diff --git a/products/patches/python-3.9.14.03-getpath.patch b/products/patches/python-3.9.14.03-getpath.patch
new file mode 100644 (file)
index 0000000..11d818e
--- /dev/null
@@ -0,0 +1,29 @@
+--- Python-3.9.14-ref/PC/getpathp.c    2022-09-06 19:26:16.000000000 +0200
++++ Python-3.9.14-new/PC/getpathp.c    2024-04-03 17:13:22.000000000 +0200
+@@ -1116,7 +1116,7 @@
+     if (!get_dllpath(py3path)) {
+         reduce(py3path);
+         join(py3path, PY3_DLLNAME);
+-        hPython3 = LoadLibraryExW(py3path, NULL, LOAD_LIBRARY_SEARCH_DEFAULT_DIRS);
++        hPython3 = LoadLibraryExW(py3path, NULL, LOAD_WITH_ALTERED_SEARCH_PATH);
+         if (hPython3 != NULL) {
+             return 1;
+         }
+@@ -1124,7 +1124,7 @@
+     /* If we can locate python3.dll in our application dir,
+        use that DLL */
+-    hPython3 = LoadLibraryExW(PY3_DLLNAME, NULL, LOAD_LIBRARY_SEARCH_APPLICATION_DIR);
++    hPython3 = LoadLibraryExW(PY3_DLLNAME, NULL, LOAD_WITH_ALTERED_SEARCH_PATH);
+     if (hPython3 != NULL) {
+         return 1;
+     }
+@@ -1134,7 +1134,7 @@
+     wcscpy(py3path, Py_GetPrefix());
+     if (py3path[0]) {
+         join(py3path, L"DLLs\\" PY3_DLLNAME);
+-        hPython3 = LoadLibraryExW(py3path, NULL, LOAD_LIBRARY_SEARCH_DEFAULT_DIRS);
++        hPython3 = LoadLibraryExW(py3path, NULL, LOAD_WITH_ALTERED_SEARCH_PATH);
+     }
+     return hPython3 != NULL;
+ }
diff --git a/products/patches/python-3.9.14.04-dynload_win.patch b/products/patches/python-3.9.14.04-dynload_win.patch
new file mode 100644 (file)
index 0000000..db09543
--- /dev/null
@@ -0,0 +1,13 @@
+--- Python-3.9.14-ref/Python/dynload_win.c     2022-09-06 19:26:16.000000000 +0200
++++ Python-3.9.14-new/Python/dynload_win.c     2024-04-03 17:08:02.000000000 +0200
+@@ -191,9 +191,7 @@
+            AddDllDirectory function. We add SEARCH_DLL_LOAD_DIR to
+            ensure DLLs adjacent to the PYD are preferred. */
+         Py_BEGIN_ALLOW_THREADS
+-        hDLL = LoadLibraryExW(wpathname, NULL,
+-                              LOAD_LIBRARY_SEARCH_DEFAULT_DIRS |
+-                              LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR);
++        hDLL = LoadLibraryExW(wpathname, NULL,LOAD_WITH_ALTERED_SEARCH_PATH);
+         Py_END_ALLOW_THREADS
+         /* restore old error mode settings */