From 58bfe741230877e32be930a581bd2f89980b40d5 Mon Sep 17 00:00:00 2001 From: Yueh-Shun Li Date: Sat, 10 Aug 2024 20:12:00 +0800 Subject: [PATCH] buildPython*: Deprecate and remove (buildPython* { ... }).override Deprecate (buildPythonPackage { ... }).override for Python packages in favour of overridePythonAttrs. This change does not affect the override interface of most Python packages, as the override interface is provided by callPackage and shadows the locally defined override attribute. --- nixos/doc/manual/release-notes/rl-2411.section.md | 3 +++ .../interpreters/python/python-packages-base.nix | 8 ++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/nixos/doc/manual/release-notes/rl-2411.section.md b/nixos/doc/manual/release-notes/rl-2411.section.md index f9a5846c1f38..88065629e629 100644 --- a/nixos/doc/manual/release-notes/rl-2411.section.md +++ b/nixos/doc/manual/release-notes/rl-2411.section.md @@ -161,6 +161,9 @@ - The nvidia driver no longer defaults to the proprietary driver starting with version 560. You will need to manually set `hardware.nvidia.open` to select the proprietary or open driver. +- The `(buildPythonPackage { ... }).override` attribute is now deprecated and removed in favour of `overridePythonAttrs`. + This change does not affect the override interface of most Python packages, as [`.override`](https://nixos.org/manual/nixpkgs/unstable/#sec-pkg-override) provided by `callPackage` shadows such a locally-defined `override` attribute. + - All Cinnamon and XApp packages have been moved to top-level (i.e., `cinnamon.nemo` is now `nemo`). - All GNOME packages have been moved to top-level (i.e., `gnome.nautilus` is now `nautilus`). diff --git a/pkgs/development/interpreters/python/python-packages-base.nix b/pkgs/development/interpreters/python/python-packages-base.nix index 9fad8e56d5d4..1b10b44fb243 100644 --- a/pkgs/development/interpreters/python/python-packages-base.nix +++ b/pkgs/development/interpreters/python/python-packages-base.nix @@ -37,15 +37,15 @@ let else ./python2/mk-python-derivation.nix; - buildPythonPackage = makeOverridablePythonPackage (lib.makeOverridable (callPackage mkPythonDerivation { + buildPythonPackage = makeOverridablePythonPackage (callPackage mkPythonDerivation { inherit namePrefix; # We want Python libraries to be named like e.g. "python3.6-${name}" inherit toPythonModule; # Libraries provide modules - })); + }); - buildPythonApplication = makeOverridablePythonPackage (lib.makeOverridable (callPackage mkPythonDerivation { + buildPythonApplication = makeOverridablePythonPackage (callPackage mkPythonDerivation { namePrefix = ""; # Python applications should not have any prefix toPythonModule = x: x; # Application does not provide modules. - })); + }); # Check whether a derivation provides a Python module. hasPythonModule = drv: drv?pythonModule && drv.pythonModule == python;