about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/interpreters/python/hooks/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/interpreters/python/hooks/default.nix')
-rw-r--r--nixpkgs/pkgs/development/interpreters/python/hooks/default.nix11
1 files changed, 9 insertions, 2 deletions
diff --git a/nixpkgs/pkgs/development/interpreters/python/hooks/default.nix b/nixpkgs/pkgs/development/interpreters/python/hooks/default.nix
index f7cc10274ae3..0a4600b9d6c3 100644
--- a/nixpkgs/pkgs/development/interpreters/python/hooks/default.nix
+++ b/nixpkgs/pkgs/development/interpreters/python/hooks/default.nix
@@ -106,9 +106,16 @@ in {
   pythonCatchConflictsHook = callPackage ({ makePythonHook, setuptools }:
     makePythonHook {
       name = "python-catch-conflicts-hook";
-      substitutions = {
+      substitutions = let
+        useLegacyHook = lib.versionOlder python.version "3.10";
+      in {
         inherit pythonInterpreter pythonSitePackages;
-        catchConflicts=../catch_conflicts/catch_conflicts.py;
+        catchConflicts = if useLegacyHook then
+          ../catch_conflicts/catch_conflicts_py2.py
+        else
+          ../catch_conflicts/catch_conflicts.py;
+      } // lib.optionalAttrs useLegacyHook {
+        inherit setuptools;
       };
     } ./python-catch-conflicts-hook.sh) {};