mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-16 23:03:40 +01:00
python3.pkgs: simplify ensurePythonModules logic
It wasn't clear before, but it turns out that this is just four separate conditions, and an attribute is valid if any of the conditions is true, so we don't need a sea of parentheses to express it.
This commit is contained in:
parent
f69c8b761a
commit
02ee33a5c1
1 changed files with 1 additions and 1 deletions
|
@ -36,7 +36,7 @@
|
|||
stdenv
|
||||
];
|
||||
providesSetupHook = lib.attrByPath [ "provides" "setupHook"] false;
|
||||
valid = value: !((lib.isDerivation value) && !((pythonPackages.hasPythonModule value) || (providesSetupHook value))) || (lib.elem value exceptions);
|
||||
valid = value: !lib.isDerivation value || pythonPackages.hasPythonModule value || providesSetupHook value || lib.elem value exceptions;
|
||||
func = name: value: if (valid value) then value else throw "${name} should use `buildPythonPackage` or `toPythonModule` if it is to be part of the Python packages set.";
|
||||
in lib.mapAttrs func items;
|
||||
in ensurePythonModules (callPackage
|
||||
|
|
Loading…
Reference in a new issue