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.
This commit is contained in:
parent
eea1b97e62
commit
ba02fd0434
@ -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}";
|
||||
|
Loading…
Reference in New Issue
Block a user