python/hooks: restore catchConflictHook for python<3.10

By restoring and diverting to the old version.

Previously the newer language features and use of more modern stdlib
imports broke the hook on Python<3.10.
This commit is contained in:
Martin Weinelt
2023-11-18 12:57:18 +01:00
parent b3e8dae766
commit f292ef4958
2 changed files with 39 additions and 2 deletions
@@ -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) {};