Merge pull request #105155 from FRidh/splice

Python: rename internal parameters related to splicing and fix splicing
This commit is contained in:
John Ericson 2020-11-28 12:02:20 -05:00 committed by GitHub
commit 2622548c13
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 46 additions and 39 deletions

View File

@ -18,8 +18,8 @@
, ucsEncoding ? 4 , ucsEncoding ? 4
# For the Python package set # For the Python package set
, packageOverrides ? (self: super: {}) , packageOverrides ? (self: super: {})
, buildPackages
, pkgsBuildBuild , pkgsBuildBuild
, pkgsBuildHost
, pkgsBuildTarget , pkgsBuildTarget
, pkgsHostHost , pkgsHostHost
, pkgsTargetTarget , pkgsTargetTarget
@ -28,6 +28,7 @@
, passthruFun , passthruFun
, static ? false , static ? false
, enableOptimizations ? (!stdenv.isDarwin) , enableOptimizations ? (!stdenv.isDarwin)
, pythonAttr ? "python${sourceVersion.major}${sourceVersion.minor}"
}: }:
assert x11Support -> tcl != null assert x11Support -> tcl != null
@ -38,9 +39,8 @@ assert x11Support -> tcl != null
with stdenv.lib; with stdenv.lib;
let let
buildPackages = pkgsBuildHost;
pythonAttr = "python${sourceVersion.major}${sourceVersion.minor}"; inherit (passthru) pythonForBuild;
pythonForBuild = buildPackages.${pythonAttr};
passthru = passthruFun rec { passthru = passthruFun rec {
inherit self sourceVersion packageOverrides; inherit self sourceVersion packageOverrides;
@ -49,11 +49,12 @@ let
executable = libPrefix; executable = libPrefix;
pythonVersion = with sourceVersion; "${major}.${minor}"; pythonVersion = with sourceVersion; "${major}.${minor}";
sitePackages = "lib/${libPrefix}/site-packages"; sitePackages = "lib/${libPrefix}/site-packages";
inherit hasDistutilsCxxPatch pythonForBuild; inherit hasDistutilsCxxPatch;
pythonPackagesBuildBuild = pkgsBuildBuild.${pythonAttr}; pythonOnBuildForBuild = pkgsBuildBuild.${pythonAttr};
pythonPackagesBuildTarget = pkgsBuildTarget.${pythonAttr}; pythonOnBuildForHost = pkgsBuildHost.${pythonAttr};
pythonPackagesHostHost = pkgsHostHost.${pythonAttr}; pythonOnBuildForTarget = pkgsBuildTarget.${pythonAttr};
pythonPackagesTargetTarget = pkgsTargetTarget.${pythonAttr} or {}; pythonOnHostForHost = pkgsHostHost.${pythonAttr};
pythonOnTargetForTarget = pkgsTargetTarget.${pythonAttr} or {};
} // { } // {
inherit ucsEncoding; inherit ucsEncoding;
}; };

View File

@ -19,12 +19,11 @@
, nukeReferences , nukeReferences
# For the Python package set # For the Python package set
, packageOverrides ? (self: super: {}) , packageOverrides ? (self: super: {})
, buildPackages
, pkgsBuildBuild , pkgsBuildBuild
, pkgsBuildHost
, pkgsBuildTarget , pkgsBuildTarget
, pkgsHostHost , pkgsHostHost
, pkgsTargetTarget , pkgsTargetTarget
, pythonForBuild ? buildPackages.${pythonAttr}
, sourceVersion , sourceVersion
, sha256 , sha256
, passthruFun , passthruFun
@ -58,7 +57,8 @@ assert bluezSupport -> bluez != null;
with stdenv.lib; with stdenv.lib;
let let
buildPackages = pkgsBuildHost;
inherit (passthru) pythonForBuild;
passthru = passthruFun rec { passthru = passthruFun rec {
inherit self sourceVersion packageOverrides; inherit self sourceVersion packageOverrides;
@ -67,11 +67,12 @@ let
executable = libPrefix; executable = libPrefix;
pythonVersion = with sourceVersion; "${major}.${minor}"; pythonVersion = with sourceVersion; "${major}.${minor}";
sitePackages = "lib/${libPrefix}/site-packages"; sitePackages = "lib/${libPrefix}/site-packages";
inherit hasDistutilsCxxPatch pythonForBuild; inherit hasDistutilsCxxPatch;
pythonPackagesBuildBuild = pkgsBuildBuild.${pythonAttr}; pythonOnBuildForBuild = pkgsBuildBuild.${pythonAttr};
pythonPackagesBuildTarget = pkgsBuildTarget.${pythonAttr}; pythonOnBuildForHost = pkgsBuildHost.${pythonAttr};
pythonPackagesHostHost = pkgsHostHost.${pythonAttr}; pythonOnBuildForTarget = pkgsBuildTarget.${pythonAttr};
pythonPackagesTargetTarget = pkgsTargetTarget.${pythonAttr} or {}; pythonOnHostForHost = pkgsHostHost.${pythonAttr};
pythonOnTargetForTarget = pkgsTargetTarget.${pythonAttr} or {};
}; };
version = with sourceVersion; "${major}.${minor}.${patch}${suffix}"; version = with sourceVersion; "${major}.${minor}.${patch}${suffix}";
@ -95,8 +96,6 @@ let
hasDistutilsCxxPatch = !(stdenv.cc.isGNU or false); hasDistutilsCxxPatch = !(stdenv.cc.isGNU or false);
inherit pythonForBuild;
pythonForBuildInterpreter = if stdenv.hostPlatform == stdenv.buildPlatform then pythonForBuildInterpreter = if stdenv.hostPlatform == stdenv.buildPlatform then
"$out/bin/python" "$out/bin/python"
else pythonForBuild.interpreter; else pythonForBuild.interpreter;

