From ac2d0c5710ce4dc9889168214fdbed4011dbe1d4 Mon Sep 17 00:00:00 2001 From: Eman Resu Date: Mon, 20 Jul 2026 09:22:55 -0400 Subject: [PATCH] python3,python2: partially apply hasSuffix --- .../development/interpreters/python/mk-python-derivation.nix | 4 +++- .../misc/resholve/python2/mk-python-derivation.nix | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/pkgs/development/interpreters/python/mk-python-derivation.nix b/pkgs/development/interpreters/python/mk-python-derivation.nix index bc44a7de7178..fdc896fa66ec 100644 --- a/pkgs/development/interpreters/python/mk-python-derivation.nix +++ b/pkgs/development/interpreters/python/mk-python-derivation.nix @@ -59,6 +59,8 @@ let in fixedWidthString len " " name; + hasZipSuffix = hasSuffix "zip"; + isPythonModule = drv: # all pythonModules have the pythonModule attribute @@ -317,7 +319,7 @@ lib.extendMkDerivation { ++ optionals removeBinBytecode [ pythonRemoveBinBytecodeHook ] - ++ optionals (hasSuffix "zip" (finalAttrs.src.name or "")) [ + ++ optionals (attrs ? src.name && hasZipSuffix attrs.src.name) [ unzip ] ++ optionals (format' == "setuptools") [ diff --git a/pkgs/development/misc/resholve/python2/mk-python-derivation.nix b/pkgs/development/misc/resholve/python2/mk-python-derivation.nix index e6e660d704e5..c517b5393a24 100644 --- a/pkgs/development/misc/resholve/python2/mk-python-derivation.nix +++ b/pkgs/development/misc/resholve/python2/mk-python-derivation.nix @@ -27,6 +27,9 @@ eggBuildHook, eggInstallHook, }: +let + hasZipSuffix = lib.hasSuffix "zip"; +in lib.extendMkDerivation { constructDrv = stdenv.mkDerivation; @@ -207,7 +210,7 @@ lib.extendMkDerivation { ++ lib.optionals removeBinBytecode [ pythonRemoveBinBytecodeHook ] - ++ lib.optionals (lib.hasSuffix "zip" (attrs.src.name or "")) [ + ++ lib.optionals (attrs ? src.name && hasZipSuffix attrs.src.name) [ unzip ] ++ lib.optionals (format == "setuptools") [