From 02ee33a5c177334f1cc7c2d5573babf5e7d70d8f Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Thu, 26 Jan 2023 20:10:29 +0000 Subject: [PATCH] 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. --- pkgs/development/interpreters/python/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/development/interpreters/python/default.nix b/pkgs/development/interpreters/python/default.nix index faab3eb785e4..ef358c7b63fc 100644 --- a/pkgs/development/interpreters/python/default.nix +++ b/pkgs/development/interpreters/python/default.nix @@ -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