py-pythran: update checksum for patch (#25693)

* Replace URL patch with file patch
* Add comment explaining patch origin and purpose
This commit is contained in:
Adam J. Stewart 2021-08-30 12:02:39 -05:00 committed by GitHub
parent a018f48df9
commit 8ee5bf6d03
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 72 additions and 3 deletions

View File

@ -0,0 +1,70 @@
diff --git a/omp/__init__.py b/omp/__init__.py
index bddae3063..10a4cc995 100644
--- a/omp/__init__.py
+++ b/omp/__init__.py
@@ -69,10 +69,16 @@ class OpenMP(object):
def init_not_msvc(self):
""" Find OpenMP library and try to load if using ctype interface. """
- # find_library() does not search automatically LD_LIBRARY_PATH
+ # find_library() does not automatically search LD_LIBRARY_PATH
+ # until Python 3.6+, so we explicitly add it.
+ # LD_LIBRARY_PATH is used on Linux, while macOS uses DYLD_LIBRARY_PATH
+ # and DYLD_FALLBACK_LIBRARY_PATH.
paths = os.environ.get('LD_LIBRARY_PATH', '').split(':')
+ paths += os.environ.get('DYLD_LIBRARY_PATH', '').split(':')
+ paths += os.environ.get('DYLD_FALLBACK_LIBRARY_PATH', '').split(':')
- for libomp_name in self.get_libomp_names():
+ libomp_names = self.get_libomp_names()
+ for libomp_name in libomp_names:
if cxx is None or sys.platform == 'win32':
# Note: Clang supports -print-file-name, but not yet for
# clang-cl as of v12.0.0 (April '21)
@@ -87,25 +93,27 @@ class OpenMP(object):
except (OSError, CalledProcessError):
pass
- # Try to load find libgomp shared library using loader search dirs
- libgomp_path = find_library("gomp")
-
- # Try to use custom paths if lookup failed
- for path in paths:
- if libgomp_path:
- break
- path = path.strip()
- if os.path.isdir(path):
- libgomp_path = find_library(os.path.join(str(path), "libgomp"))
-
- if not libgomp_path:
- raise ImportError("I can't find a shared library for libgomp,"
- " you may need to install it or adjust the "
- "LD_LIBRARY_PATH environment variable.")
- else:
- # Load the library (shouldn't fail with an absolute path right?)
- self.libomp = ctypes.CDLL(libgomp_path)
- self.version = 45
+ for libomp_name in libomp_names:
+ # Try to load find libomp shared library using loader search dirs
+ libomp_path = find_library(libomp_name)
+
+ # Try to use custom paths if lookup failed
+ for path in paths:
+ if libomp_path:
+ break
+ path = path.strip()
+ if os.path.isfile(os.path.join(path, libomp_name)):
+ libomp_path = os.path.join(path, libomp_name)
+
+ if libomp_path:
+ # Load the library (shouldn't fail with an absolute path right?)
+ self.libomp = ctypes.CDLL(libomp_path)
+ self.version = 45
+ return
+
+ raise ImportError("I can't find a shared library for libomp,"
+ " you may need to install it or adjust the "
+ "LD_LIBRARY_PATH environment variable.")
def __getattr__(self, name):
"""

View File

@ -46,9 +46,8 @@ class PyPythran(PythonPackage):
depends_on('py-beniget', when='@:0.9.3', type=('build', 'run'))
depends_on('llvm-openmp', when='%apple-clang', type=('build', 'run'))
patch('https://patch-diff.githubusercontent.com/raw/serge-sans-paille/pythran/pull/1856.patch',
sha256='18f5e8985d636ad9c73b2f96b601aae299e0c315aa4c0dbee7b2599a63177218',
when='@0.9.10:0.9.12')
# https://github.com/serge-sans-paille/pythran/pull/1856
patch('omp.patch', when='@0.9.10:0.9.12')
def patch(self):
# Compiler is used at run-time to determine name of OpenMP library to search for