diff options
author | Frederik Rietdijk <fridh@fridh.nl> | 2022-04-20 21:20:50 +0200 |
---|---|---|
committer | Frederik Rietdijk <freddyrietdijk@fridh.nl> | 2022-04-21 14:50:28 +0200 |
commit | ba02fd0434ed92b7335f17c97af689b9db1413e0 (patch) | |
tree | baf12810329fa9103cc179574ef5c83c5ed7ef27 /pkgs/development/interpreters | |
parent | eea1b97e62827515bb600193dce33d4c8ea935e0 (diff) |
python3: fix overriding of interpreters, closes #163639
Overriding the interpreters did not work correctly. When overriding packages would end up twice in the build time closure: one corresponding to the overridden interpreter and one corresponding to the original interpreter. The reason is that the override was not applied to the interpreters in the spliced package sets.
Diffstat (limited to 'pkgs/development/interpreters')
-rw-r--r-- | pkgs/development/interpreters/python/cpython/default.nix | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/pkgs/development/interpreters/python/cpython/default.nix b/pkgs/development/interpreters/python/cpython/default.nix index 97db4a9fffa85..23c85942ad705 100644 --- a/pkgs/development/interpreters/python/cpython/default.nix +++ b/pkgs/development/interpreters/python/cpython/default.nix @@ -49,7 +49,7 @@ , enableLTO ? stdenv.is64bit && stdenv.isLinux , reproducibleBuild ? false , pythonAttr ? "python${sourceVersion.major}${sourceVersion.minor}" -}: +} @ inputs: # Note: this package is used for bootstrapping fetchurl, and thus # cannot use fetchpatch! All mutable patches (generated by GitHub or @@ -83,7 +83,10 @@ let tzdataSupport = tzdata != null && passthru.pythonAtLeast "3.9"; - passthru = passthruFun rec { + passthru = let + # When we override the interpreter we also need to override the spliced versions of the interpreter + override = attr: let python = attr.override (inputs // { self = python; }); in python; + in passthruFun rec { inherit self sourceVersion packageOverrides; implementation = "cpython"; libPrefix = "python${pythonVersion}"; @@ -91,11 +94,11 @@ let pythonVersion = with sourceVersion; "${major}.${minor}"; sitePackages = "lib/${libPrefix}/site-packages"; inherit hasDistutilsCxxPatch; - pythonOnBuildForBuild = pkgsBuildBuild.${pythonAttr}; - pythonOnBuildForHost = pkgsBuildHost.${pythonAttr}; - pythonOnBuildForTarget = pkgsBuildTarget.${pythonAttr}; - pythonOnHostForHost = pkgsHostHost.${pythonAttr}; - pythonOnTargetForTarget = pkgsTargetTarget.${pythonAttr} or {}; + pythonOnBuildForBuild = override pkgsBuildBuild.${pythonAttr}; + pythonOnBuildForHost = override pkgsBuildHost.${pythonAttr}; + pythonOnBuildForTarget = override pkgsBuildTarget.${pythonAttr}; + pythonOnHostForHost = override pkgsHostHost.${pythonAttr}; + pythonOnTargetForTarget = if lib.hasAttr pythonAttr pkgsTargetTarget then (override pkgsTargetTarget.${pythonAttr}) else {}; }; version = with sourceVersion; "${major}.${minor}.${patch}${suffix}"; |