mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-13 21:50:33 +03:00
python3: Fixing excessive memory usage for overriden python in cross-compile (#394541)
This commit is contained in:
commit
175fb278c1
2 changed files with 28 additions and 13 deletions
|
@ -55,6 +55,7 @@
|
||||||
pkgsBuildTarget,
|
pkgsBuildTarget,
|
||||||
pkgsHostHost,
|
pkgsHostHost,
|
||||||
pkgsTargetTarget,
|
pkgsTargetTarget,
|
||||||
|
__splices ? { },
|
||||||
|
|
||||||
# build customization
|
# build customization
|
||||||
sourceVersion,
|
sourceVersion,
|
||||||
|
@ -145,10 +146,28 @@ let
|
||||||
# When we override the interpreter we also need to override the spliced versions of the interpreter
|
# When we override the interpreter we also need to override the spliced versions of the interpreter
|
||||||
# bluez is excluded manually to break an infinite recursion.
|
# bluez is excluded manually to break an infinite recursion.
|
||||||
inputs' = lib.filterAttrs (n: v: n != "bluez" && n != "passthruFun" && !lib.isDerivation v) inputs;
|
inputs' = lib.filterAttrs (n: v: n != "bluez" && n != "passthruFun" && !lib.isDerivation v) inputs;
|
||||||
|
# Memoization of the splices to avoid re-evaluating this function for all combinations of splices e.g.
|
||||||
|
# python3.pythonOnBuildForHost.pythonOnBuildForTarget == python3.pythonOnBuildForTarget by consuming
|
||||||
|
# __splices as an arg and using the cache if populated.
|
||||||
|
splices = {
|
||||||
|
pythonOnBuildForBuild = override pkgsBuildBuild.${pythonAttr};
|
||||||
|
pythonOnBuildForHost = override pkgsBuildHost.${pythonAttr};
|
||||||
|
pythonOnBuildForTarget = override pkgsBuildTarget.${pythonAttr};
|
||||||
|
pythonOnHostForHost = override pkgsHostHost.${pythonAttr};
|
||||||
|
pythonOnTargetForTarget = lib.optionalAttrs (lib.hasAttr pythonAttr pkgsTargetTarget) (
|
||||||
|
override pkgsTargetTarget.${pythonAttr}
|
||||||
|
);
|
||||||
|
} // __splices;
|
||||||
override =
|
override =
|
||||||
attr:
|
attr:
|
||||||
let
|
let
|
||||||
python = attr.override (inputs' // { self = python; });
|
python = attr.override (
|
||||||
|
inputs'
|
||||||
|
// {
|
||||||
|
self = python;
|
||||||
|
__splices = splices;
|
||||||
|
}
|
||||||
|
);
|
||||||
in
|
in
|
||||||
python;
|
python;
|
||||||
in
|
in
|
||||||
|
@ -160,13 +179,13 @@ let
|
||||||
pythonVersion = with sourceVersion; "${major}.${minor}";
|
pythonVersion = with sourceVersion; "${major}.${minor}";
|
||||||
sitePackages = "lib/${libPrefix}/site-packages";
|
sitePackages = "lib/${libPrefix}/site-packages";
|
||||||
inherit hasDistutilsCxxPatch pythonAttr;
|
inherit hasDistutilsCxxPatch pythonAttr;
|
||||||
pythonOnBuildForBuild = override pkgsBuildBuild.${pythonAttr};
|
inherit (splices)
|
||||||
pythonOnBuildForHost = override pkgsBuildHost.${pythonAttr};
|
pythonOnBuildForBuild
|
||||||
pythonOnBuildForTarget = override pkgsBuildTarget.${pythonAttr};
|
pythonOnBuildForHost
|
||||||
pythonOnHostForHost = override pkgsHostHost.${pythonAttr};
|
pythonOnBuildForTarget
|
||||||
pythonOnTargetForTarget = lib.optionalAttrs (lib.hasAttr pythonAttr pkgsTargetTarget) (
|
pythonOnHostForHost
|
||||||
override pkgsTargetTarget.${pythonAttr}
|
pythonOnTargetForTarget
|
||||||
);
|
;
|
||||||
};
|
};
|
||||||
|
|
||||||
version = with sourceVersion; "${major}.${minor}.${patch}${suffix}";
|
version = with sourceVersion; "${major}.${minor}.${patch}${suffix}";
|
||||||
|
|
|
@ -106,10 +106,6 @@ let
|
||||||
python = self;
|
python = self;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
pythonOnBuildForHost_overridden = pythonOnBuildForHost.override {
|
|
||||||
inherit packageOverrides;
|
|
||||||
self = pythonOnBuildForHost_overridden;
|
|
||||||
};
|
|
||||||
in
|
in
|
||||||
rec {
|
rec {
|
||||||
isPy27 = pythonVersion == "2.7";
|
isPy27 = pythonVersion == "2.7";
|
||||||
|
@ -144,7 +140,7 @@ rec {
|
||||||
pythonAtLeast = lib.versionAtLeast pythonVersion;
|
pythonAtLeast = lib.versionAtLeast pythonVersion;
|
||||||
pythonOlder = lib.versionOlder pythonVersion;
|
pythonOlder = lib.versionOlder pythonVersion;
|
||||||
inherit hasDistutilsCxxPatch;
|
inherit hasDistutilsCxxPatch;
|
||||||
pythonOnBuildForHost = pythonOnBuildForHost_overridden;
|
inherit pythonOnBuildForHost;
|
||||||
|
|
||||||
tests = callPackage ./tests.nix {
|
tests = callPackage ./tests.nix {
|
||||||
python = self;
|
python = self;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue