Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)

Merge pull request #203468 from mweinelt/python312

authored by Martin Weinelt and committed by GitHub a5ab2a3f 700a1909

+136 -7
+107
pkgs/development/interpreters/python/cpython/3.12/no-ldconfig.patch
··· 1 + From 5330b6af9f832af59aa5c61d9ef6971053a8e709 Mon Sep 17 00:00:00 2001 2 + From: Jonathan Ringer <jonringer117@gmail.com> 3 + Date: Mon, 9 Nov 2020 10:24:35 -0800 4 + Subject: [PATCH] CPython: Don't use ldconfig 5 + 6 + --- 7 + Lib/ctypes/util.py | 77 ++-------------------------------------------- 8 + 1 file changed, 2 insertions(+), 75 deletions(-) 9 + 10 + diff --git a/Lib/ctypes/util.py b/Lib/ctypes/util.py 11 + index 0c2510e161..7fb98af308 100644 12 + --- a/Lib/ctypes/util.py 13 + +++ b/Lib/ctypes/util.py 14 + @@ -100,53 +100,7 @@ def _is_elf(filename): 15 + return thefile.read(4) == elf_header 16 + 17 + def _findLib_gcc(name): 18 + - # Run GCC's linker with the -t (aka --trace) option and examine the 19 + - # library name it prints out. The GCC command will fail because we 20 + - # haven't supplied a proper program with main(), but that does not 21 + - # matter. 22 + - expr = os.fsencode(r'[^\(\)\s]*lib%s\.[^\(\)\s]*' % re.escape(name)) 23 + - 24 + - c_compiler = shutil.which('gcc') 25 + - if not c_compiler: 26 + - c_compiler = shutil.which('cc') 27 + - if not c_compiler: 28 + - # No C compiler available, give up 29 + - return None 30 + - 31 + - temp = tempfile.NamedTemporaryFile() 32 + - try: 33 + - args = [c_compiler, '-Wl,-t', '-o', temp.name, '-l' + name] 34 + - 35 + - env = dict(os.environ) 36 + - env['LC_ALL'] = 'C' 37 + - env['LANG'] = 'C' 38 + - try: 39 + - proc = subprocess.Popen(args, 40 + - stdout=subprocess.PIPE, 41 + - stderr=subprocess.STDOUT, 42 + - env=env) 43 + - except OSError: # E.g. bad executable 44 + - return None 45 + - with proc: 46 + - trace = proc.stdout.read() 47 + - finally: 48 + - try: 49 + - temp.close() 50 + - except FileNotFoundError: 51 + - # Raised if the file was already removed, which is the normal 52 + - # behaviour of GCC if linking fails 53 + - pass 54 + - res = re.findall(expr, trace) 55 + - if not res: 56 + - return None 57 + - 58 + - for file in res: 59 + - # Check if the given file is an elf file: gcc can report 60 + - # some files that are linker scripts and not actual 61 + - # shared objects. See bpo-41976 for more details 62 + - if not _is_elf(file): 63 + - continue 64 + - return os.fsdecode(file) 65 + + return None 66 + 67 + 68 + if sys.platform == "sunos5": 69 + @@ -268,34 +222,7 @@ def find_library(name, is64 = False): 70 + else: 71 + 72 + def _findSoname_ldconfig(name): 73 + - import struct 74 + - if struct.calcsize('l') == 4: 75 + - machine = os.uname().machine + '-32' 76 + - else: 77 + - machine = os.uname().machine + '-64' 78 + - mach_map = { 79 + - 'x86_64-64': 'libc6,x86-64', 80 + - 'ppc64-64': 'libc6,64bit', 81 + - 'sparc64-64': 'libc6,64bit', 82 + - 's390x-64': 'libc6,64bit', 83 + - 'ia64-64': 'libc6,IA-64', 84 + - } 85 + - abi_type = mach_map.get(machine, 'libc6') 86 + - 87 + - # XXX assuming GLIBC's ldconfig (with option -p) 88 + - regex = r'\s+(lib%s\.[^\s]+)\s+\(%s' 89 + - regex = os.fsencode(regex % (re.escape(name), abi_type)) 90 + - try: 91 + - with subprocess.Popen(['/sbin/ldconfig', '-p'], 92 + - stdin=subprocess.DEVNULL, 93 + - stderr=subprocess.DEVNULL, 94 + - stdout=subprocess.PIPE, 95 + - env={'LC_ALL': 'C', 'LANG': 'C'}) as p: 96 + - res = re.search(regex, p.stdout.read()) 97 + - if res: 98 + - return os.fsdecode(res.group(1)) 99 + - except OSError: 100 + - pass 101 + + return None 102 + 103 + def _findLib_ld(name): 104 + # See issue #9998 for why this is needed 105 + -- 106 + 2.33.1 107 +
+3 -6
pkgs/development/interpreters/python/cpython/default.nix
··· 121 121 ]; 122 122 123 123 buildInputs = filter (p: p != null) ([ 124 - zlib bzip2 expat xz libffi gdbm sqlite readline ncurses openssl' ] 124 + zlib bzip2 expat xz libffi libxcrypt gdbm sqlite readline ncurses openssl' ] 125 125 ++ optionals x11Support [ tcl tk libX11 xorgproto ] 126 126 ++ optionals (bluezSupport && stdenv.isLinux) [ bluez ] 127 127 ++ optionals stdenv.isDarwin [ configd ]) ··· 264 264 sha256 = "1h18lnpx539h5lfxyk379dxwr8m2raigcjixkf133l4xy3f4bzi2"; 265 265 } 266 266 ) 267 - ] ++ [ 267 + ] ++ optionals (pythonOlder "3.12") [ 268 268 # LDSHARED now uses $CC instead of gcc. Fixes cross-compilation of extension modules. 269 269 ./3.8/0001-On-all-posix-systems-not-just-Darwin-set-LDSHARED-if.patch 270 270 # Use sysconfigdata to find headers. Fixes cross-compilation of extension modules. ··· 333 333 # Never even try to use lchmod on linux, 334 334 # don't rely on detecting glibc-isms. 335 335 "ac_cv_func_lchmod=no" 336 - ] ++ optionals (libxcrypt != null) [ 337 - "CFLAGS=-I${libxcrypt}/include" 338 - "LIBS=-L${libxcrypt}/lib" 339 336 ] ++ optionals tzdataSupport [ 340 337 "--with-tzpath=${tzdata}/share/zoneinfo" 341 338 ] ++ optional static "LDFLAGS=-static"; 342 339 343 - preConfigure = '' 340 + preConfigure = optionalString (pythonOlder "3.12") '' 344 341 for i in /usr /sw /opt /pkg; do # improve purity 345 342 substituteInPlace ./setup.py --replace $i /no-such-path 346 343 done
+14
pkgs/development/interpreters/python/default.nix
··· 89 89 isPy39 = pythonVersion == "3.9"; 90 90 isPy310 = pythonVersion == "3.10"; 91 91 isPy311 = pythonVersion == "3.11"; 92 + isPy312 = pythonVersion == "3.12"; 92 93 isPy2 = lib.strings.substring 0 1 pythonVersion == "2"; 93 94 isPy3 = lib.strings.substring 0 1 pythonVersion == "3"; 94 95 isPy3k = isPy3; ··· 197 198 suffix = ""; 198 199 }; 199 200 sha256 = "sha256-pX3ILXc1hhe6ZbmEHO4eO0QfOGw3id3AZ27KB38pUcM="; 201 + inherit (darwin) configd; 202 + inherit passthruFun; 203 + }; 204 + 205 + python312 = callPackage ./cpython { 206 + self = __splicedPackages.python312; 207 + sourceVersion = { 208 + major = "3"; 209 + minor = "12"; 210 + patch = "0"; 211 + suffix = "a2"; 212 + }; 213 + sha256 = "sha256-Hq/BOE5TLKxkMmMqdzUO9QShFMQjXB9vKoX4F/Wxkmo="; 200 214 inherit (darwin) configd; 201 215 inherit passthruFun; 202 216 };
+10
pkgs/development/python-modules/pytest-freezegun/default.nix
··· 1 1 { lib 2 2 , buildPythonPackage 3 3 , fetchFromGitHub 4 + , fetchpatch 4 5 , freezegun 5 6 , pytest 6 7 , pytestCheckHook ··· 16 17 rev = version; 17 18 sha256 = "10c4pbh03b4s1q8cjd75lr0fvyf9id0zmdk29566qqsmaz28npas"; 18 19 }; 20 + 21 + patches = [ 22 + (fetchpatch { 23 + # https://github.com/ktosiek/pytest-freezegun/pull/38 24 + name = "pytest-freezegun-drop-distutils.patch"; 25 + url = "https://github.com/ktosiek/pytest-freezegun/commit/03d7107a877e8f07617f931a379f567d89060085.patch"; 26 + hash = "sha256-/7GTQdidVbE2LT5hwxjEc2dr+aWr6TX1131U4KMQhns="; 27 + }) 28 + ]; 19 29 20 30 buildInputs = [ pytest ]; 21 31
+2 -1
pkgs/top-level/all-packages.nix
··· 16047 16047 }; 16048 16048 16049 16049 pythonInterpreters = callPackage ./../development/interpreters/python { }; 16050 - inherit (pythonInterpreters) python27 python37 python38 python39 python310 python311 python3Minimal pypy27 pypy39 pypy38 pypy37 rustpython; 16050 + inherit (pythonInterpreters) python27 python37 python38 python39 python310 python311 python312 python3Minimal pypy27 pypy39 pypy38 pypy37 rustpython; 16051 16051 16052 16052 # List of extensions with overrides to apply to all Python package sets. 16053 16053 pythonPackagesExtensions = [ ]; ··· 16058 16058 python39Packages = recurseIntoAttrs python39.pkgs; 16059 16059 python310Packages = recurseIntoAttrs python310.pkgs; 16060 16060 python311Packages = python311.pkgs; 16061 + python312Packages = python312.pkgs; 16061 16062 pypyPackages = pypy.pkgs; 16062 16063 pypy2Packages = pypy2.pkgs; 16063 16064 pypy27Packages = pypy27.pkgs;