treewide: change pythonForBuild to pythonOnBuildForHost
This commit is contained in:
@@ -56,11 +56,11 @@ assert lib.assertMsg (reproducibleBuild -> (!rebuildBytecode))
|
||||
|
||||
let
|
||||
buildPackages = pkgsBuildHost;
|
||||
inherit (passthru) pythonForBuild;
|
||||
inherit (passthru) pythonOnBuildForHost;
|
||||
|
||||
pythonForBuildInterpreter = if stdenv.hostPlatform == stdenv.buildPlatform then
|
||||
pythonOnBuildForHostInterpreter = if stdenv.hostPlatform == stdenv.buildPlatform then
|
||||
"$out/bin/python"
|
||||
else pythonForBuild.interpreter;
|
||||
else pythonOnBuildForHost.interpreter;
|
||||
|
||||
passthru = passthruFun rec {
|
||||
inherit self sourceVersion packageOverrides;
|
||||
@@ -297,9 +297,9 @@ in with passthru; stdenv.mkDerivation ({
|
||||
# We build 3 levels of optimized bytecode. Note the default level, without optimizations,
|
||||
# is not reproducible yet. https://bugs.python.org/issue29708
|
||||
# Not creating bytecode will result in a large performance loss however, so we do build it.
|
||||
find $out -name "*.py" | ${pythonForBuildInterpreter} -m compileall -q -f -x "lib2to3" -i -
|
||||
find $out -name "*.py" | ${pythonForBuildInterpreter} -O -m compileall -q -f -x "lib2to3" -i -
|
||||
find $out -name "*.py" | ${pythonForBuildInterpreter} -OO -m compileall -q -f -x "lib2to3" -i -
|
||||
find $out -name "*.py" | ${pythonOnBuildForHostInterpreter} -m compileall -q -f -x "lib2to3" -i -
|
||||
find $out -name "*.py" | ${pythonOnBuildForHostInterpreter} -O -m compileall -q -f -x "lib2to3" -i -
|
||||
find $out -name "*.py" | ${pythonOnBuildForHostInterpreter} -OO -m compileall -q -f -x "lib2to3" -i -
|
||||
'' + lib.optionalString stdenv.hostPlatform.isCygwin ''
|
||||
cp libpython2.7.dll.a $out/lib
|
||||
'';
|
||||
|
||||
@@ -92,7 +92,7 @@ let
|
||||
openssl' = if openssl != null then openssl_legacy else null;
|
||||
|
||||
buildPackages = pkgsBuildHost;
|
||||
inherit (passthru) pythonForBuild;
|
||||
inherit (passthru) pythonOnBuildForHost;
|
||||
|
||||
inherit (darwin.apple_sdk.frameworks) Cocoa;
|
||||
|
||||
@@ -127,7 +127,7 @@ let
|
||||
nukeReferences
|
||||
] ++ optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
|
||||
buildPackages.stdenv.cc
|
||||
pythonForBuild
|
||||
pythonOnBuildForHost
|
||||
] ++ optionals (stdenv.cc.isClang && (!stdenv.hostPlatform.useAndroidPrebuilt or false) && (enableLTO || enableOptimizations)) [
|
||||
stdenv.cc.cc.libllvm.out
|
||||
];
|
||||
@@ -148,9 +148,9 @@ let
|
||||
|
||||
hasDistutilsCxxPatch = !(stdenv.cc.isGNU or false);
|
||||
|
||||
pythonForBuildInterpreter = if stdenv.hostPlatform == stdenv.buildPlatform then
|
||||
pythonOnBuildForHostInterpreter = if stdenv.hostPlatform == stdenv.buildPlatform then
|
||||
"$out/bin/python"
|
||||
else pythonForBuild.interpreter;
|
||||
else pythonOnBuildForHost.interpreter;
|
||||
|
||||
src = fetchurl {
|
||||
url = with sourceVersion; "https://www.python.org/ftp/python/${major}.${minor}.${patch}/Python-${version}.tar.xz";
|
||||
@@ -388,7 +388,7 @@ in with passthru; stdenv.mkDerivation (finalAttrs: {
|
||||
"ac_cv_file__dev_ptmx=${if stdenv.hostPlatform.isWindows then "no" else "yes"}"
|
||||
"ac_cv_file__dev_ptc=${if stdenv.hostPlatform.isWindows then "no" else "yes"}"
|
||||
] ++ optionals (stdenv.hostPlatform != stdenv.buildPlatform && pythonAtLeast "3.11") [
|
||||
"--with-build-python=${pythonForBuildInterpreter}"
|
||||
"--with-build-python=${pythonOnBuildForHostInterpreter}"
|
||||
] ++ optionals stdenv.hostPlatform.isLinux [
|
||||
# Never even try to use lchmod on linux,
|
||||
# don't rely on detecting glibc-isms.
|
||||
@@ -511,9 +511,9 @@ in with passthru; stdenv.mkDerivation (finalAttrs: {
|
||||
# We build 3 levels of optimized bytecode. Note the default level, without optimizations,
|
||||
# is not reproducible yet. https://bugs.python.org/issue29708
|
||||
# Not creating bytecode will result in a large performance loss however, so we do build it.
|
||||
find $out -name "*.py" | ${pythonForBuildInterpreter} -m compileall -q -f -x "lib2to3" -i -
|
||||
find $out -name "*.py" | ${pythonForBuildInterpreter} -O -m compileall -q -f -x "lib2to3" -i -
|
||||
find $out -name "*.py" | ${pythonForBuildInterpreter} -OO -m compileall -q -f -x "lib2to3" -i -
|
||||
find $out -name "*.py" | ${pythonOnBuildForHostInterpreter} -m compileall -q -f -x "lib2to3" -i -
|
||||
find $out -name "*.py" | ${pythonOnBuildForHostInterpreter} -O -m compileall -q -f -x "lib2to3" -i -
|
||||
find $out -name "*.py" | ${pythonOnBuildForHostInterpreter} -OO -m compileall -q -f -x "lib2to3" -i -
|
||||
'' + ''
|
||||
# *strip* shebang from libpython gdb script - it should be dual-syntax and
|
||||
# interpretable by whatever python the gdb in question is using, which may
|
||||
@@ -561,7 +561,7 @@ in with passthru; stdenv.mkDerivation (finalAttrs: {
|
||||
++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
|
||||
# Ensure we don't have references to build-time packages.
|
||||
# These typically end up in shebangs.
|
||||
pythonForBuild buildPackages.bash
|
||||
pythonOnBuildForHost buildPackages.bash
|
||||
];
|
||||
|
||||
separateDebugInfo = true;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
self: dontUse: with self;
|
||||
|
||||
let
|
||||
inherit (python) pythonForBuild;
|
||||
pythonInterpreter = pythonForBuild.interpreter;
|
||||
inherit (python) pythonOnBuildForHost;
|
||||
pythonInterpreter = pythonOnBuildForHost.interpreter;
|
||||
pythonSitePackages = python.sitePackages;
|
||||
pythonCheckInterpreter = python.interpreter;
|
||||
setuppy = ../run_setup.py;
|
||||
@@ -68,10 +68,10 @@ in {
|
||||
# set, but in downstream projects that build packages depending on other
|
||||
# versions of this hook's dependencies.
|
||||
passthru.tests = import ./pypa-build-hook-tests.nix {
|
||||
inherit pythonForBuild runCommand;
|
||||
inherit pythonOnBuildForHost runCommand;
|
||||
};
|
||||
} ./pypa-build-hook.sh) {
|
||||
inherit (pythonForBuild.pkgs) build;
|
||||
inherit (pythonOnBuildForHost.pkgs) build;
|
||||
};
|
||||
|
||||
pipInstallHook = callPackage ({ makePythonHook, pip }:
|
||||
@@ -91,7 +91,7 @@ in {
|
||||
inherit pythonInterpreter pythonSitePackages;
|
||||
};
|
||||
} ./pypa-install-hook.sh) {
|
||||
inherit (pythonForBuild.pkgs) installer;
|
||||
inherit (pythonOnBuildForHost.pkgs) installer;
|
||||
};
|
||||
|
||||
pytestCheckHook = callPackage ({ makePythonHook, pytest }:
|
||||
@@ -227,6 +227,6 @@ in {
|
||||
sphinxHook = callPackage ({ makePythonHook, installShellFiles }:
|
||||
makePythonHook {
|
||||
name = "python${python.pythonVersion}-sphinx-hook";
|
||||
propagatedBuildInputs = [ pythonForBuild.pkgs.sphinx installShellFiles ];
|
||||
propagatedBuildInputs = [ pythonOnBuildForHost.pkgs.sphinx installShellFiles ];
|
||||
} ./sphinx-hook.sh) {};
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{ pythonForBuild, runCommand }: {
|
||||
{ pythonOnBuildForHost, runCommand }: {
|
||||
dont-propagate-conflicting-deps = let
|
||||
# customize a package so that its store paths differs
|
||||
mkConflict = pkg: pkg.overrideAttrs { some_modification = true; };
|
||||
@@ -16,7 +16,7 @@
|
||||
'';
|
||||
in
|
||||
# this build must never triger conflicts
|
||||
pythonForBuild.pkgs.buildPythonPackage {
|
||||
pythonOnBuildForHost.pkgs.buildPythonPackage {
|
||||
pname = "dont-propagate-conflicting-deps";
|
||||
version = "0.0.0";
|
||||
src = projectSource;
|
||||
@@ -24,9 +24,9 @@
|
||||
propagatedBuildInputs = [
|
||||
# At least one dependency of `build` should be included here to
|
||||
# keep the test meaningful
|
||||
(mkConflict pythonForBuild.pkgs.tomli)
|
||||
(mkConflict pythonOnBuildForHost.pkgs.tomli)
|
||||
# setuptools is also needed to build the example project
|
||||
pythonForBuild.pkgs.setuptools
|
||||
pythonOnBuildForHost.pkgs.setuptools
|
||||
];
|
||||
};
|
||||
}
|
||||
|
||||
@@ -223,7 +223,7 @@ let
|
||||
] ++ lib.optionals (format' == "pyproject") [(
|
||||
if isBootstrapPackage then
|
||||
pypaBuildHook.override {
|
||||
inherit (python.pythonForBuild.pkgs.bootstrap) build;
|
||||
inherit (python.pythonOnBuildForHost.pkgs.bootstrap) build;
|
||||
wheel = null;
|
||||
}
|
||||
else
|
||||
@@ -235,7 +235,7 @@ let
|
||||
] ++ lib.optionals (format' != "other") [(
|
||||
if isBootstrapInstallPackage then
|
||||
pypaInstallHook.override {
|
||||
inherit (python.pythonForBuild.pkgs.bootstrap) installer;
|
||||
inherit (python.pythonOnBuildForHost.pkgs.bootstrap) installer;
|
||||
}
|
||||
else
|
||||
pypaInstallHook
|
||||
@@ -279,7 +279,7 @@ let
|
||||
'' + attrs.postFixup or "";
|
||||
|
||||
# Python packages built through cross-compilation are always for the host platform.
|
||||
disallowedReferences = lib.optionals (python.stdenv.hostPlatform != python.stdenv.buildPlatform) [ python.pythonForBuild ];
|
||||
disallowedReferences = lib.optionals (python.stdenv.hostPlatform != python.stdenv.buildPlatform) [ python.pythonOnBuildForHost ];
|
||||
|
||||
outputs = outputs ++ lib.optional withDistOutput "dist";
|
||||
|
||||
|
||||
@@ -224,7 +224,7 @@ let
|
||||
'' + attrs.postFixup or "";
|
||||
|
||||
# Python packages built through cross-compilation are always for the host platform.
|
||||
disallowedReferences = lib.optionals (python.stdenv.hostPlatform != python.stdenv.buildPlatform) [ python.pythonForBuild ];
|
||||
disallowedReferences = lib.optionals (python.stdenv.hostPlatform != python.stdenv.buildPlatform) [ python.pythonOnBuildForHost ];
|
||||
|
||||
outputs = outputs ++ lib.optional withDistOutput "dist";
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ makePythonHook {
|
||||
propagatedBuildInputs = [ makeWrapper ];
|
||||
substitutions.sitePackages = python.sitePackages;
|
||||
substitutions.executable = python.interpreter;
|
||||
substitutions.python = python.pythonForBuild;
|
||||
substitutions.python = python.pythonOnBuildForHost;
|
||||
substitutions.pythonHost = python;
|
||||
substitutions.magicalSedExpression = let
|
||||
# Looks weird? Of course, it's between single quoted shell strings.
|
||||
|
||||
Reference in New Issue
Block a user