From 8ee5bf6d03d29274b012d9923a333b66a1dccbc1 Mon Sep 17 00:00:00 2001 From: "Adam J. Stewart" Date: Mon, 30 Aug 2021 12:02:39 -0500 Subject: py-pythran: update checksum for patch (#25693) * Replace URL patch with file patch * Add comment explaining patch origin and purpose --- .../repos/builtin/packages/py-pythran/omp.patch | 70 ++++++++++++++++++++++ .../repos/builtin/packages/py-pythran/package.py | 5 +- 2 files changed, 72 insertions(+), 3 deletions(-) create mode 100644 var/spack/repos/builtin/packages/py-pythran/omp.patch (limited to 'var') diff --git a/var/spack/repos/builtin/packages/py-pythran/omp.patch b/var/spack/repos/builtin/packages/py-pythran/omp.patch new file mode 100644 index 0000000000..19aa2c6863 --- /dev/null +++ b/var/spack/repos/builtin/packages/py-pythran/omp.patch @@ -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): + """ diff --git a/var/spack/repos/builtin/packages/py-pythran/package.py b/var/spack/repos/builtin/packages/py-pythran/package.py index 9042ec0326..e48928a90b 100644 --- a/var/spack/repos/builtin/packages/py-pythran/package.py +++ b/var/spack/repos/builtin/packages/py-pythran/package.py @@ -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 -- cgit v1.2.3-70-g09d2