Python: simplify hasPythonModule
This commit is contained in:
parent
9630bd5232
commit
c86b19cb20
@ -87,12 +87,11 @@ let
|
|||||||
in fetcher (builtins.removeAttrs attrs ["format"]) );
|
in fetcher (builtins.removeAttrs attrs ["format"]) );
|
||||||
|
|
||||||
# Check whether a derivation provides a Python module.
|
# Check whether a derivation provides a Python module.
|
||||||
hasPythonModule = drv: (hasAttr "pythonModule" drv) && ( (getAttr "pythonModule" drv) == python);
|
hasPythonModule = drv: drv?pythonModule && drv.pythonModule == python;
|
||||||
|
|
||||||
# Get list of required Python modules given a list of derivations.
|
# Get list of required Python modules given a list of derivations.
|
||||||
requiredPythonModules = drvs: let
|
requiredPythonModules = drvs: let
|
||||||
removeNull = list: filter (x: !isNull x) list;
|
modules = filter hasPythonModule drvs;
|
||||||
modules = filter hasPythonModule (removeNull drvs);
|
|
||||||
in unique ([python] ++ modules ++ concatLists (catAttrs "requiredPythonModules" modules));
|
in unique ([python] ++ modules ++ concatLists (catAttrs "requiredPythonModules" modules));
|
||||||
|
|
||||||
# Create a PYTHONPATH from a list of derivations. This function recurses into the items to find derivations
|
# Create a PYTHONPATH from a list of derivations. This function recurses into the items to find derivations
|
||||||
|
Loading…
Reference in New Issue
Block a user