Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python: rename internal parameters related to splicing and fix splicing #105155

Merged
merged 5 commits into from
Nov 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 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;
FRidh marked this conversation as resolved.
Show resolved Hide resolved
inherit (passthru) pythonForBuild;

passthru = passthruFun rec {
inherit self sourceVersion packageOverrides;
Expand All @@ -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;
};
Expand Down
19 changes: 9 additions & 10 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,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}";
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
28 changes: 15 additions & 13 deletions pkgs/development/interpreters/python/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
Expand Down Expand Up @@ -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;
FRidh marked this conversation as resolved.
Show resolved Hide resolved

tests = callPackage ./tests.nix {
python = self;
Expand Down Expand Up @@ -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;
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 = {};
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}";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;};

Expand Down