diff options
Diffstat (limited to 'infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/default.nix')
-rw-r--r-- | infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/default.nix | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/default.nix b/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/default.nix index b25d613eb7f3..cd06c2b63670 100644 --- a/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/default.nix +++ b/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/default.nix @@ -14,12 +14,16 @@ , self , configd , autoreconfHook +, autoconf-archive , python-setup-hook , nukeReferences # For the Python package set , packageOverrides ? (self: super: {}) -, buildPackages -, pythonForBuild ? buildPackages.${"python${sourceVersion.major}${sourceVersion.minor}"} +, pkgsBuildBuild +, pkgsBuildHost +, pkgsBuildTarget +, pkgsHostHost +, pkgsTargetTarget , sourceVersion , sha256 , passthruFun @@ -35,6 +39,7 @@ # Not using optimizations on Darwin # configure: error: llvm-profdata is required for a --enable-optimizations build but could not be found. , enableOptimizations ? (!stdenv.isDarwin) +, pythonAttr ? "python${sourceVersion.major}${sourceVersion.minor}" }: # Note: this package is used for bootstrapping fetchurl, and thus @@ -52,6 +57,8 @@ assert bluezSupport -> bluez != null; with stdenv.lib; let + buildPackages = pkgsBuildHost; + inherit (passthru) pythonForBuild; passthru = passthruFun rec { inherit self sourceVersion packageOverrides; @@ -60,13 +67,20 @@ let executable = libPrefix; pythonVersion = with sourceVersion; "${major}.${minor}"; sitePackages = "lib/${libPrefix}/site-packages"; - inherit hasDistutilsCxxPatch pythonForBuild; + inherit hasDistutilsCxxPatch; + pythonOnBuildForBuild = pkgsBuildBuild.${pythonAttr}; + pythonOnBuildForHost = pkgsBuildHost.${pythonAttr}; + pythonOnBuildForTarget = pkgsBuildTarget.${pythonAttr}; + pythonOnHostForHost = pkgsHostHost.${pythonAttr}; + pythonOnTargetForTarget = pkgsTargetTarget.${pythonAttr} or {}; }; version = with sourceVersion; "${major}.${minor}.${patch}${suffix}"; nativeBuildInputs = optionals (!stdenv.isDarwin) [ autoreconfHook + ] ++ optionals (!stdenv.isDarwin && passthru.pythonAtLeast "3.10") [ + autoconf-archive # needed for AX_CHECK_COMPILE_FLAG ] ++ [ nukeReferences ] ++ optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ @@ -82,8 +96,6 @@ let hasDistutilsCxxPatch = !(stdenv.cc.isGNU or false); - inherit pythonForBuild; - pythonForBuildInterpreter = if stdenv.hostPlatform == stdenv.buildPlatform then "$out/bin/python" else pythonForBuild.interpreter; @@ -291,13 +303,6 @@ in with passthru; stdenv.mkDerivation { find $out -name "*.py" | ${pythonForBuildInterpreter} -OO -m compileall -q -f -x "lib2to3" -i - '' + optionalString stripBytecode '' find $out -type d -name __pycache__ -print0 | xargs -0 -I {} rm -rf "{}" - '' + '' - # *strip* shebang from libpython gdb script - it should be dual-syntax and - # interpretable by whatever python the gdb in question is using, which may - # not even match the major version of this python. doing this after the - # bytecode compilations for the same reason. - mkdir -p $out/share/gdb - sed '/^#!/d' Tools/gdb/libpython.py > $out/share/gdb/libpython.py ''; preFixup = stdenv.lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) '' @@ -315,8 +320,6 @@ in with passthru; stdenv.mkDerivation { pythonForBuild buildPackages.bash ]; - separateDebugInfo = true; - inherit passthru; enableParallelBuilding = true; |