python: Move catch_conflicts.py into subdirectory (#23600)

Python does add the script's directory into "sys.path". For the case of
"catch_conflicts.py" this means "/nix/store" is added to "sys.path". This can
result in very long delays if the store contains a lot of entries.

authored by Johannes Bornhold and committed by Vladimír Čunát 76213d10 f44ea1fe

+17 -5
pkgs/development/interpreters/python/catch_conflicts.py pkgs/development/interpreters/python/catch_conflicts/catch_conflicts.py
+13
pkgs/development/interpreters/python/catch_conflicts/README.md
···
··· 1 + 2 + 3 + catch_conflicts.py 4 + ================== 5 + 6 + The file catch_conflicts.py is in a subdirectory because, if it isn't, the 7 + /nix/store/ directory is added to sys.path causing a delay when building. 8 + 9 + Pointers: 10 + 11 + - https://docs.python.org/3/library/sys.html#sys.path 12 + 13 + - https://github.com/NixOS/nixpkgs/pull/23600
+4 -5
pkgs/development/interpreters/python/mk-python-derivation.nix
··· 79 postFixup = '' 80 wrapPythonPrograms 81 '' + lib.optionalString catchConflicts '' 82 - # check if we have two packages with the same name in closure and fail 83 - # this shouldn't happen, something went wrong with dependencies specs 84 - ${python.interpreter} ${./catch_conflicts.py} 85 '' + attrs.postFixup or ''''; 86 87 passthru = { ··· 98 isBuildPythonPackage = python.meta.platforms; 99 }; 100 }) 101 - 102 -
··· 79 postFixup = '' 80 wrapPythonPrograms 81 '' + lib.optionalString catchConflicts '' 82 + # Check if we have two packages with the same name in the closure and fail. 83 + # If this happens, something went wrong with the dependencies specs. 84 + # Intentionally kept in a subdirectory, see catch_conflicts/README.md. 85 + ${python.interpreter} ${./catch_conflicts}/catch_conflicts.py 86 '' + attrs.postFixup or ''''; 87 88 passthru = { ··· 99 isBuildPythonPackage = python.meta.platforms; 100 }; 101 })