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.
This commit is contained in:
parent
f44ea1fec2
commit
76213d102c
@ -0,0 +1,13 @@
|
|||||||
|
|
||||||
|
|
||||||
|
catch_conflicts.py
|
||||||
|
==================
|
||||||
|
|
||||||
|
The file catch_conflicts.py is in a subdirectory because, if it isn't, the
|
||||||
|
/nix/store/ directory is added to sys.path causing a delay when building.
|
||||||
|
|
||||||
|
Pointers:
|
||||||
|
|
||||||
|
- https://docs.python.org/3/library/sys.html#sys.path
|
||||||
|
|
||||||
|
- https://github.com/NixOS/nixpkgs/pull/23600
|
@ -79,9 +79,10 @@ python.stdenv.mkDerivation (builtins.removeAttrs attrs ["disabled"] // {
|
|||||||
postFixup = ''
|
postFixup = ''
|
||||||
wrapPythonPrograms
|
wrapPythonPrograms
|
||||||
'' + lib.optionalString catchConflicts ''
|
'' + lib.optionalString catchConflicts ''
|
||||||
# check if we have two packages with the same name in closure and fail
|
# Check if we have two packages with the same name in the closure and fail.
|
||||||
# this shouldn't happen, something went wrong with dependencies specs
|
# If this happens, something went wrong with the dependencies specs.
|
||||||
${python.interpreter} ${./catch_conflicts.py}
|
# Intentionally kept in a subdirectory, see catch_conflicts/README.md.
|
||||||
|
${python.interpreter} ${./catch_conflicts}/catch_conflicts.py
|
||||||
'' + attrs.postFixup or '''';
|
'' + attrs.postFixup or '''';
|
||||||
|
|
||||||
passthru = {
|
passthru = {
|
||||||
@ -98,5 +99,3 @@ python.stdenv.mkDerivation (builtins.removeAttrs attrs ["disabled"] // {
|
|||||||
isBuildPythonPackage = python.meta.platforms;
|
isBuildPythonPackage = python.meta.platforms;
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user