python-packages-base: use extends instead of //
// shouldn't be used when overrideAttrs is available here we can use extends instead of overrideAttrs for performance
This commit is contained in:
parent
5b2f597b11
commit
b94fa2c253
@ -16,17 +16,22 @@ let
|
||||
# This function introduces `overridePythonAttrs` and it overrides the call to `buildPythonPackage`.
|
||||
makeOverridablePythonPackage = f: origArgs:
|
||||
let
|
||||
ff = f origArgs;
|
||||
overrideWith = newArgs: origArgs // (if pkgs.lib.isFunction newArgs then newArgs origArgs else newArgs);
|
||||
args = lib.fix (lib.extends
|
||||
(_: previousAttrs: {
|
||||
passthru = (previousAttrs.passthru or { }) // {
|
||||
overridePythonAttrs = newArgs: makeOverridablePythonPackage f (overrideWith newArgs);
|
||||
};
|
||||
})
|
||||
(_: origArgs));
|
||||
result = f args;
|
||||
overrideWith = newArgs: args // (if pkgs.lib.isFunction newArgs then newArgs args else newArgs);
|
||||
in
|
||||
if builtins.isAttrs ff then (ff // {
|
||||
if builtins.isAttrs result then result
|
||||
else if builtins.isFunction result then {
|
||||
overridePythonAttrs = newArgs: makeOverridablePythonPackage f (overrideWith newArgs);
|
||||
})
|
||||
else if builtins.isFunction ff then {
|
||||
overridePythonAttrs = newArgs: makeOverridablePythonPackage f (overrideWith newArgs);
|
||||
__functor = self: ff;
|
||||
__functor = self: result;
|
||||
}
|
||||
else ff;
|
||||
else result;
|
||||
|
||||
buildPythonPackage = makeOverridablePythonPackage (lib.makeOverridable (callPackage ./mk-python-derivation.nix {
|
||||
inherit namePrefix; # We want Python libraries to be named like e.g. "python3.6-${name}"
|
||||
|
Loading…
Reference in New Issue
Block a user