about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/interpreters/python
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/interpreters/python')
-rw-r--r--nixpkgs/pkgs/development/interpreters/python/cpython/2.7/default.nix12
-rw-r--r--nixpkgs/pkgs/development/interpreters/python/cpython/default.nix20
-rw-r--r--nixpkgs/pkgs/development/interpreters/python/hooks/default.nix12
-rw-r--r--nixpkgs/pkgs/development/interpreters/python/hooks/pypa-build-hook-test.nix8
-rw-r--r--nixpkgs/pkgs/development/interpreters/python/mk-python-derivation.nix6
-rw-r--r--nixpkgs/pkgs/development/interpreters/python/passthrufun.nix10
-rw-r--r--nixpkgs/pkgs/development/interpreters/python/python-packages-base.nix4
-rw-r--r--nixpkgs/pkgs/development/interpreters/python/python2/mk-python-derivation.nix2
-rw-r--r--nixpkgs/pkgs/development/interpreters/python/wrap-python.nix2
9 files changed, 40 insertions, 36 deletions
diff --git a/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/default.nix b/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/default.nix
index 9cd806c05233..b336caf6a0ad 100644
--- a/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/default.nix
+++ b/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/default.nix
@@ -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
       '';
diff --git a/nixpkgs/pkgs/development/interpreters/python/cpython/default.nix b/nixpkgs/pkgs/development/interpreters/python/cpython/default.nix
index eac1ba98beed..8bc5c6c586d8 100644
--- a/nixpkgs/pkgs/development/interpreters/python/cpython/default.nix
+++ b/nixpkgs/pkgs/development/interpreters/python/cpython/default.nix
@@ -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;
@@ -581,7 +581,7 @@ in with passthru; stdenv.mkDerivation (finalAttrs: {
         mv $out/share/doc/* $out/share/doc/python${pythonVersion}-${version}
       '';
 
-      nativeBuildInputs = with pkgsBuildBuild.python3.pkgs; [ sphinxHook python_docs_theme ];
+      nativeBuildInputs = with pkgsBuildBuild.python3.pkgs; [ sphinxHook python-docs-theme ];
     };
 
     tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;
diff --git a/nixpkgs/pkgs/development/interpreters/python/hooks/default.nix b/nixpkgs/pkgs/development/interpreters/python/hooks/default.nix
index ba51c43822d4..5aee357dd91b 100644
--- a/nixpkgs/pkgs/development/interpreters/python/hooks/default.nix
+++ b/nixpkgs/pkgs/development/interpreters/python/hooks/default.nix
@@ -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) {};
 }
diff --git a/nixpkgs/pkgs/development/interpreters/python/hooks/pypa-build-hook-test.nix b/nixpkgs/pkgs/development/interpreters/python/hooks/pypa-build-hook-test.nix
index d909e34241f1..4153c21ca4f9 100644
--- a/nixpkgs/pkgs/development/interpreters/python/hooks/pypa-build-hook-test.nix
+++ b/nixpkgs/pkgs/development/interpreters/python/hooks/pypa-build-hook-test.nix
@@ -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
       ];
     };
 }
diff --git a/nixpkgs/pkgs/development/interpreters/python/mk-python-derivation.nix b/nixpkgs/pkgs/development/interpreters/python/mk-python-derivation.nix
index fbacf6bb2337..060b840ce227 100644
--- a/nixpkgs/pkgs/development/interpreters/python/mk-python-derivation.nix
+++ b/nixpkgs/pkgs/development/interpreters/python/mk-python-derivation.nix
@@ -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";
 
diff --git a/nixpkgs/pkgs/development/interpreters/python/passthrufun.nix b/nixpkgs/pkgs/development/interpreters/python/passthrufun.nix
index 7a38308800a0..23255c8e3d43 100644
--- a/nixpkgs/pkgs/development/interpreters/python/passthrufun.nix
+++ b/nixpkgs/pkgs/development/interpreters/python/passthrufun.nix
@@ -67,6 +67,8 @@
       overrides = packageOverrides;
       python = self;
     });
+  pythonOnBuildForHost_overridden =
+    pythonOnBuildForHost.override { inherit packageOverrides; self = pythonOnBuildForHost_overridden; };
 in rec {
     isPy27 = pythonVersion == "2.7";
     isPy37 = pythonVersion == "3.7";
@@ -89,9 +91,11 @@ in rec {
     pythonAtLeast = lib.versionAtLeast pythonVersion;
     pythonOlder = lib.versionOlder pythonVersion;
     inherit hasDistutilsCxxPatch;
-    # TODO: rename to pythonOnBuild
-    # Not done immediately because its likely used outside Nixpkgs.
-    pythonForBuild = pythonOnBuildForHost.override { inherit packageOverrides; self = pythonForBuild; };
+    # Remove after 24.11 is released.
+    pythonForBuild =
+      lib.warnIf (lib.isInOldestRelease 2311) "`pythonForBuild` (from `python*`) has been renamed to `pythonOnBuildForHost`"
+        pythonOnBuildForHost_overridden;
+    pythonOnBuildForHost = pythonOnBuildForHost_overridden;
 
     tests = callPackage ./tests.nix {
       python = self;
diff --git a/nixpkgs/pkgs/development/interpreters/python/python-packages-base.nix b/nixpkgs/pkgs/development/interpreters/python/python-packages-base.nix
index 91ca84b34b83..b5afaf34ce61 100644
--- a/nixpkgs/pkgs/development/interpreters/python/python-packages-base.nix
+++ b/nixpkgs/pkgs/development/interpreters/python/python-packages-base.nix
@@ -13,7 +13,7 @@ let
 
   # Derivations built with `buildPythonPackage` can already be overridden with `override`, `overrideAttrs`, and `overrideDerivation`.
   # This function introduces `overridePythonAttrs` and it overrides the call to `buildPythonPackage`.
-  makeOverridablePythonPackage = f: origArgs:
+  makeOverridablePythonPackage = f: lib.mirrorFunctionArgs f (origArgs:
     let
       args = lib.fix (lib.extends
         (_: previousAttrs: {
@@ -30,7 +30,7 @@ let
         overridePythonAttrs = newArgs: makeOverridablePythonPackage f (overrideWith newArgs);
         __functor = self: result;
       }
-      else result;
+      else result);
 
   mkPythonDerivation = if python.isPy3k then
     ./mk-python-derivation.nix
diff --git a/nixpkgs/pkgs/development/interpreters/python/python2/mk-python-derivation.nix b/nixpkgs/pkgs/development/interpreters/python/python2/mk-python-derivation.nix
index d42e4e85c102..1a6f9c784cf6 100644
--- a/nixpkgs/pkgs/development/interpreters/python/python2/mk-python-derivation.nix
+++ b/nixpkgs/pkgs/development/interpreters/python/python2/mk-python-derivation.nix
@@ -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";
 
diff --git a/nixpkgs/pkgs/development/interpreters/python/wrap-python.nix b/nixpkgs/pkgs/development/interpreters/python/wrap-python.nix
index c67a8e088514..8817d091a283 100644
--- a/nixpkgs/pkgs/development/interpreters/python/wrap-python.nix
+++ b/nixpkgs/pkgs/development/interpreters/python/wrap-python.nix
@@ -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.