Merge pull request #179421 from K900/bump-pythran

python310Packages.pythran: 0.9.12 -> 0.11.0

authored by Sandro and committed by GitHub df0bbd39 30392f68

+69 -69
+66 -51
pkgs/development/python-modules/pythran/0001-hardcode-path-to-libgomp.patch
··· 1 - From 208fe98f10c580a5a2fb6a8cfdd56de109073925 Mon Sep 17 00:00:00 2001 2 - From: Frederik Rietdijk <fridh@fridh.nl> 3 - Date: Sat, 17 Jul 2021 18:36:27 +0200 4 - Subject: [PATCH] hardcode path to libgomp 5 - 6 - --- 7 - omp/__init__.py | 40 ++++------------------------------------ 8 - 1 file changed, 4 insertions(+), 36 deletions(-) 9 - 10 diff --git a/omp/__init__.py b/omp/__init__.py 11 - index bddae3063..9ba3678d8 100644 12 --- a/omp/__init__.py 13 +++ b/omp/__init__.py 14 - @@ -69,43 +69,11 @@ class OpenMP(object): 15 16 def init_not_msvc(self): 17 - """ Find OpenMP library and try to load if using ctype interface. """ 18 - - # find_library() does not search automatically LD_LIBRARY_PATH 19 - - paths = os.environ.get('LD_LIBRARY_PATH', '').split(':') 20 - + libgomp_path = "@gomp@" 21 - 22 - - for libomp_name in self.get_libomp_names(): 23 - - if cxx is None or sys.platform == 'win32': 24 - - # Note: Clang supports -print-file-name, but not yet for 25 - - # clang-cl as of v12.0.0 (April '21) 26 - - continue 27 - 28 - - cmd = [cxx, '-print-file-name=' + libomp_name] 29 - - # the subprocess can fail in various ways in that case just give up 30 - - try: 31 - - path = os.path.dirname(check_output(cmd).decode().strip()) 32 - - if path: 33 - - paths.append(path) 34 - - except (OSError, CalledProcessError): 35 - - pass 36 - 37 - - # Try to load find libgomp shared library using loader search dirs 38 - - libgomp_path = find_library("gomp") 39 - 40 - - # Try to use custom paths if lookup failed 41 - - for path in paths: 42 - - if libgomp_path: 43 - - break 44 - - path = path.strip() 45 - - if os.path.isdir(path): 46 - - libgomp_path = find_library(os.path.join(str(path), "libgomp")) 47 - 48 - - if not libgomp_path: 49 - - raise ImportError("I can't find a shared library for libgomp," 50 - - " you may need to install it or adjust the " 51 - - "LD_LIBRARY_PATH environment variable.") 52 - - else: 53 - - # Load the library (shouldn't fail with an absolute path right?) 54 - - self.libomp = ctypes.CDLL(libgomp_path) 55 - - self.version = 45 56 - + # Load the library (shouldn't fail with an absolute path right?) 57 - + self.libomp = ctypes.CDLL(libgomp_path) 58 + self.version = 45 59 60 def __getattr__(self, name): 61 """ 62 - -- 63 - 2.32.0 64 -
··· 1 diff --git a/omp/__init__.py b/omp/__init__.py 2 + index 3801d1c8c..a93a74d6f 100644 3 --- a/omp/__init__.py 4 +++ b/omp/__init__.py 5 + @@ -48,72 +48,8 @@ class OpenMP(object): 6 + return ['omp', 'gomp', 'iomp5'] 7 8 def init_not_msvc(self): 9 + - """ Find OpenMP library and try to load if using ctype interface. """ 10 + - # find_library() does not automatically search LD_LIBRARY_PATH 11 + - # until Python 3.6+, so we explicitly add it. 12 + - # LD_LIBRARY_PATH is used on Linux, while macOS uses DYLD_LIBRARY_PATH 13 + - # and DYLD_FALLBACK_LIBRARY_PATH. 14 + - env_vars = [] 15 + - if sys.platform == 'darwin': 16 + - env_vars = ['DYLD_LIBRARY_PATH', 'DYLD_FALLBACK_LIBRARY_PATH'] 17 + - else: 18 + - env_vars = ['LD_LIBRARY_PATH'] 19 + - 20 + - paths = [] 21 + - for env_var in env_vars: 22 + - env_paths = os.environ.get(env_var, '') 23 + - if env_paths: 24 + - paths.extend(env_paths.split(os.pathsep)) 25 + - 26 + - 27 + - libomp_names = self.get_libomp_names() 28 + - 29 + - if cxx is not None: 30 + - for libomp_name in libomp_names: 31 + - cmd = [cxx, 32 + - '-print-file-name=lib{}{}'.format( 33 + - libomp_name, 34 + - get_shared_lib_extension())] 35 + - # The subprocess can fail in various ways, including because it 36 + - # doesn't support '-print-file-name'. In that case just give up. 37 + - try: 38 + - output = check_output(cmd, 39 + - stderr=DEVNULL) 40 + - path = os.path.dirname(output.decode().strip()) 41 + - if path: 42 + - paths.append(path) 43 + - except (OSError, CalledProcessError): 44 + - pass 45 + - 46 + - 47 + - for libomp_name in libomp_names: 48 + - # Try to load find libomp shared library using loader search dirs 49 + - libomp_path = find_library(libomp_name) 50 - 51 + - # Try to use custom paths if lookup failed 52 + - if not libomp_path: 53 + - for path in paths: 54 + - candidate_path = os.path.join( 55 + - path, 56 + - 'lib{}{}'.format(libomp_name, 57 + - get_shared_lib_extension())) 58 + - if os.path.isfile(candidate_path): 59 + - libomp_path = candidate_path 60 + - break 61 - 62 + - # Load the library 63 + - if libomp_path: 64 + - try: 65 + - self.libomp = ctypes.CDLL(libomp_path) 66 + - except OSError: 67 + - raise ImportError("found openMP library '{}' but couldn't load it. " 68 + - "This may happen if you are cross-compiling.".format(libomp_path)) 69 + - self.version = 45 70 + - return 71 - 72 + - raise ImportError("I can't find a shared library for libomp, you may need to install it " 73 + - "or adjust the {} environment variable.".format(env_vars[0])) 74 - 75 + + self.libomp = ctypes.CDLL("@gomp@") 76 + self.version = 45 77 78 def __getattr__(self, name): 79 """
+3 -18
pkgs/development/python-modules/pythran/default.nix
··· 3 , buildPythonPackage 4 , fetchFromGitHub 5 , openmp 6 - , pytest-runner 7 , ply 8 , networkx 9 , decorator ··· 11 , six 12 , numpy 13 , beniget 14 - , pytestCheckHook 15 - , scipy 16 , isPy3k 17 , substituteAll 18 }: ··· 22 23 in buildPythonPackage rec { 24 pname = "pythran"; 25 - version = "0.9.12"; 26 27 src = fetchFromGitHub { 28 owner = "serge-sans-paille"; 29 repo = "pythran"; 30 rev = version; 31 - sha256 = "sha256-lQbVq4K/Q8RzlFhE+l3HPCmUGmauXawcKe31kfbUHsI="; 32 }; 33 34 patches = [ ··· 37 src = ./0001-hardcode-path-to-libgomp.patch; 38 gomp = "${if stdenv.cc.isClang then openmp else stdenv.cc.cc.lib}/lib/libgomp${stdenv.hostPlatform.extensions.sharedLibrary}"; 39 }) 40 - ]; 41 - 42 - nativeBuildInputs = [ 43 - pytest-runner 44 ]; 45 46 propagatedBuildInputs = [ ··· 62 "pythran.spec" 63 ]; 64 65 - checkInputs = [ 66 - pytestCheckHook 67 - numpy 68 - scipy 69 - ]; 70 - 71 - # Test suite is huge. 72 - # Also, in the future scipy will rely on it resulting in a circular test dependency 73 doCheck = false; 74 75 disabled = !isPy3k; ··· 79 homepage = "https://github.com/serge-sans-paille/pythran"; 80 license = lib.licenses.bsd3; 81 }; 82 - 83 }
··· 3 , buildPythonPackage 4 , fetchFromGitHub 5 , openmp 6 , ply 7 , networkx 8 , decorator ··· 10 , six 11 , numpy 12 , beniget 13 , isPy3k 14 , substituteAll 15 }: ··· 19 20 in buildPythonPackage rec { 21 pname = "pythran"; 22 + version = "0.11.0"; 23 24 src = fetchFromGitHub { 25 owner = "serge-sans-paille"; 26 repo = "pythran"; 27 rev = version; 28 + sha256 = "sha256-F9gUZOTSuiqvfGoN4yQqwUg9mnCeBntw5eHO7ZnjpzI="; 29 }; 30 31 patches = [ ··· 34 src = ./0001-hardcode-path-to-libgomp.patch; 35 gomp = "${if stdenv.cc.isClang then openmp else stdenv.cc.cc.lib}/lib/libgomp${stdenv.hostPlatform.extensions.sharedLibrary}"; 36 }) 37 ]; 38 39 propagatedBuildInputs = [ ··· 55 "pythran.spec" 56 ]; 57 58 + # Test suite is huge and has a circular dependency on scipy. 59 doCheck = false; 60 61 disabled = !isPy3k; ··· 65 homepage = "https://github.com/serge-sans-paille/pythran"; 66 license = lib.licenses.bsd3; 67 }; 68 }