Python: overridePythonPackage -> overridePythonAttrs

to better fit the existing naming scheme.

https://github.com/NixOS/nixpkgs/pull/26155#issuecomment-321279629
This commit is contained in:
Frederik Rietdijk 2017-08-12 08:58:06 +02:00
parent 026b60e49e
commit abdb58e407
2 changed files with 7 additions and 7 deletions

View File

@ -547,7 +547,7 @@ All parameters from `mkDerivation` function are still supported.
##### Overriding Python packages ##### Overriding Python packages
The `buildPythonPackage` function has a `overridePythonPackage` method that The `buildPythonPackage` function has a `overridePythonAttrs` method that
can be used to override the package. In the following example we create an can be used to override the package. In the following example we create an
environment where we have the `blaze` package using an older version of `pandas`. environment where we have the `blaze` package using an older version of `pandas`.
We override first the Python interpreter and pass We override first the Python interpreter and pass
@ -559,7 +559,7 @@ with import <nixpkgs> {};
(let (let
python = let python = let
packageOverrides = self: super: { packageOverrides = self: super: {
pandas = super.pandas.overridePythonPackage(old: rec { pandas = super.pandas.overridePythonAttrs(old: rec {
version = "0.19.1"; version = "0.19.1";
name = "pandas-${version}"; name = "pandas-${version}";
src = super.fetchPypi { src = super.fetchPypi {
@ -786,7 +786,7 @@ with import <nixpkgs> {};
(let (let
python = let python = let
packageOverrides = self: super: { packageOverrides = self: super: {
pandas = super.pandas.overridePythonPackage(old: {name="foo";}); pandas = super.pandas.overridePythonAttrs(old: {name="foo";});
}; };
in pkgs.python35.override {inherit packageOverrides;}; in pkgs.python35.override {inherit packageOverrides;};

View File

@ -37,17 +37,17 @@ let
}); });
# Derivations built with `buildPythonPackage` can already be overriden with `override`, `overrideAttrs`, and `overrideDerivation`. # Derivations built with `buildPythonPackage` can already be overriden with `override`, `overrideAttrs`, and `overrideDerivation`.
# This function introduces `overridePythonPackage` and it overrides the call to `buildPythonPackage`. # This function introduces `overridePythonAttrs` and it overrides the call to `buildPythonPackage`.
makeOverridablePythonPackage = f: origArgs: makeOverridablePythonPackage = f: origArgs:
let let
ff = f origArgs; ff = f origArgs;
overrideWith = newArgs: origArgs // (if builtins.isFunction newArgs then newArgs origArgs else newArgs); overrideWith = newArgs: origArgs // (if builtins.isFunction newArgs then newArgs origArgs else newArgs);
in in
if builtins.isAttrs ff then (ff // { if builtins.isAttrs ff then (ff // {
overridePythonPackage = newArgs: makeOverridable f (overrideWith newArgs); overridePythonAttrs = newArgs: makeOverridable f (overrideWith newArgs);
}) })
else if builtins.isFunction ff then { else if builtins.isFunction ff then {
overridePythonPackage = newArgs: makeOverridable f (overrideWith newArgs); overridePythonAttrs = newArgs: makeOverridable f (overrideWith newArgs);
__functor = self: ff; __functor = self: ff;
} }
else ff; else ff;
@ -22204,7 +22204,7 @@ in {
sphinx = callPackage ../development/python-modules/sphinx { }; sphinx = callPackage ../development/python-modules/sphinx { };
sphinx_1_2 = self.sphinx.overridePythonPackage rec { sphinx_1_2 = self.sphinx.overridePythonAttrs rec {
name = "sphinx-1.2.3"; name = "sphinx-1.2.3";
src = pkgs.fetchurl { src = pkgs.fetchurl {
url = "mirror://pypi/s/sphinx/sphinx-1.2.3.tar.gz"; url = "mirror://pypi/s/sphinx/sphinx-1.2.3.tar.gz";