diff options
author | Johannes Bornhold <johannes.bornhold@gmail.com> | 2017-04-01 12:19:53 +0200 |
---|---|---|
committer | Vladimír Čunát <vcunat@gmail.com> | 2017-04-01 12:22:36 +0200 |
commit | 249b34aadca7038207492f29142a3456d0cecec3 (patch) | |
tree | f19e2805cedde4a1f629148f469f3c008079f6cf /pkgs/development/interpreters | |
parent | eb551a435f911d9fcad0ecab05f42c2822777a0d (diff) | |
download | nixlib-249b34aadca7038207492f29142a3456d0cecec3.tar nixlib-249b34aadca7038207492f29142a3456d0cecec3.tar.gz nixlib-249b34aadca7038207492f29142a3456d0cecec3.tar.bz2 nixlib-249b34aadca7038207492f29142a3456d0cecec3.tar.lz nixlib-249b34aadca7038207492f29142a3456d0cecec3.tar.xz nixlib-249b34aadca7038207492f29142a3456d0cecec3.tar.zst nixlib-249b34aadca7038207492f29142a3456d0cecec3.zip |
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. (moved from master commit 76213d102c1eaa91e733b326d9d312b60103d88a)
Diffstat (limited to 'pkgs/development/interpreters')
-rw-r--r-- | pkgs/development/interpreters/python/catch_conflicts/README.md | 13 | ||||
-rw-r--r-- | pkgs/development/interpreters/python/catch_conflicts/catch_conflicts.py (renamed from pkgs/development/interpreters/python/catch_conflicts.py) | 0 | ||||
-rw-r--r-- | pkgs/development/interpreters/python/mk-python-derivation.nix | 9 |
3 files changed, 17 insertions, 5 deletions
diff --git a/pkgs/development/interpreters/python/catch_conflicts/README.md b/pkgs/development/interpreters/python/catch_conflicts/README.md new file mode 100644 index 000000000000..d144b80e3385 --- /dev/null +++ b/pkgs/development/interpreters/python/catch_conflicts/README.md @@ -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 diff --git a/pkgs/development/interpreters/python/catch_conflicts.py b/pkgs/development/interpreters/python/catch_conflicts/catch_conflicts.py index bb82900c65a9..bb82900c65a9 100644 --- a/pkgs/development/interpreters/python/catch_conflicts.py +++ b/pkgs/development/interpreters/python/catch_conflicts/catch_conflicts.py diff --git a/pkgs/development/interpreters/python/mk-python-derivation.nix b/pkgs/development/interpreters/python/mk-python-derivation.nix index f30bd175daac..5d710fcad882 100644 --- a/pkgs/development/interpreters/python/mk-python-derivation.nix +++ b/pkgs/development/interpreters/python/mk-python-derivation.nix @@ -79,9 +79,10 @@ python.stdenv.mkDerivation (builtins.removeAttrs attrs ["disabled"] // { postFixup = '' wrapPythonPrograms '' + lib.optionalString catchConflicts '' - # check if we have two packages with the same name in closure and fail - # this shouldn't happen, something went wrong with dependencies specs - ${python.interpreter} ${./catch_conflicts.py} + # Check if we have two packages with the same name in the closure and fail. + # If this happens, something went wrong with the dependencies specs. + # Intentionally kept in a subdirectory, see catch_conflicts/README.md. + ${python.interpreter} ${./catch_conflicts}/catch_conflicts.py '' + attrs.postFixup or ''''; passthru = { @@ -98,5 +99,3 @@ python.stdenv.mkDerivation (builtins.removeAttrs attrs ["disabled"] // { isBuildPythonPackage = python.meta.platforms; }; }) - - |