Skip to content

Commit

Permalink
pythonPackages.toPythonModule: also support overridePythonAttrs.
Browse files Browse the repository at this point in the history
The `overridePythonAttrs` method is for overriding `buildPython*`
builders. Packages that use `toPythonModule` directly are typically
bindings build not using `buildPython*`.

This commit allows also those packages to be overridden with
`overridePythonAttrs`, insteading actually invoking `overrideAttrs`.

The motivation for this is to offer a common user interface for users of
the Python packages set. This way they only need to know about
`overridePythonAttrs` when overriding the builder, and `override` when
overriding the `callPackage` call.

Related RFC NixOS/rfcs#67.
  • Loading branch information
FRidh committed Aug 17, 2020
1 parent 1b9acad commit 55dbdef
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pkgs/top-level/python-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ let
}
else ff;

buildPythonPackage = makeOverridablePythonPackage ( makeOverridable (callPackage ../development/interpreters/python/mk-python-derivation.nix {
buildPythonPackage = makeOverridablePythonPackage (makeOverridable (callPackage ../development/interpreters/python/mk-python-derivation.nix {
inherit namePrefix; # We want Python libraries to be named like e.g. "python3.6-${name}"
inherit toPythonModule; # Libraries provide modules
}));
Expand Down Expand Up @@ -81,7 +81,9 @@ let
pythonPath = [ ]; # Deprecated, for compatibility.
requiredPythonModules = requiredPythonModules drv.propagatedBuildInputs;
};
});
}) // {
overridePythonAttrs = drv.overrideAttrs;
};

# Convert a Python library to an application.
toPythonApplication = drv:
Expand Down

0 comments on commit 55dbdef

Please sign in to comment.