mk-python-derivation: Break out attribute set cleaning into a separate function

With precomputed static lists.
This commit is contained in:
adisbladis 2024-03-04 15:09:50 +13:00
parent 1656fe1bf6
commit de402796a7

View file

@ -59,6 +59,12 @@ let
isSetuptoolsDependency' = lib.flip elem [ "setuptools" "wheel" ]; isSetuptoolsDependency' = lib.flip elem [ "setuptools" "wheel" ];
cleanAttrs = lib.flip removeAttrs [
"disabled" "checkPhase" "checkInputs" "nativeCheckInputs" "doCheck" "doInstallCheck" "dontWrapPythonPrograms" "catchConflicts" "pyproject" "format"
"disabledTestPaths" "outputs" "stdenv"
"dependencies" "optional-dependencies" "build-system"
];
in in
{ name ? "${attrs.pname}-${attrs.version}" { name ? "${attrs.pname}-${attrs.version}"
@ -227,11 +233,7 @@ let
}; };
# Keep extra attributes from `attrs`, e.g., `patchPhase', etc. # Keep extra attributes from `attrs`, e.g., `patchPhase', etc.
self = toPythonModule (stdenv.mkDerivation ((builtins.removeAttrs attrs [ self = toPythonModule (stdenv.mkDerivation ((cleanAttrs attrs) // {
"disabled" "checkPhase" "checkInputs" "nativeCheckInputs" "doCheck" "doInstallCheck" "dontWrapPythonPrograms" "catchConflicts" "pyproject" "format"
"disabledTestPaths" "outputs" "stdenv"
"dependencies" "optional-dependencies" "build-system"
]) // {
name = namePrefix + name; name = namePrefix + name;