New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
python: Move catch_conflicts.py into subdirectory #23600
Conversation
Thanks for checking this out. This is an interesting issue. Another solution would be to copy the file into the build as is done with |
Yes, indeed, we could copy it in as well, still it would need a subdirectory, otherwise we get false positives. Out of this thought I came to the conclusion to run this in an empty directory in the store. That's IMO less fragile. Regarding a comment: Since it's a tricky issue, maybe it's best to put a small README.md into the subdirectory? Then I could explain the reasoning better and if someone wonders what this weird construction is about there is a good chance that it helps to understand the original reasons. |
If it gets copied in, it would add the build directory to
You could refer to this PR:
|
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.
c693453
to
65b2491
Compare
Since this is flagged as a mass rebuild, does it need special treatment in any way? |
@vcunat this can go in. |
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 76213d1)
I didn't notice it was against master and had to "move" the commit to staging afterwards, creating a bit of mess. |
Motivation for this change
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.
I came across the issue on my machine which has about 100,000 entries in /nix/store. The build time for a single python derivation was increased by about 20 seconds due to this problem.
https://docs.python.org/3/library/sys.html#sys.path contains some details that the path of the script is added as first element into sys.path always.
Things done
(nix.useSandbox on NixOS,
or option
build-use-sandbox
innix.conf
on non-NixOS)
nix-shell -p nox --run "nox-review wip"
./result/bin/
)