Merge pull request #265764 from amjoseph-nixpkgs/pr/pythonForBuild

This commit is contained in:
Artturi 2023-11-08 00:13:25 +02:00 committed by GitHub
commit d24da52844
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
92 changed files with 141 additions and 140 deletions

View File

@ -142,7 +142,7 @@ buildPythonPackage rec {
The `buildPythonPackage` mainly does four things: The `buildPythonPackage` mainly does four things:
* In the [`buildPhase`](#build-phase), it calls `${python.pythonForBuild.interpreter} setup.py bdist_wheel` to * In the [`buildPhase`](#build-phase), it calls `${python.pythonOnBuildForHost.interpreter} setup.py bdist_wheel` to
build a wheel binary zipfile. build a wheel binary zipfile.
* In the [`installPhase`](#ssec-install-phase), it installs the wheel file using `pip install *.whl`. * In the [`installPhase`](#ssec-install-phase), it installs the wheel file using `pip install *.whl`.
* In the [`postFixup`](#var-stdenv-postFixup) phase, the `wrapPythonPrograms` bash function is called to * In the [`postFixup`](#var-stdenv-postFixup) phase, the `wrapPythonPrograms` bash function is called to
@ -1682,7 +1682,7 @@ of such package using the feature is `pkgs/tools/X11/xpra/default.nix`.
As workaround install it as an extra `preInstall` step: As workaround install it as an extra `preInstall` step:
```shell ```shell
${python.pythonForBuild.interpreter} setup.py install_data --install-dir=$out --root=$out ${python.pythonOnBuildForHost.interpreter} setup.py install_data --install-dir=$out --root=$out
sed -i '/ = data\_files/d' setup.py sed -i '/ = data\_files/d' setup.py
``` ```

View File

@ -268,7 +268,7 @@ in
'' ''
mkdir -p $out mkdir -p $out
if [ -d $package/share/man ]; then if [ -d $package/share/man ]; then
find $package/share/man -type f | xargs ${pkgs.python3.pythonForBuild.interpreter} ${patchedGenerator}/create_manpage_completions.py --directory $out >/dev/null find $package/share/man -type f | xargs ${pkgs.python3.pythonOnBuildForHost.interpreter} ${patchedGenerator}/create_manpage_completions.py --directory $out >/dev/null
fi fi
''; '';
in in

View File

@ -148,7 +148,7 @@ stdenv.mkDerivation (finalAttrs: {
export XDG_DATA_HOME=$out/share export XDG_DATA_HOME=$out/share
export XDG_UTILS_INSTALL_MODE="user" export XDG_UTILS_INSTALL_MODE="user"
${python3Packages.python.pythonForBuild.interpreter} setup.py install --root=$out \ ${python3Packages.python.pythonOnBuildForHost.interpreter} setup.py install --root=$out \
--prefix=$out \ --prefix=$out \
--libdir=$out/lib \ --libdir=$out/lib \
--staging-root=$out \ --staging-root=$out \

View File

@ -113,8 +113,8 @@ python.pkgs.pythonPackages.buildPythonPackage rec {
touch cookbook/static/themes/bootstrap.min.css.map touch cookbook/static/themes/bootstrap.min.css.map
touch cookbook/static/css/bootstrap-vue.min.css.map touch cookbook/static/css/bootstrap-vue.min.css.map
${python.pythonForBuild.interpreter} manage.py collectstatic_js_reverse ${python.pythonOnBuildForHost.interpreter} manage.py collectstatic_js_reverse
${python.pythonForBuild.interpreter} manage.py collectstatic ${python.pythonOnBuildForHost.interpreter} manage.py collectstatic
runHook postBuild runHook postBuild
''; '';

View File

@ -30,7 +30,7 @@ stdenv.mkDerivation (finalAttrs: {
]; ];
nativeBuildInputs = [ nativeBuildInputs = [
meson ninja pkg-config desktop-file-utils python3.pythonForBuild.pkgs.sphinx meson ninja pkg-config desktop-file-utils python3.pythonOnBuildForHost.pkgs.sphinx
gettext wrapGAppsHook libxml2 appstream-glib gettext wrapGAppsHook libxml2 appstream-glib
]; ];

View File

@ -62,7 +62,7 @@
buildFun: buildFun:
let let
python3WithPackages = python3.pythonForBuild.withPackages(ps: with ps; [ python3WithPackages = python3.pythonOnBuildForHost.withPackages(ps: with ps; [
ply jinja2 setuptools ply jinja2 setuptools
]); ]);
clangFormatPython3 = fetchurl { clangFormatPython3 = fetchurl {
@ -437,7 +437,7 @@ let
# This is to ensure expansion of $out. # This is to ensure expansion of $out.
libExecPath="${libExecPath}" libExecPath="${libExecPath}"
${python3.pythonForBuild}/bin/python3 build/linux/unbundle/replace_gn_files.py --system-libraries ${toString gnSystemLibraries} ${python3.pythonOnBuildForHost}/bin/python3 build/linux/unbundle/replace_gn_files.py --system-libraries ${toString gnSystemLibraries}
${gnChromium}/bin/gn gen --args=${lib.escapeShellArg gnFlags} out/Release | tee gn-gen-outputs.txt ${gnChromium}/bin/gn gen --args=${lib.escapeShellArg gnFlags} out/Release | tee gn-gen-outputs.txt
# Fail if `gn gen` contains a WARNING. # Fail if `gn gen` contains a WARNING.

View File

@ -34,7 +34,7 @@ buildPythonApplication rec {
cat >test-runner <<EOF cat >test-runner <<EOF
#!/bin/sh #!/bin/sh
${python.pythonForBuild.interpreter} nix_run_setup test ${python.pythonOnBuildForHost.interpreter} nix_run_setup test
EOF EOF
chmod +x test-runner chmod +x test-runner
wrapQtApp test-runner --prefix PYTHONPATH : $PYTHONPATH wrapQtApp test-runner --prefix PYTHONPATH : $PYTHONPATH

View File

@ -18,7 +18,7 @@ python3.pkgs.buildPythonApplication rec {
hash = "sha256-1QNhNPa6ZKn0lGQXs/cmfdSFHscwlYwFC/2DpnMoHvY="; hash = "sha256-1QNhNPa6ZKn0lGQXs/cmfdSFHscwlYwFC/2DpnMoHvY=";
}; };
nativeBuildInputs = with python3.pythonForBuild.pkgs; [ nativeBuildInputs = with python3.pythonOnBuildForHost.pkgs; [
setuptools setuptools
setuptools-scm setuptools-scm
]; ];

View File

@ -26,7 +26,7 @@ python3Packages.buildPythonApplication rec {
outputs = [ "out" "doc" ]; outputs = [ "out" "doc" ];
postBuild = '' postBuild = ''
${python3Packages.python.pythonForBuild.interpreter} setup.py build_sphinx -b html,man ${python3Packages.python.pythonOnBuildForHost.interpreter} setup.py build_sphinx -b html,man
''; '';
postInstall = '' postInstall = ''

View File

@ -24,7 +24,7 @@ python3Packages.buildPythonApplication rec {
buildPhase = '' buildPhase = ''
runHook preBuild runHook preBuild
${python3Packages.python.pythonForBuild.interpreter} -O -m compileall . ${python3Packages.python.pythonOnBuildForHost.interpreter} -O -m compileall .
runHook postBuild runHook postBuild
''; '';

View File

@ -18,7 +18,7 @@ python3Packages.buildPythonApplication rec {
]; ];
buildPhase = '' buildPhase = ''
${python3Packages.python.pythonForBuild.interpreter} -O -m compileall . ${python3Packages.python.pythonOnBuildForHost.interpreter} -O -m compileall .
''; '';
installPhase = '' installPhase = ''

View File

@ -224,13 +224,13 @@ python.pkgs.buildPythonApplication rec {
postBuild = '' postBuild = ''
# Compile manually because `pythonRecompileBytecodeHook` only works # Compile manually because `pythonRecompileBytecodeHook` only works
# for files in `python.sitePackages` # for files in `python.sitePackages`
${python.pythonForBuild.interpreter} -OO -m compileall src ${python.pythonOnBuildForHost.interpreter} -OO -m compileall src
# Collect static files # Collect static files
${python.pythonForBuild.interpreter} src/manage.py collectstatic --clear --no-input ${python.pythonOnBuildForHost.interpreter} src/manage.py collectstatic --clear --no-input
# Compile string translations using gettext # Compile string translations using gettext
${python.pythonForBuild.interpreter} src/manage.py compilemessages ${python.pythonOnBuildForHost.interpreter} src/manage.py compilemessages
''; '';
installPhase = '' installPhase = ''

View File

@ -27,7 +27,7 @@ pythonPackages.buildPythonApplication rec {
--replace "/bin/bash" "${bash}/bin/bash" --replace "/bin/bash" "${bash}/bin/bash"
mkdir -p "$out/${python.sitePackages}" mkdir -p "$out/${python.sitePackages}"
export PYTHONPATH="$out/${python.sitePackages}:$PYTHONPATH" export PYTHONPATH="$out/${python.sitePackages}:$PYTHONPATH"
${python.pythonForBuild.interpreter} setup.py install \ ${python.pythonOnBuildForHost.interpreter} setup.py install \
--install-lib=$out/${python.sitePackages} \ --install-lib=$out/${python.sitePackages} \
--prefix="$out" --prefix="$out"
''; '';

View File

@ -47,7 +47,7 @@ let common = { version, sha256, patches ? [ ], tag ? "z3" }:
configurePhase = concatStringsSep " " configurePhase = concatStringsSep " "
( (
[ "${python.pythonForBuild.interpreter} scripts/mk_make.py --prefix=$out" ] [ "${python.pythonOnBuildForHost.interpreter} scripts/mk_make.py --prefix=$out" ]
++ optional javaBindings "--java" ++ optional javaBindings "--java"
++ optional ocamlBindings "--ml" ++ optional ocamlBindings "--ml"
++ optional pythonBindings "--python --pypkgdir=$out/${python.sitePackages}" ++ optional pythonBindings "--python --pypkgdir=$out/${python.sitePackages}"

View File

@ -128,17 +128,17 @@ buildPythonApplication rec {
runHook preBuild runHook preBuild
${ lib.optionalString (stdenv.isDarwin && stdenv.isx86_64) "export MACOSX_DEPLOYMENT_TARGET=11" } ${ lib.optionalString (stdenv.isDarwin && stdenv.isx86_64) "export MACOSX_DEPLOYMENT_TARGET=11" }
${if stdenv.isDarwin then '' ${if stdenv.isDarwin then ''
${python.pythonForBuild.interpreter} setup.py build ${darwinOptions} ${python.pythonOnBuildForHost.interpreter} setup.py build ${darwinOptions}
make docs make docs
${python.pythonForBuild.interpreter} setup.py kitty.app ${darwinOptions} ${python.pythonOnBuildForHost.interpreter} setup.py kitty.app ${darwinOptions}
'' else '' '' else ''
${python.pythonForBuild.interpreter} setup.py linux-package \ ${python.pythonOnBuildForHost.interpreter} setup.py linux-package \
--egl-library='${lib.getLib libGL}/lib/libEGL.so.1' \ --egl-library='${lib.getLib libGL}/lib/libEGL.so.1' \
--startup-notification-library='${libstartup_notification}/lib/libstartup-notification-1.so' \ --startup-notification-library='${libstartup_notification}/lib/libstartup-notification-1.so' \
--canberra-library='${libcanberra}/lib/libcanberra.so' \ --canberra-library='${libcanberra}/lib/libcanberra.so' \
--fontconfig-library='${fontconfig.lib}/lib/libfontconfig.so' \ --fontconfig-library='${fontconfig.lib}/lib/libfontconfig.so' \
${commonOptions} ${commonOptions}
${python.pythonForBuild.interpreter} setup.py build-launcher ${python.pythonOnBuildForHost.interpreter} setup.py build-launcher
''} ''}
runHook postBuild runHook postBuild
''; '';

View File

@ -56,11 +56,11 @@ assert lib.assertMsg (reproducibleBuild -> (!rebuildBytecode))
let let
buildPackages = pkgsBuildHost; 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" "$out/bin/python"
else pythonForBuild.interpreter; else pythonOnBuildForHost.interpreter;
passthru = passthruFun rec { passthru = passthruFun rec {
inherit self sourceVersion packageOverrides; 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, # We build 3 levels of optimized bytecode. Note the default level, without optimizations,
# is not reproducible yet. https://bugs.python.org/issue29708 # 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. # 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" | ${pythonOnBuildForHostInterpreter} -m compileall -q -f -x "lib2to3" -i -
find $out -name "*.py" | ${pythonForBuildInterpreter} -O -m compileall -q -f -x "lib2to3" -i - find $out -name "*.py" | ${pythonOnBuildForHostInterpreter} -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} -OO -m compileall -q -f -x "lib2to3" -i -
'' + lib.optionalString stdenv.hostPlatform.isCygwin '' '' + lib.optionalString stdenv.hostPlatform.isCygwin ''
cp libpython2.7.dll.a $out/lib cp libpython2.7.dll.a $out/lib
''; '';

View File

@ -92,7 +92,7 @@ let
openssl' = if openssl != null then openssl_legacy else null; openssl' = if openssl != null then openssl_legacy else null;
buildPackages = pkgsBuildHost; buildPackages = pkgsBuildHost;
inherit (passthru) pythonForBuild; inherit (passthru) pythonOnBuildForHost;
inherit (darwin.apple_sdk.frameworks) Cocoa; inherit (darwin.apple_sdk.frameworks) Cocoa;
@ -127,7 +127,7 @@ let
nukeReferences nukeReferences
] ++ optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ ] ++ optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
buildPackages.stdenv.cc buildPackages.stdenv.cc
pythonForBuild pythonOnBuildForHost
] ++ optionals (stdenv.cc.isClang && (!stdenv.hostPlatform.useAndroidPrebuilt or false) && (enableLTO || enableOptimizations)) [ ] ++ optionals (stdenv.cc.isClang && (!stdenv.hostPlatform.useAndroidPrebuilt or false) && (enableLTO || enableOptimizations)) [
stdenv.cc.cc.libllvm.out stdenv.cc.cc.libllvm.out
]; ];
@ -148,9 +148,9 @@ let
hasDistutilsCxxPatch = !(stdenv.cc.isGNU or false); hasDistutilsCxxPatch = !(stdenv.cc.isGNU or false);
pythonForBuildInterpreter = if stdenv.hostPlatform == stdenv.buildPlatform then pythonOnBuildForHostInterpreter = if stdenv.hostPlatform == stdenv.buildPlatform then
"$out/bin/python" "$out/bin/python"
else pythonForBuild.interpreter; else pythonOnBuildForHost.interpreter;
src = fetchurl { src = fetchurl {
url = with sourceVersion; "https://www.python.org/ftp/python/${major}.${minor}.${patch}/Python-${version}.tar.xz"; 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_ptmx=${if stdenv.hostPlatform.isWindows then "no" else "yes"}"
"ac_cv_file__dev_ptc=${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") [ ] ++ optionals (stdenv.hostPlatform != stdenv.buildPlatform && pythonAtLeast "3.11") [
"--with-build-python=${pythonForBuildInterpreter}" "--with-build-python=${pythonOnBuildForHostInterpreter}"
] ++ optionals stdenv.hostPlatform.isLinux [ ] ++ optionals stdenv.hostPlatform.isLinux [
# Never even try to use lchmod on linux, # Never even try to use lchmod on linux,
# don't rely on detecting glibc-isms. # 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, # We build 3 levels of optimized bytecode. Note the default level, without optimizations,
# is not reproducible yet. https://bugs.python.org/issue29708 # 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. # 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" | ${pythonOnBuildForHostInterpreter} -m compileall -q -f -x "lib2to3" -i -
find $out -name "*.py" | ${pythonForBuildInterpreter} -O -m compileall -q -f -x "lib2to3" -i - find $out -name "*.py" | ${pythonOnBuildForHostInterpreter} -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} -OO -m compileall -q -f -x "lib2to3" -i -
'' + '' '' + ''
# *strip* shebang from libpython gdb script - it should be dual-syntax and # *strip* shebang from libpython gdb script - it should be dual-syntax and
# interpretable by whatever python the gdb in question is using, which may # 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) [ ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
# Ensure we don't have references to build-time packages. # Ensure we don't have references to build-time packages.
# These typically end up in shebangs. # These typically end up in shebangs.
pythonForBuild buildPackages.bash pythonOnBuildForHost buildPackages.bash
]; ];
separateDebugInfo = true; separateDebugInfo = true;

View File

@ -1,8 +1,8 @@
self: dontUse: with self; self: dontUse: with self;
let let
inherit (python) pythonForBuild; inherit (python) pythonOnBuildForHost;
pythonInterpreter = pythonForBuild.interpreter; pythonInterpreter = pythonOnBuildForHost.interpreter;
pythonSitePackages = python.sitePackages; pythonSitePackages = python.sitePackages;
pythonCheckInterpreter = python.interpreter; pythonCheckInterpreter = python.interpreter;
setuppy = ../run_setup.py; setuppy = ../run_setup.py;
@ -68,10 +68,10 @@ in {
# set, but in downstream projects that build packages depending on other # set, but in downstream projects that build packages depending on other
# versions of this hook's dependencies. # versions of this hook's dependencies.
passthru.tests = import ./pypa-build-hook-tests.nix { passthru.tests = import ./pypa-build-hook-tests.nix {
inherit pythonForBuild runCommand; inherit pythonOnBuildForHost runCommand;
}; };
} ./pypa-build-hook.sh) { } ./pypa-build-hook.sh) {
inherit (pythonForBuild.pkgs) build; inherit (pythonOnBuildForHost.pkgs) build;
}; };
pipInstallHook = callPackage ({ makePythonHook, pip }: pipInstallHook = callPackage ({ makePythonHook, pip }:
@ -91,7 +91,7 @@ in {
inherit pythonInterpreter pythonSitePackages; inherit pythonInterpreter pythonSitePackages;
}; };
} ./pypa-install-hook.sh) { } ./pypa-install-hook.sh) {
inherit (pythonForBuild.pkgs) installer; inherit (pythonOnBuildForHost.pkgs) installer;
}; };
pytestCheckHook = callPackage ({ makePythonHook, pytest }: pytestCheckHook = callPackage ({ makePythonHook, pytest }:
@ -227,6 +227,6 @@ in {
sphinxHook = callPackage ({ makePythonHook, installShellFiles }: sphinxHook = callPackage ({ makePythonHook, installShellFiles }:
makePythonHook { makePythonHook {
name = "python${python.pythonVersion}-sphinx-hook"; name = "python${python.pythonVersion}-sphinx-hook";
propagatedBuildInputs = [ pythonForBuild.pkgs.sphinx installShellFiles ]; propagatedBuildInputs = [ pythonOnBuildForHost.pkgs.sphinx installShellFiles ];
} ./sphinx-hook.sh) {}; } ./sphinx-hook.sh) {};
} }

View File

@ -1,4 +1,4 @@
{ pythonForBuild, runCommand }: { { pythonOnBuildForHost, runCommand }: {
dont-propagate-conflicting-deps = let dont-propagate-conflicting-deps = let
# customize a package so that its store paths differs # customize a package so that its store paths differs
mkConflict = pkg: pkg.overrideAttrs { some_modification = true; }; mkConflict = pkg: pkg.overrideAttrs { some_modification = true; };
@ -16,7 +16,7 @@
''; '';
in in
# this build must never triger conflicts # this build must never triger conflicts
pythonForBuild.pkgs.buildPythonPackage { pythonOnBuildForHost.pkgs.buildPythonPackage {
pname = "dont-propagate-conflicting-deps"; pname = "dont-propagate-conflicting-deps";
version = "0.0.0"; version = "0.0.0";
src = projectSource; src = projectSource;
@ -24,9 +24,9 @@
propagatedBuildInputs = [ propagatedBuildInputs = [
# At least one dependency of `build` should be included here to # At least one dependency of `build` should be included here to
# keep the test meaningful # keep the test meaningful
(mkConflict pythonForBuild.pkgs.tomli) (mkConflict pythonOnBuildForHost.pkgs.tomli)
# setuptools is also needed to build the example project # setuptools is also needed to build the example project
pythonForBuild.pkgs.setuptools pythonOnBuildForHost.pkgs.setuptools
]; ];
}; };
} }

View File

@ -223,7 +223,7 @@ let
] ++ lib.optionals (format' == "pyproject") [( ] ++ lib.optionals (format' == "pyproject") [(
if isBootstrapPackage then if isBootstrapPackage then
pypaBuildHook.override { pypaBuildHook.override {
inherit (python.pythonForBuild.pkgs.bootstrap) build; inherit (python.pythonOnBuildForHost.pkgs.bootstrap) build;
wheel = null; wheel = null;
} }
else else
@ -235,7 +235,7 @@ let
] ++ lib.optionals (format' != "other") [( ] ++ lib.optionals (format' != "other") [(
if isBootstrapInstallPackage then if isBootstrapInstallPackage then
pypaInstallHook.override { pypaInstallHook.override {
inherit (python.pythonForBuild.pkgs.bootstrap) installer; inherit (python.pythonOnBuildForHost.pkgs.bootstrap) installer;
} }
else else
pypaInstallHook pypaInstallHook
@ -279,7 +279,7 @@ let
'' + attrs.postFixup or ""; '' + attrs.postFixup or "";
# Python packages built through cross-compilation are always for the host platform. # 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"; outputs = outputs ++ lib.optional withDistOutput "dist";

View File

@ -91,9 +91,10 @@ in rec {
pythonAtLeast = lib.versionAtLeast pythonVersion; pythonAtLeast = lib.versionAtLeast pythonVersion;
pythonOlder = lib.versionOlder pythonVersion; pythonOlder = lib.versionOlder pythonVersion;
inherit hasDistutilsCxxPatch; inherit hasDistutilsCxxPatch;
# TODO: deprecate # Remove after 24.11 is released.
# Not done immediately because its likely used outside Nixpkgs. pythonForBuild =
pythonForBuild = pythonOnBuildForHost_overridden; lib.warnIf (lib.isInOldestRelease 2311) "`pythonForBuild` (from `python*`) has been renamed to `pythonOnBuildForHost`"
pythonOnBuildForHost_overridden;
pythonOnBuildForHost = pythonOnBuildForHost_overridden; pythonOnBuildForHost = pythonOnBuildForHost_overridden;
tests = callPackage ./tests.nix { tests = callPackage ./tests.nix {

View File

@ -224,7 +224,7 @@ let
'' + attrs.postFixup or ""; '' + attrs.postFixup or "";
# Python packages built through cross-compilation are always for the host platform. # 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"; outputs = outputs ++ lib.optional withDistOutput "dist";

View File

@ -8,7 +8,7 @@ makePythonHook {
propagatedBuildInputs = [ makeWrapper ]; propagatedBuildInputs = [ makeWrapper ];
substitutions.sitePackages = python.sitePackages; substitutions.sitePackages = python.sitePackages;
substitutions.executable = python.interpreter; substitutions.executable = python.interpreter;
substitutions.python = python.pythonForBuild; substitutions.python = python.pythonOnBuildForHost;
substitutions.pythonHost = python; substitutions.pythonHost = python;
substitutions.magicalSedExpression = let substitutions.magicalSedExpression = let
# Looks weird? Of course, it's between single quoted shell strings. # Looks weird? Of course, it's between single quoted shell strings.

View File

@ -59,14 +59,14 @@ in stdenv.mkDerivation rec {
buildPhase = with python3.pkgs; '' buildPhase = with python3.pkgs; ''
runHook preBuild runHook preBuild
${python.pythonForBuild.interpreter} module/setup.py build --parallel=$NIX_BUILD_CORES ${python.pythonOnBuildForHost.interpreter} module/setup.py build --parallel=$NIX_BUILD_CORES
runHook postBuild runHook postBuild
''; '';
installPhase = with python3.pkgs; '' installPhase = with python3.pkgs; ''
runHook preInstall runHook preInstall
${python.pythonForBuild.interpreter} module/setup.py install_lib -d $out/${python.sitePackages} ${python.pythonOnBuildForHost.interpreter} module/setup.py install_lib -d $out/${python.sitePackages}
mkdir -p $out/share/renpy mkdir -p $out/share/renpy
cp -vr sdk-fonts gui launcher renpy the_question tutorial renpy.py $out/share/renpy cp -vr sdk-fonts gui launcher renpy the_question tutorial renpy.py $out/share/renpy

View File

@ -36,7 +36,7 @@ stdenv.mkDerivation rec {
gtk-doc gtk-doc
docbook-xsl-nons docbook-xsl-nons
docbook_xml_dtd_43 docbook_xml_dtd_43
(python3.pythonForBuild.withPackages (ps: [ ps.pygobject3 ])) (python3.pythonOnBuildForHost.withPackages (ps: [ ps.pygobject3 ]))
] ++ lib.optionals (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) [ ] ++ lib.optionals (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) [
mesonEmulatorHook mesonEmulatorHook
]; ];

View File

@ -50,7 +50,7 @@ stdenv.mkDerivation rec {
pkg-config pkg-config
texinfo texinfo
] ++ lib.optionals pythonSupport [ ] ++ lib.optionals pythonSupport [
python3.pythonForBuild python3.pythonOnBuildForHost
ncurses ncurses
swig2 swig2
which which

View File

@ -17,7 +17,7 @@
}: }:
let let
pythonEnv = python3.pythonForBuild.withPackages (ps: with ps; [ pythonEnv = python3.pythonOnBuildForHost.withPackages (ps: with ps; [
setuptools setuptools
]); ]);
in in

View File

@ -45,7 +45,7 @@ stdenv.mkDerivation rec {
"-DPYTHON_BINDINGS=${onOff pythonSupport}" "-DPYTHON_BINDINGS=${onOff pythonSupport}"
"-DDOCUMENTATION=${onOff docSupport}" "-DDOCUMENTATION=${onOff docSupport}"
] ++ lib.optionals pythonSupport [ ] ++ lib.optionals pythonSupport [
"-DPYTHON_EXECUTABLE=${python3.pythonForBuild.interpreter}" "-DPYTHON_EXECUTABLE=${python3.pythonOnBuildForHost.interpreter}"
"-DPYTHON_LIBRARY=${python3}/lib/libpython${python3.pythonVersion}${stdenv.hostPlatform.extensions.sharedLibrary}" "-DPYTHON_LIBRARY=${python3}/lib/libpython${python3.pythonVersion}${stdenv.hostPlatform.extensions.sharedLibrary}"
]; ];

View File

@ -47,7 +47,7 @@ stdenv.mkDerivation rec {
pkg-config pkg-config
gettext gettext
glib glib
(python3.pythonForBuild.withPackages (ps: [ ps.pygobject3 ])) (python3.pythonOnBuildForHost.withPackages (ps: [ ps.pygobject3 ]))
] ++ lib.optionals withIntrospection [ ] ++ lib.optionals withIntrospection [
gi-docgen gi-docgen
gobject-introspection gobject-introspection

View File

@ -56,7 +56,7 @@ stdenv.mkDerivation rec {
]; ];
nativeInstallCheckInputs = [ nativeInstallCheckInputs = [
# running libical-glib tests # running libical-glib tests
(python3.pythonForBuild.withPackages (pkgs: with pkgs; [ (python3.pythonOnBuildForHost.withPackages (pkgs: with pkgs; [
pygobject3 pygobject3
])) ]))
]; ];

View File

@ -56,7 +56,7 @@ stdenv.mkDerivation rec {
"-DOSX_PACKAGE=off" "-DOSX_PACKAGE=off"
"-DOSX_FRAMEWORK=off" "-DOSX_FRAMEWORK=off"
] ++ lib.optionals pythonSupport [ ] ++ lib.optionals pythonSupport [
"-DPython_EXECUTABLE=${python.pythonForBuild.interpreter}" "-DPython_EXECUTABLE=${python.pythonOnBuildForHost.interpreter}"
"-DPYTHON_BINDINGS=on" "-DPYTHON_BINDINGS=on"
] ++ lib.optionals (!avahiSupport) [ ] ++ lib.optionals (!avahiSupport) [
"-DHAVE_DNS_SD=OFF" "-DHAVE_DNS_SD=OFF"

View File

@ -83,7 +83,7 @@ libxml = stdenv.mkDerivation rec {
(lib.enableFeature enableShared "shared") (lib.enableFeature enableShared "shared")
(lib.withFeature icuSupport "icu") (lib.withFeature icuSupport "icu")
(lib.withFeature pythonSupport "python") (lib.withFeature pythonSupport "python")
(lib.optionalString pythonSupport "PYTHON=${python.pythonForBuild.interpreter}") (lib.optionalString pythonSupport "PYTHON=${python.pythonOnBuildForHost.interpreter}")
]; ];
installFlags = lib.optionals pythonSupport [ installFlags = lib.optionals pythonSupport [

View File

@ -55,7 +55,7 @@ stdenv.mkDerivation rec {
"--without-mem-debug" "--without-mem-debug"
"--without-debugger" "--without-debugger"
(lib.withFeature pythonSupport "python") (lib.withFeature pythonSupport "python")
(lib.optionalString pythonSupport "PYTHON=${python.pythonForBuild.interpreter}") (lib.optionalString pythonSupport "PYTHON=${python.pythonOnBuildForHost.interpreter}")
] ++ lib.optionals (!cryptoSupport) [ ] ++ lib.optionals (!cryptoSupport) [
"--without-crypto" "--without-crypto"
]; ];

View File

@ -18,7 +18,7 @@
}: }:
let let
pythonEnv = python3.pythonForBuild.withPackages (p: with p; [ pyyaml setuptools ]); pythonEnv = python3.pythonOnBuildForHost.withPackages (p: with p; [ pyyaml setuptools ]);
in in
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
pname = "lirc"; pname = "lirc";

View File

@ -46,7 +46,7 @@ stdenv.mkDerivation rec {
gobject-introspection gobject-introspection
] ++ lib.optionals (enableDocs || enableGI) [ ] ++ lib.optionals (enableDocs || enableGI) [
doxygen doxygen
(python3.pythonForBuild.withPackages (ps: with ps; (python3.pythonOnBuildForHost.withPackages (ps: with ps;
lib.optionals enableDocs [ sphinx sphinx-rtd-theme breathe ] lib.optionals enableDocs [ sphinx sphinx-rtd-theme breathe ]
++ lib.optionals enableGI [ lxml ] ++ lib.optionals enableGI [ lxml ]
)) ))

View File

@ -101,7 +101,7 @@ stdenv.mkDerivation rec {
nativeCheckInputs = [ nativeCheckInputs = [
dbus dbus
(python3.pythonForBuild.withPackages (pp: with pp; [ (python3.pythonOnBuildForHost.withPackages (pp: with pp; [
dbus-python dbus-python
(python-dbusmock.overridePythonAttrs (attrs: { (python-dbusmock.overridePythonAttrs (attrs: {
# Avoid dependency cycle. # Avoid dependency cycle.

View File

@ -83,8 +83,8 @@ stdenv.mkDerivation rec {
export OPENMM_LIB_PATH=$out/lib export OPENMM_LIB_PATH=$out/lib
export OPENMM_INCLUDE_PATH=$out/include export OPENMM_INCLUDE_PATH=$out/include
cd python cd python
${python3Packages.python.pythonForBuild.interpreter} setup.py build ${python3Packages.python.pythonOnBuildForHost.interpreter} setup.py build
${python3Packages.python.pythonForBuild.interpreter} setup.py install --prefix=$out ${python3Packages.python.pythonOnBuildForHost.interpreter} setup.py install --prefix=$out
''; '';
postFixup = '' postFixup = ''

View File

@ -63,16 +63,16 @@ stdenv.mkDerivation rec {
"-DFETCH_PYTHON_DEPS=OFF" "-DFETCH_PYTHON_DEPS=OFF"
"-DUSE_GLPK=ON" "-DUSE_GLPK=ON"
"-DUSE_SCIP=OFF" "-DUSE_SCIP=OFF"
"-DPython3_EXECUTABLE=${python.pythonForBuild.interpreter}" "-DPython3_EXECUTABLE=${python.pythonOnBuildForHost.interpreter}"
] ++ lib.optionals stdenv.isDarwin [ "-DCMAKE_MACOSX_RPATH=OFF" ]; ] ++ lib.optionals stdenv.isDarwin [ "-DCMAKE_MACOSX_RPATH=OFF" ];
nativeBuildInputs = [ nativeBuildInputs = [
cmake cmake
ensureNewerSourcesForZipFilesHook ensureNewerSourcesForZipFilesHook
pkg-config pkg-config
python.pythonForBuild python.pythonOnBuildForHost
swig4 swig4
unzip unzip
] ++ (with python.pythonForBuild.pkgs; [ ] ++ (with python.pythonOnBuildForHost.pkgs; [
pip pip
mypy-protobuf mypy-protobuf
]); ]);

View File

@ -68,7 +68,7 @@ stdenv.mkDerivation rec {
wrapGAppsNoGuiHook wrapGAppsNoGuiHook
gi-docgen gi-docgen
graphviz graphviz
(python3.pythonForBuild.withPackages (p: [ p.pygobject3 ])) (python3.pythonOnBuildForHost.withPackages (p: [ p.pygobject3 ]))
] ++ lib.optionals withIntrospection [ ] ++ lib.optionals withIntrospection [
gobject-introspection gobject-introspection
vala vala

View File

@ -22,7 +22,7 @@ buildPythonPackage rec {
]; ];
checkPhase = '' checkPhase = ''
${python.pythonForBuild.interpreter} ${src}/test.py ${python.pythonOnBuildForHost.interpreter} ${src}/test.py
''; '';
pythonImportsCheck = ["asyncinotify"]; pythonImportsCheck = ["asyncinotify"];

View File

@ -46,7 +46,7 @@ buildPythonPackage rec {
''; '';
postInstall = '' postInstall = ''
${python.pythonForBuild.interpreter} -m bash_kernel.install --prefix $out ${python.pythonOnBuildForHost.interpreter} -m bash_kernel.install --prefix $out
''; '';
meta = with lib; { meta = with lib; {

View File

@ -20,7 +20,7 @@ buildPythonPackage rec {
# workaround https://github.com/idank/bashlex/issues/51 # workaround https://github.com/idank/bashlex/issues/51
preBuild = '' preBuild = ''
${python.pythonForBuild.interpreter} -c 'import bashlex' ${python.pythonOnBuildForHost.interpreter} -c 'import bashlex'
''; '';
nativeCheckInputs = [ nativeCheckInputs = [

View File

@ -38,7 +38,7 @@ buildPythonPackage {
runHook preBuild runHook preBuild
# these arguments must set after bdist_wheel # these arguments must set after bdist_wheel
${python.pythonForBuild.interpreter} setup.py bdist_wheel --no-widget --prebuilt-extensions-build-root-dir=${lib.getDev catboost} ${python.pythonOnBuildForHost.interpreter} setup.py bdist_wheel --no-widget --prebuilt-extensions-build-root-dir=${lib.getDev catboost}
runHook postBuild runHook postBuild
''; '';

View File

@ -42,7 +42,7 @@ buildPythonPackage rec {
nativeBuildInputs = [ nativeBuildInputs = [
pari pari
python.pythonForBuild.pkgs.pip python.pythonOnBuildForHost.pkgs.pip
]; ];
buildInputs = [ buildInputs = [

View File

@ -23,7 +23,7 @@ buildPythonPackage rec {
''; '';
configureFlags = [ configureFlags = [
"PYTHON=${python.pythonForBuild.interpreter}" "PYTHON=${python.pythonOnBuildForHost.interpreter}"
]; ];
nativeBuildInputs = [ pkg-config ]; nativeBuildInputs = [ pkg-config ];

View File

@ -48,7 +48,7 @@ buildPythonPackage rec {
mesonFlags = [ mesonFlags = [
"-Dpygi-overrides-dir=${placeholder "out"}/${python.sitePackages}/gi/overrides" "-Dpygi-overrides-dir=${placeholder "out"}/${python.sitePackages}/gi/overrides"
# Exec format error during configure # Exec format error during configure
"-Dpython=${python.pythonForBuild.interpreter}" "-Dpython=${python.pythonOnBuildForHost.interpreter}"
]; ];
doCheck = true; doCheck = true;

View File

@ -37,7 +37,7 @@ buildPythonPackage rec {
''; '';
preBuild = '' preBuild = ''
${python.pythonForBuild.interpreter} setup.py build_cython ${python.pythonOnBuildForHost.interpreter} setup.py build_cython
''; '';
# On Darwin, the test requires macFUSE to be installed outside of Nix. # On Darwin, the test requires macFUSE to be installed outside of Nix.

View File

@ -49,7 +49,7 @@ buildPythonPackage rec {
''; '';
preBuild = '' preBuild = ''
${python.pythonForBuild.interpreter} setup.py build_ext --inplace ${python.pythonOnBuildForHost.interpreter} setup.py build_ext --inplace
''; '';
pythonImportsCheck = [ pythonImportsCheck = [

View File

@ -36,7 +36,7 @@ buildPythonPackage rec {
]; ];
postInstall = '' postInstall = ''
${python.pythonForBuild.interpreter} setup.py build_sphinx --build-dir=$doc ${python.pythonOnBuildForHost.interpreter} setup.py build_sphinx --build-dir=$doc
''; '';
nativeCheckInputs = [ nativeCheckInputs = [

View File

@ -27,17 +27,17 @@ buildPythonPackage rec {
''; '';
preBuild = lib.optionalString (isPy3k) '' preBuild = lib.optionalString (isPy3k) ''
${python.pythonForBuild}/bin/2to3 -wn nose functional_tests unit_tests ${python.pythonOnBuildForHost}/bin/2to3 -wn nose functional_tests unit_tests
''; '';
propagatedBuildInputs = [ coverage ]; propagatedBuildInputs = [ coverage ];
doCheck = false; # lot's of transient errors, too much hassle doCheck = false; # lot's of transient errors, too much hassle
checkPhase = if isPy3k then '' checkPhase = if isPy3k then ''
${python.pythonForBuild.interpreter} setup.py build_tests ${python.pythonOnBuildForHost.interpreter} setup.py build_tests
'' else "" + '' '' else "" + ''
rm functional_tests/test_multiprocessing/test_concurrent_shared.py* # see https://github.com/nose-devs/nose/commit/226bc671c73643887b36b8467b34ad485c2df062 rm functional_tests/test_multiprocessing/test_concurrent_shared.py* # see https://github.com/nose-devs/nose/commit/226bc671c73643887b36b8467b34ad485c2df062
${python.pythonForBuild.interpreter} selftest.py ${python.pythonOnBuildForHost.interpreter} selftest.py
''; '';
meta = with lib; { meta = with lib; {

View File

@ -24,7 +24,7 @@ buildPythonPackage rec {
doCheck = !isPyPy && !stdenv.isDarwin && !isPy311; doCheck = !isPyPy && !stdenv.isDarwin && !isPy311;
checkPhase = '' checkPhase = ''
${python.pythonForBuild.interpreter} selftest.py ${python.pythonOnBuildForHost.interpreter} selftest.py
''; '';
meta = with lib; { meta = with lib; {

View File

@ -18,7 +18,7 @@ buildPythonPackage rec {
]; ];
configureFlags = [ configureFlags = [
"PYTHON=${python.pythonForBuild.interpreter}" "PYTHON=${python.pythonOnBuildForHost.interpreter}"
]; ];
postPatch = '' postPatch = ''

View File

@ -17,7 +17,7 @@
name = "pybind11-setup-hook"; name = "pybind11-setup-hook";
substitutions = { substitutions = {
out = placeholder "out"; out = placeholder "out";
pythonInterpreter = python.pythonForBuild.interpreter; pythonInterpreter = python.pythonOnBuildForHost.interpreter;
pythonIncludeDir = "${python}/include/python${python.pythonVersion}"; pythonIncludeDir = "${python}/include/python${python.pythonVersion}";
pythonSitePackages = "${python}/${python.sitePackages}"; pythonSitePackages = "${python}/${python.sitePackages}";
}; };

View File

@ -46,7 +46,7 @@ buildPythonPackage rec {
# This is only used for figuring out what version of Python is in # This is only used for figuring out what version of Python is in
# use, and related stuff like figuring out what the install prefix # use, and related stuff like figuring out what the install prefix
# should be, but it does need to be able to execute Python code. # should be, but it does need to be able to execute Python code.
"-Dpython=${python.pythonForBuild.interpreter}" "-Dpython=${python.pythonOnBuildForHost.interpreter}"
]; ];
meta = with lib; { meta = with lib; {

View File

@ -32,7 +32,7 @@ buildPythonPackage rec {
}; };
preConfigure = with lib.versions; '' preConfigure = with lib.versions; ''
${python.pythonForBuild.interpreter} configure.py --boost-inc-dir=${boost.dev}/include \ ${python.pythonOnBuildForHost.interpreter} configure.py --boost-inc-dir=${boost.dev}/include \
--boost-lib-dir=${boost}/lib \ --boost-lib-dir=${boost}/lib \
--no-use-shipped-boost \ --no-use-shipped-boost \
--boost-python-libname=boost_python${major python.version}${minor python.version} \ --boost-python-libname=boost_python${major python.version}${minor python.version} \

View File

@ -44,7 +44,7 @@ buildPythonPackage rec {
propagatedBuildInputs = [ trio ]; propagatedBuildInputs = [ trio ];
preBuild = '' preBuild = ''
${python.pythonForBuild.interpreter} setup.py build_cython ${python.pythonOnBuildForHost.interpreter} setup.py build_cython
''; '';
nativeCheckInputs = [ nativeCheckInputs = [

View File

@ -57,7 +57,7 @@ buildPythonPackage rec {
]; ];
preConfigure = '' preConfigure = ''
${python.pythonForBuild.interpreter} buildconfig/config.py ${python.pythonOnBuildForHost.interpreter} buildconfig/config.py
''; '';
checkPhase = '' checkPhase = ''

View File

@ -30,8 +30,8 @@ buildPythonPackage rec {
# for the package to function. Therefore override of buildPhase was # for the package to function. Therefore override of buildPhase was
# necessary. # necessary.
buildPhase = '' buildPhase = ''
${python.pythonForBuild.interpreter} setup.py build_ext --inplace ${python.pythonOnBuildForHost.interpreter} setup.py build_ext --inplace
${python.pythonForBuild.interpreter} setup.py bdist_wheel ${python.pythonOnBuildForHost.interpreter} setup.py bdist_wheel
''; '';
nativeCheckInputs = [ nativeCheckInputs = [

View File

@ -57,7 +57,7 @@ buildPythonPackage rec {
# This is only used for figuring out what version of Python is in # This is only used for figuring out what version of Python is in
# use, and related stuff like figuring out what the install prefix # use, and related stuff like figuring out what the install prefix
# should be, but it does need to be able to execute Python code. # should be, but it does need to be able to execute Python code.
"-Dpython=${python.pythonForBuild.interpreter}" "-Dpython=${python.pythonOnBuildForHost.interpreter}"
]; ];
passthru = { passthru = {

View File

@ -31,7 +31,7 @@ buildPythonPackage rec {
]; ];
preBuild = '' preBuild = ''
${python.pythonForBuild.interpreter} setup.py build_ext --inplace ${python.pythonOnBuildForHost.interpreter} setup.py build_ext --inplace
''; '';
nativeCheckInputs = [ nativeCheckInputs = [

View File

@ -65,7 +65,7 @@ stdenv.mkDerivation rec {
postInstall = '' postInstall = ''
cd ../../.. cd ../../..
${python.pythonForBuild.interpreter} setup.py egg_info --build-type=pyside2 ${python.pythonOnBuildForHost.interpreter} setup.py egg_info --build-type=pyside2
cp -r PySide2.egg-info $out/${python.sitePackages}/ cp -r PySide2.egg-info $out/${python.sitePackages}/
''; '';

View File

@ -83,7 +83,7 @@ stdenv.mkDerivation rec {
postInstall = '' postInstall = ''
cd ../../.. cd ../../..
${python.pythonForBuild.interpreter} setup.py egg_info --build-type=pyside6 ${python.pythonOnBuildForHost.interpreter} setup.py egg_info --build-type=pyside6
cp -r PySide6.egg-info $out/${python.sitePackages}/ cp -r PySide6.egg-info $out/${python.sitePackages}/
''; '';

View File

@ -37,8 +37,8 @@ buildPythonPackage rec {
preConfigure = '' preConfigure = ''
cd Source cd Source
${python.pythonForBuild.interpreter} setup.py backport ${python.pythonOnBuildForHost.interpreter} setup.py backport
${python.pythonForBuild.interpreter} setup.py configure \ ${python.pythonOnBuildForHost.interpreter} setup.py configure \
--apr-inc-dir=${apr.dev}/include \ --apr-inc-dir=${apr.dev}/include \
--apu-inc-dir=${aprutil.dev}/include \ --apu-inc-dir=${aprutil.dev}/include \
--pycxx-dir=${pycxx.dev}/include \ --pycxx-dir=${pycxx.dev}/include \

View File

@ -31,11 +31,11 @@ buildPythonPackage rec {
''; '';
preBuild = '' preBuild = ''
${python.pythonForBuild.interpreter} setup.py build_ext ${python.pythonOnBuildForHost.interpreter} setup.py build_ext
''; '';
installPhase = '' installPhase = ''
${python.pythonForBuild.interpreter} setup.py install --prefix=$out --single-version-externally-managed ${python.pythonOnBuildForHost.interpreter} setup.py install --prefix=$out --single-version-externally-managed
''; '';
doCheck = false; doCheck = false;

View File

@ -17,7 +17,7 @@ in buildPythonPackage rec {
nativeBuildInputs = [ cython ]; nativeBuildInputs = [ cython ];
preBuild = '' preBuild = ''
${python.pythonForBuild.interpreter} setup.py build_ext -i ${python.pythonOnBuildForHost.interpreter} setup.py build_ext -i
''; '';
checkPhase = '' checkPhase = ''

View File

@ -24,7 +24,7 @@ buildPythonPackage rec {
nativeCheckInputs = [ pytestCheckHook ]; nativeCheckInputs = [ pytestCheckHook ];
postBuild = '' postBuild = ''
${python.pythonForBuild.interpreter} pywayland/ffi_build.py ${python.pythonOnBuildForHost.interpreter} pywayland/ffi_build.py
''; '';
# Tests need this to create sockets # Tests need this to create sockets

View File

@ -37,7 +37,7 @@ buildPythonPackage rec {
nativeCheckInputs = [ pytestCheckHook ]; nativeCheckInputs = [ pytestCheckHook ];
postBuild = '' postBuild = ''
${python.pythonForBuild.interpreter} wlroots/ffi_build.py ${python.pythonOnBuildForHost.interpreter} wlroots/ffi_build.py
''; '';
pythonImportsCheck = [ "wlroots" ]; pythonImportsCheck = [ "wlroots" ];

View File

@ -10,7 +10,7 @@ stdenv.mkDerivation {
patchPhase = "cat ${./sitecustomize.py} > sitecustomize.py"; patchPhase = "cat ${./sitecustomize.py} > sitecustomize.py";
buildPhase = "${python.pythonForBuild}/bin/${python.pythonForBuild.executable} -m compileall ."; buildPhase = "${python.pythonOnBuildForHost}/bin/${python.pythonOnBuildForHost.executable} -m compileall .";
installPhase = installPhase =
'' ''

View File

@ -49,7 +49,7 @@ buildPythonPackage rec {
]; ];
preBuild = '' preBuild = ''
${python.pythonForBuild.interpreter} make_sync.py ${python.pythonOnBuildForHost.interpreter} make_sync.py
''; '';
nativeCheckInputs = [ nativeCheckInputs = [

View File

@ -45,7 +45,7 @@ stdenv.mkDerivation {
postInstall = '' postInstall = ''
cd ../../.. cd ../../..
${python.pythonForBuild.interpreter} setup.py egg_info --build-type=shiboken2 ${python.pythonOnBuildForHost.interpreter} setup.py egg_info --build-type=shiboken2
cp -r shiboken2.egg-info $out/${python.sitePackages}/ cp -r shiboken2.egg-info $out/${python.sitePackages}/
rm $out/bin/shiboken_tool.py rm $out/bin/shiboken_tool.py
''; '';

View File

@ -61,7 +61,7 @@ stdenv'.mkDerivation rec {
postInstall = '' postInstall = ''
cd ../../.. cd ../../..
${python.pythonForBuild.interpreter} setup.py egg_info --build-type=shiboken6 ${python.pythonOnBuildForHost.interpreter} setup.py egg_info --build-type=shiboken6
cp -r shiboken6.egg-info $out/${python.sitePackages}/ cp -r shiboken6.egg-info $out/${python.sitePackages}/
''; '';

View File

@ -228,7 +228,7 @@ in buildPythonPackage rec {
preBuild = '' preBuild = ''
export MAX_JOBS=$NIX_BUILD_CORES export MAX_JOBS=$NIX_BUILD_CORES
${python.pythonForBuild.interpreter} setup.py build --cmake-only ${python.pythonOnBuildForHost.interpreter} setup.py build --cmake-only
${cmake}/bin/cmake build ${cmake}/bin/cmake build
''; '';

View File

@ -102,7 +102,7 @@ buildPythonPackage rec {
export PATH="${wxGTK}/bin:$PATH" export PATH="${wxGTK}/bin:$PATH"
export SDL_CONFIG="${SDL.dev}/bin/sdl-config" export SDL_CONFIG="${SDL.dev}/bin/sdl-config"
${python.pythonForBuild.interpreter} build.py -v --use_syswx dox etg sip --nodoc build_py ${python.pythonOnBuildForHost.interpreter} build.py -v --use_syswx dox etg sip --nodoc build_py
runHook postBuild runHook postBuild
''; '';
@ -111,7 +111,7 @@ buildPythonPackage rec {
installPhase = '' installPhase = ''
runHook preInstall runHook preInstall
${python.pythonForBuild.interpreter} setup.py install --skip-build --prefix=$out ${python.pythonOnBuildForHost.interpreter} setup.py install --skip-build --prefix=$out
wrapPythonPrograms wrapPythonPrograms
runHook postInstall runHook postInstall

View File

@ -26,7 +26,7 @@ buildPythonPackage rec {
doCheck = false; doCheck = false;
postBuild = '' postBuild = ''
${python.pythonForBuild.interpreter} -m compileall -f xattr ${python.pythonOnBuildForHost.interpreter} -m compileall -f xattr
''; '';
pythonImportsCheck = [ pythonImportsCheck = [

View File

@ -24,7 +24,7 @@ buildPythonPackage rec {
nativeCheckInputs = [ pytestCheckHook ]; nativeCheckInputs = [ pytestCheckHook ];
postBuild = '' postBuild = ''
${python.pythonForBuild.interpreter} xkbcommon/ffi_build.py ${python.pythonOnBuildForHost.interpreter} xkbcommon/ffi_build.py
''; '';
pythonImportsCheck = [ "xkbcommon" ]; pythonImportsCheck = [ "xkbcommon" ];

View File

@ -45,17 +45,17 @@ stdenv.mkDerivation rec {
echo "Building setuptools wheel..." echo "Building setuptools wheel..."
pushd setuptools pushd setuptools
${python.pythonForBuild.interpreter} -m pip install --no-build-isolation --no-index --prefix=$out --ignore-installed --no-dependencies --no-cache . ${python.pythonOnBuildForHost.interpreter} -m pip install --no-build-isolation --no-index --prefix=$out --ignore-installed --no-dependencies --no-cache .
popd popd
echo "Building wheel wheel..." echo "Building wheel wheel..."
pushd wheel pushd wheel
${python.pythonForBuild.interpreter} -m pip install --no-build-isolation --no-index --prefix=$out --ignore-installed --no-dependencies --no-cache . ${python.pythonOnBuildForHost.interpreter} -m pip install --no-build-isolation --no-index --prefix=$out --ignore-installed --no-dependencies --no-cache .
popd popd
echo "Building pip wheel..." echo "Building pip wheel..."
pushd pip pushd pip
${python.pythonForBuild.interpreter} -m pip install --no-build-isolation --no-index --prefix=$out --ignore-installed --no-dependencies --no-cache . ${python.pythonOnBuildForHost.interpreter} -m pip install --no-build-isolation --no-index --prefix=$out --ignore-installed --no-dependencies --no-cache .
popd popd
''; '';

View File

@ -42,7 +42,7 @@ buildPythonPackage rec {
# This is only used for figuring out what version of Python is in # This is only used for figuring out what version of Python is in
# use, and related stuff like figuring out what the install prefix # use, and related stuff like figuring out what the install prefix
# should be, but it does need to be able to execute Python code. # should be, but it does need to be able to execute Python code.
"-Dpython=${python.pythonForBuild.interpreter}" "-Dpython=${python.pythonOnBuildForHost.interpreter}"
]; ];
meta = with lib; { meta = with lib; {

View File

@ -29,8 +29,8 @@ let
]; ];
buildPhase = '' buildPhase = ''
${python.pythonForBuild.interpreter} bootstrap.py ${python.pythonOnBuildForHost.interpreter} bootstrap.py
${python.pythonForBuild.interpreter} setup.py sdist --formats=gztar ${python.pythonOnBuildForHost.interpreter} setup.py sdist --formats=gztar
# Here we untar the sdist and retar it in order to control the timestamps # Here we untar the sdist and retar it in order to control the timestamps
# of all the files included # of all the files included

View File

@ -47,7 +47,7 @@ buildPythonApplication rec {
''; '';
preConfigure = '' preConfigure = ''
${python3.pythonForBuild.interpreter} setup.py compile_catalog ${python3.pythonOnBuildForHost.interpreter} setup.py compile_catalog
''; '';
postInstall = '' postInstall = ''

View File

@ -29,7 +29,7 @@ stdenv.mkDerivation {
buildPhase = '' buildPhase = ''
export EXTRA_CMAKE_ARGS="-DPATH_TO_LLVM_ROOT=${llvmPackages.libllvm} -DUSE_SYSTEM_ABSEIL=true" export EXTRA_CMAKE_ARGS="-DPATH_TO_LLVM_ROOT=${llvmPackages.libllvm} -DUSE_SYSTEM_ABSEIL=true"
${python.pythonForBuild.interpreter} build.py --system-libclang --clang-completer --ninja ${python.pythonOnBuildForHost.interpreter} build.py --system-libclang --clang-completer --ninja
''; '';
dontConfigure = true; dontConfigure = true;

View File

@ -76,7 +76,7 @@ stdenv.mkDerivation rec {
dbus dbus
gobject-introspection gobject-introspection
umockdev umockdev
(python3.pythonForBuild.withPackages (python3.pythonOnBuildForHost.withPackages
(p: [ p.pygobject3 p.dbus-python p.python-dbusmock ])) (p: [ p.pygobject3 p.dbus-python p.python-dbusmock ]))
]; ];

View File

@ -21,7 +21,7 @@ stdenv.mkDerivation rec {
postBuild = lib.optionalString (pythonSupport) '' postBuild = lib.optionalString (pythonSupport) ''
cd python cd python
${python.pythonForBuild.interpreter} setup.py install --prefix=../pythonlib ${python.pythonOnBuildForHost.interpreter} setup.py install --prefix=../pythonlib
cd - cd -
''; '';

View File

@ -46,7 +46,7 @@ stdenv.mkDerivation (finalAttrs: {
ninja ninja
perl # for kernel-doc perl # for kernel-doc
pkg-config pkg-config
python3.pythonForBuild python3.pythonOnBuildForHost
swig swig
]; ];

View File

@ -64,7 +64,7 @@ stdenv.mkDerivation rec {
] ++ optionals stdenv.hostPlatform.isStatic [ ] ++ optionals stdenv.hostPlatform.isStatic [
"DISABLE_SHARED=y" "DISABLE_SHARED=y"
] ++ optionals enablePython [ ] ++ optionals enablePython [
"PYTHON=${python3.pythonForBuild.interpreter}" "PYTHON=${python3.pythonOnBuildForHost.interpreter}"
"PYTHONLIBDIR=$(py)/${python3.sitePackages}" "PYTHONLIBDIR=$(py)/${python3.sitePackages}"
]; ];

View File

@ -53,7 +53,7 @@ stdenv.mkDerivation rec {
wrapGAppsNoGuiHook wrapGAppsNoGuiHook
python3.pkgs.wrapPython python3.pkgs.wrapPython
# checkInput but cheked for during the configuring # checkInput but cheked for during the configuring
(python3.pythonForBuild.withPackages (ps: with ps; [ (python3.pythonOnBuildForHost.withPackages (ps: with ps; [
pygobject3 pygobject3
dbus-python dbus-python
python-dbusmock python-dbusmock

View File

@ -50,7 +50,7 @@ buildPythonPackage rec {
postInstall = '' postInstall = ''
pushd intents pushd intents
# https://github.com/home-assistant/intents/blob/main/script/package#L18 # https://github.com/home-assistant/intents/blob/main/script/package#L18
${python.pythonForBuild.interpreter} -m script.intentfest merged_output $out/${python.sitePackages}/home_assistant_intents/data ${python.pythonOnBuildForHost.interpreter} -m script.intentfest merged_output $out/${python.sitePackages}/home_assistant_intents/data
popd popd
''; '';

View File

@ -24,13 +24,13 @@ let
}; };
pythonPlugin = pkg : lib.nameValuePair "python${if pkg.isPy2 then "2" else "3"}" { pythonPlugin = pkg : lib.nameValuePair "python${if pkg.isPy2 then "2" else "3"}" {
interpreter = pkg.pythonForBuild.interpreter; interpreter = pkg.pythonOnBuildForHost.interpreter;
path = "plugins/python"; path = "plugins/python";
inputs = [ pkg ncurses ]; inputs = [ pkg ncurses ];
install = '' install = ''
install -Dm644 uwsgidecorators.py $out/${pkg.sitePackages}/uwsgidecorators.py install -Dm644 uwsgidecorators.py $out/${pkg.sitePackages}/uwsgidecorators.py
${pkg.pythonForBuild.executable} -m compileall $out/${pkg.sitePackages}/ ${pkg.pythonOnBuildForHost.executable} -m compileall $out/${pkg.sitePackages}/
${pkg.pythonForBuild.executable} -O -m compileall $out/${pkg.sitePackages}/ ${pkg.pythonOnBuildForHost.executable} -O -m compileall $out/${pkg.sitePackages}/
''; '';
}; };

View File

@ -103,7 +103,7 @@ python.pkgs.buildPythonApplication rec {
# cython modules are not installed for some reasons # cython modules are not installed for some reasons
( (
cd TTS/tts/utils/monotonic_align cd TTS/tts/utils/monotonic_align
${python.pythonForBuild.interpreter} setup.py install --prefix=$out ${python.pythonOnBuildForHost.interpreter} setup.py install --prefix=$out
) )
''; '';

View File

@ -18,7 +18,7 @@ python3Packages.buildPythonApplication rec {
]; ];
preBuild = '' preBuild = ''
${python3Packages.python.pythonForBuild.interpreter} ./setup.py build_cython build_ext --inplace ${python3Packages.python.pythonOnBuildForHost.interpreter} ./setup.py build_cython build_ext --inplace
''; '';
checkPhase = '' checkPhase = ''

View File

@ -53,7 +53,7 @@
}: }:
let let
pythonForDocs = python3.pythonForBuild.withPackages (pkgs: with pkgs; [ pygobject3 ]); pythonForDocs = python3.pythonOnBuildForHost.withPackages (pkgs: with pkgs; [ pygobject3 ]);
in in
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
pname = "networkmanager"; pname = "networkmanager";

View File

@ -43,7 +43,7 @@ python3.pkgs.buildPythonApplication rec {
substituteInPlace setup.py --replace /usr/share/doc/ share/doc/ substituteInPlace setup.py --replace /usr/share/doc/ share/doc/
# see https://github.com/NixOS/nixpkgs/issues/4968 # see https://github.com/NixOS/nixpkgs/issues/4968
${python3.pythonForBuild.interpreter} setup.py install_data --install-dir=$out --root=$out ${python3.pythonOnBuildForHost.interpreter} setup.py install_data --install-dir=$out --root=$out
''; '';
postInstall = postInstall =

View File

@ -21,7 +21,7 @@ buildPythonApplication {
make libconstants.gen.c libsyscalls.gen.c make libconstants.gen.c libsyscalls.gen.c
${targetClang}/bin/${targetClang.targetPrefix}cc -S -emit-llvm \ ${targetClang}/bin/${targetClang.targetPrefix}cc -S -emit-llvm \
libconstants.gen.c libsyscalls.gen.c libconstants.gen.c libsyscalls.gen.c
${python.pythonForBuild.interpreter} tools/generate_constants_json.py \ ${python.pythonOnBuildForHost.interpreter} tools/generate_constants_json.py \
--output constants.json \ --output constants.json \
libconstants.gen.ll libsyscalls.gen.ll libconstants.gen.ll libsyscalls.gen.ll
''; '';