diff options
author | John Ericson <git@JohnEricson.me> | 2020-11-28 12:02:20 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-28 12:02:20 -0500 |
commit | 2622548c138fbf151fd3f130fe41864590520121 (patch) | |
tree | ccb25d30d4629b0e1e10432a30c8f95e1fd048a8 | |
parent | a2593d568537f07563c7618ec5239d9f90f5202b (diff) | |
parent | 455774e5466681a90f864125424871bfe2a504d2 (diff) |
Merge pull request #105155 from FRidh/splice
Python: rename internal parameters related to splicing and fix splicing
5 files changed, 46 insertions, 39 deletions
diff --git a/pkgs/development/interpreters/python/cpython/2.7/default.nix b/pkgs/development/interpreters/python/cpython/2.7/default.nix index 26bd8a8f3609..e6ab1f218795 100644 --- a/pkgs/development/interpreters/python/cpython/2.7/default.nix +++ b/pkgs/development/interpreters/python/cpython/2.7/default.nix @@ -18,8 +18,8 @@ , ucsEncoding ? 4 # For the Python package set , packageOverrides ? (self: super: {}) -, buildPackages , pkgsBuildBuild +, pkgsBuildHost , pkgsBuildTarget , pkgsHostHost , pkgsTargetTarget @@ -28,6 +28,7 @@ , passthruFun , static ? false , enableOptimizations ? (!stdenv.isDarwin) +, pythonAttr ? "python${sourceVersion.major}${sourceVersion.minor}" }: assert x11Support -> tcl != null @@ -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; @@ -49,11 +49,12 @@ let executable = libPrefix; pythonVersion = with sourceVersion; "${major}.${minor}"; sitePackages = "lib/${libPrefix}/site-packages"; - inherit hasDistutilsCxxPatch pythonForBuild; - pythonPackagesBuildBuild = pkgsBuildBuild.${pythonAttr}; - pythonPackagesBuildTarget = pkgsBuildTarget.${pythonAttr}; - pythonPackagesHostHost = pkgsHostHost.${pythonAttr}; - pythonPackagesTargetTarget = pkgsTargetTarget.${pythonAttr} or {}; + inherit hasDistutilsCxxPatch; + pythonOnBuildForBuild = pkgsBuildBuild.${pythonAttr}; + pythonOnBuildForHost = pkgsBuildHost.${pythonAttr}; + pythonOnBuildForTarget = pkgsBuildTarget.${pythonAttr}; + pythonOnHostForHost = pkgsHostHost.${pythonAttr}; + pythonOnTargetForTarget = pkgsTargetTarget.${pythonAttr} or {}; } // { inherit ucsEncoding; }; diff --git a/pkgs/development/interpreters/python/cpython/default.nix b/pkgs/development/interpreters/python/cpython/default.nix index 02777063a772..cd06c2b63670 100644 --- a/pkgs/development/interpreters/python/cpython/default.nix +++ b/pkgs/development/interpreters/python/cpython/default.nix @@ -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 @@ -58,7 +57,8 @@ assert bluezSupport -> bluez != null; with stdenv.lib; let - + buildPackages = pkgsBuildHost; + inherit (passthru) pythonForBuild; passthru = passthruFun rec { inherit self sourceVersion packageOverrides; @@ -67,11 +67,12 @@ let executable = libPrefix; pythonVersion = with sourceVersion; "${major}.${minor}"; sitePackages = "lib/${libPrefix}/site-packages"; - inherit hasDistutilsCxxPatch pythonForBuild; - pythonPackagesBuildBuild = pkgsBuildBuild.${pythonAttr}; - pythonPackagesBuildTarget = pkgsBuildTarget.${pythonAttr}; - pythonPackagesHostHost = pkgsHostHost.${pythonAttr}; - pythonPackagesTargetTarget = pkgsTargetTarget.${pythonAttr} or {}; + 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}"; @@ -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; diff --git a/pkgs/development/interpreters/python/default.nix b/pkgs/development/interpreters/python/default.nix index 19a7f44de369..2f350738238e 100644 --- a/pkgs/development/interpreters/python/default.nix +++ b/pkgs/development/interpreters/python/default.nix @@ -14,12 +14,12 @@ with pkgs; , packageOverrides , sitePackages , hasDistutilsCxxPatch - , pythonPackagesBuildBuild - , pythonForBuild # provides pythonPackagesBuildHost - , pythonPackagesBuildTarget - , pythonPackagesHostHost - , self # is pythonPackagesHostTarget - , pythonPackagesTargetTarget + , pythonOnBuildForBuild + , pythonOnBuildForHost + , pythonOnBuildForTarget + , pythonOnHostForHost + , pythonOnTargetForTarget + , self # is pythonOnHostForTarget }: let pythonPackages = callPackage ({ pkgs, stdenv, python, overrides }: let @@ -28,11 +28,11 @@ with pkgs; python = self; }; otherSplices = { - selfBuildBuild = pythonPackagesBuildBuild; - selfBuildHost = pythonForBuild.pkgs; - selfBuildTarget = pythonPackagesBuildTarget; - selfHostHost = pythonPackagesHostHost; - selfTargetTarget = pythonPackagesTargetTarget; + selfBuildBuild = pythonOnBuildForBuild.pkgs; + selfBuildHost = pythonOnBuildForHost.pkgs; + selfBuildTarget = pythonOnBuildForTarget.pkgs; + selfHostHost = pythonOnHostForHost.pkgs; + selfTargetTarget = pythonOnTargetForTarget.pkgs or {}; # There is no Python TargetTarget. }; keep = self: { # TODO maybe only define these here so nothing is needed to be kept in sync. @@ -99,7 +99,10 @@ with pkgs; inherit sourceVersion; pythonAtLeast = lib.versionAtLeast pythonVersion; pythonOlder = lib.versionOlder pythonVersion; - inherit hasDistutilsCxxPatch pythonForBuild; + inherit hasDistutilsCxxPatch; + # TODO: rename to pythonOnBuild + # Not done immediately because its likely used outside Nixpkgs. + pythonForBuild = pythonOnBuildForHost; tests = callPackage ./tests.nix { python = self; @@ -188,7 +191,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; diff --git a/pkgs/development/interpreters/python/pypy/default.nix b/pkgs/development/interpreters/python/pypy/default.nix index 0647ce878642..8feeb3c51bf3 100644 --- a/pkgs/development/interpreters/python/pypy/default.nix +++ b/pkgs/development/interpreters/python/pypy/default.nix @@ -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; @@ -25,12 +31,11 @@ let sitePackages = "site-packages"; hasDistutilsCxxPatch = false; - # No cross-compiling for now. - pythonForBuild = self; - pythonPackagesBuildBuild = {}; - pythonPackagesBuildTarget = {}; - pythonPackagesHostHost = {}; - pythonPackagesTargetTarget = {}; + pythonOnBuildForBuild = pkgsBuildBuild.${pythonAttr}; + pythonOnBuildForHost = pkgsBuildHost.${pythonAttr}; + pythonOnBuildForTarget = pkgsBuildTarget.${pythonAttr}; + pythonOnHostForHost = pkgsHostHost.${pythonAttr}; + pythonOnTargetForTarget = pkgsTargetTarget.${pythonAttr} or {}; }; pname = passthru.executable; version = with sourceVersion; "${major}.${minor}.${patch}"; diff --git a/pkgs/development/interpreters/python/tests/test_nix_pythonprefix/default.nix b/pkgs/development/interpreters/python/tests/test_nix_pythonprefix/default.nix index 05798cbaf1b8..572cbdccbfb2 100644 --- a/pkgs/development/interpreters/python/tests/test_nix_pythonprefix/default.nix +++ b/pkgs/development/interpreters/python/tests/test_nix_pythonprefix/default.nix @@ -4,7 +4,7 @@ let python = let packageOverrides = self: super: { - typeddep = super.callPackage ./typeddep {}; + typeddep = self.callPackage ./typeddep {}; }; in interpreter.override {inherit packageOverrides; self = python;}; |