View File

@ -14,12 +14,12 @@ with pkgs;
, packageOverrides , packageOverrides
, sitePackages , sitePackages
, hasDistutilsCxxPatch , hasDistutilsCxxPatch
, pythonPackagesBuildBuild , pythonOnBuildForBuild
, pythonForBuild # provides pythonPackagesBuildHost , pythonOnBuildForHost
, pythonPackagesBuildTarget , pythonOnBuildForTarget
, pythonPackagesHostHost , pythonOnHostForHost
, self # is pythonPackagesHostTarget , pythonOnTargetForTarget
, pythonPackagesTargetTarget , self # is pythonOnHostForTarget
}: let }: let
pythonPackages = callPackage pythonPackages = callPackage
({ pkgs, stdenv, python, overrides }: let ({ pkgs, stdenv, python, overrides }: let
@ -28,11 +28,11 @@ with pkgs;
python = self; python = self;
}; };
otherSplices = { otherSplices = {
selfBuildBuild = pythonPackagesBuildBuild; selfBuildBuild = pythonOnBuildForBuild.pkgs;
selfBuildHost = pythonForBuild.pkgs; selfBuildHost = pythonOnBuildForHost.pkgs;
selfBuildTarget = pythonPackagesBuildTarget; selfBuildTarget = pythonOnBuildForTarget.pkgs;
selfHostHost = pythonPackagesHostHost; selfHostHost = pythonOnHostForHost.pkgs;
selfTargetTarget = pythonPackagesTargetTarget; selfTargetTarget = pythonOnTargetForTarget.pkgs or {}; # There is no Python TargetTarget.
}; };
keep = self: { keep = self: {
# TODO maybe only define these here so nothing is needed to be kept in sync. # TODO maybe only define these here so nothing is needed to be kept in sync.
@ -99,7 +99,10 @@ with pkgs;
inherit sourceVersion; inherit sourceVersion;
pythonAtLeast = lib.versionAtLeast pythonVersion; pythonAtLeast = lib.versionAtLeast pythonVersion;
pythonOlder = lib.versionOlder 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 { tests = callPackage ./tests.nix {
python = self; python = self;
@ -188,7 +191,6 @@ in {
# Minimal versions of Python (built without optional dependencies) # Minimal versions of Python (built without optional dependencies)
python3Minimal = (python38.override { python3Minimal = (python38.override {
self = python3Minimal; self = python3Minimal;
pythonForBuild = pkgs.buildPackages.python3Minimal;
# strip down that python version as much as possible # strip down that python version as much as possible
openssl = null; openssl = null;
readline = null; readline = null;

View File

@ -5,10 +5,16 @@
, python-setup-hook , python-setup-hook
# For the Python package set # For the Python package set
, packageOverrides ? (self: super: {}) , packageOverrides ? (self: super: {})
, pkgsBuildBuild
, pkgsBuildHost
, pkgsBuildTarget
, pkgsHostHost
, pkgsTargetTarget
, sourceVersion , sourceVersion
, pythonVersion , pythonVersion
, sha256 , sha256
, passthruFun , passthruFun
, pythonAttr ? "pypy${stdenv.lib.substring 0 1 pythonVersion}${stdenv.lib.substring 2 3 pythonVersion}"
}: }:
assert zlibSupport -> zlib != null; assert zlibSupport -> zlib != null;
@ -25,12 +31,11 @@ let
sitePackages = "site-packages"; sitePackages = "site-packages";
hasDistutilsCxxPatch = false; hasDistutilsCxxPatch = false;
# No cross-compiling for now. pythonOnBuildForBuild = pkgsBuildBuild.${pythonAttr};
pythonForBuild = self; pythonOnBuildForHost = pkgsBuildHost.${pythonAttr};
pythonPackagesBuildBuild = {}; pythonOnBuildForTarget = pkgsBuildTarget.${pythonAttr};
pythonPackagesBuildTarget = {}; pythonOnHostForHost = pkgsHostHost.${pythonAttr};
pythonPackagesHostHost = {}; pythonOnTargetForTarget = pkgsTargetTarget.${pythonAttr} or {};
pythonPackagesTargetTarget = {};
}; };
pname = passthru.executable; pname = passthru.executable;
version = with sourceVersion; "${major}.${minor}.${patch}"; version = with sourceVersion; "${major}.${minor}.${patch}";

View File

@ -4,7 +4,7 @@ let
python = let python = let
packageOverrides = self: super: { packageOverrides = self: super: {
typeddep = super.callPackage ./typeddep {}; typeddep = self.callPackage ./typeddep {};
}; };
in interpreter.override {inherit packageOverrides; self = python;}; in interpreter.override {inherit packageOverrides; self = python;};