Skip to content

Commit

Permalink
Python: use pythonPackagesBuildHost instead of pythonForBuild
Browse files Browse the repository at this point in the history
Follow-up to NixOS#104201, related to NixOS#105113.
  • Loading branch information
FRidh committed Nov 28, 2020
1 parent be36f6f commit cce2fd5
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 21 deletions.
11 changes: 6 additions & 5 deletions pkgs/development/interpreters/python/cpython/2.7/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
, ucsEncoding ? 4
# For the Python package set
, packageOverrides ? (self: super: {})
, buildPackages
, pkgsBuildBuild
, pkgsBuildHost
, pkgsBuildTarget
, pkgsHostHost
, pkgsTargetTarget
Expand All @@ -28,6 +28,7 @@
, passthruFun
, static ? false
, enableOptimizations ? (!stdenv.isDarwin)
, pythonAttr ? "python${sourceVersion.major}${sourceVersion.minor}"
}:

assert x11Support -> tcl != null
Expand All @@ -38,9 +39,8 @@ assert x11Support -> tcl != null
with stdenv.lib;

let

pythonAttr = "python${sourceVersion.major}${sourceVersion.minor}";
pythonForBuild = buildPackages.${pythonAttr};
buildPackages = pkgsBuildHost;
inherit (passthru) pythonForBuild;

passthru = passthruFun rec {
inherit self sourceVersion packageOverrides;
Expand All @@ -49,8 +49,9 @@ let
executable = libPrefix;
pythonVersion = with sourceVersion; "${major}.${minor}";
sitePackages = "lib/${libPrefix}/site-packages";
inherit hasDistutilsCxxPatch pythonForBuild;
inherit hasDistutilsCxxPatch;
pythonPackagesBuildBuild = pkgsBuildBuild.${pythonAttr};
pythonPackagesBuildHost = pkgsBuildHost.${pythonAttr};
pythonPackagesBuildTarget = pkgsBuildTarget.${pythonAttr};
pythonPackagesHostHost = pkgsHostHost.${pythonAttr};
pythonPackagesTargetTarget = pkgsTargetTarget.${pythonAttr} or {};
Expand Down
11 changes: 5 additions & 6 deletions pkgs/development/interpreters/python/cpython/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,11 @@
, nukeReferences
# For the Python package set
, packageOverrides ? (self: super: {})
, buildPackages
, pkgsBuildBuild
, pkgsBuildHost
, pkgsBuildTarget
, pkgsHostHost
, pkgsTargetTarget
, pythonForBuild ? buildPackages.${pythonAttr}
, sourceVersion
, sha256
, passthruFun
Expand Down Expand Up @@ -58,7 +57,8 @@ assert bluezSupport -> bluez != null;
with stdenv.lib;

let

buildPackages = pkgsBuildHost;
inherit (passthru) pythonForBuild;

passthru = passthruFun rec {
inherit self sourceVersion packageOverrides;
Expand All @@ -67,8 +67,9 @@ let
executable = libPrefix;
pythonVersion = with sourceVersion; "${major}.${minor}";
sitePackages = "lib/${libPrefix}/site-packages";
inherit hasDistutilsCxxPatch pythonForBuild;
inherit hasDistutilsCxxPatch;
pythonPackagesBuildBuild = pkgsBuildBuild.${pythonAttr};
pythonPackagesBuildHost = pkgsBuildHost.${pythonAttr};
pythonPackagesBuildTarget = pkgsBuildTarget.${pythonAttr};
pythonPackagesHostHost = pkgsHostHost.${pythonAttr};
pythonPackagesTargetTarget = pkgsTargetTarget.${pythonAttr} or {};
Expand All @@ -95,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;
Expand Down
8 changes: 4 additions & 4 deletions pkgs/development/interpreters/python/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ with pkgs;
, sitePackages
, hasDistutilsCxxPatch
, pythonPackagesBuildBuild
, pythonForBuild # provides pythonPackagesBuildHost
, pythonPackagesBuildHost
, pythonPackagesBuildTarget
, pythonPackagesHostHost
, self # is pythonPackagesHostTarget
Expand All @@ -29,7 +29,7 @@ with pkgs;
};
otherSplices = {
selfBuildBuild = pythonPackagesBuildBuild;
selfBuildHost = pythonForBuild.pkgs;
selfBuildHost = pythonPackagesBuildHost;
selfBuildTarget = pythonPackagesBuildTarget;
selfHostHost = pythonPackagesHostHost;
selfTargetTarget = pythonPackagesTargetTarget;
Expand Down Expand Up @@ -99,7 +99,8 @@ with pkgs;
inherit sourceVersion;
pythonAtLeast = lib.versionAtLeast pythonVersion;
pythonOlder = lib.versionOlder pythonVersion;
inherit hasDistutilsCxxPatch pythonForBuild;
inherit hasDistutilsCxxPatch;
pythonForBuild = pythonPackagesBuildHost;

tests = callPackage ./tests.nix {
python = self;
Expand Down Expand Up @@ -188,7 +189,6 @@ in {
# Minimal versions of Python (built without optional dependencies)
python3Minimal = (python38.override {
self = python3Minimal;
pythonForBuild = pkgs.buildPackages.python3Minimal;
# strip down that python version as much as possible
openssl = null;
readline = null;
Expand Down
17 changes: 11 additions & 6 deletions pkgs/development/interpreters/python/pypy/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,16 @@
, python-setup-hook
# For the Python package set
, packageOverrides ? (self: super: {})
, pkgsBuildBuild
, pkgsBuildHost
, pkgsBuildTarget
, pkgsHostHost
, pkgsTargetTarget
, sourceVersion
, pythonVersion
, sha256
, passthruFun
, pythonAttr ? "pypy${stdenv.lib.substring 0 1 pythonVersion}${stdenv.lib.substring 2 3 pythonVersion}"
}:

assert zlibSupport -> zlib != null;
Expand All @@ -25,12 +31,11 @@ let
sitePackages = "site-packages";
hasDistutilsCxxPatch = false;

# No cross-compiling for now.
pythonForBuild = self;
pythonPackagesBuildBuild = {};
pythonPackagesBuildTarget = {};
pythonPackagesHostHost = {};
pythonPackagesTargetTarget = {};
pythonPackagesBuildBuild = pkgsBuildBuild.${pythonAttr};
pythonPackagesBuildHost = pkgsBuildHost.${pythonAttr};
pythonPackagesBuildTarget = pkgsBuildTarget.${pythonAttr};
pythonPackagesHostHost = pkgsHostHost.${pythonAttr};
pythonPackagesTargetTarget = pkgsTargetTarget.${pythonAttr} or {};
};
pname = passthru.executable;
version = with sourceVersion; "${major}.${minor}.${patch}";
Expand Down

0 comments on commit cce2fd5

Please sign in to comment.