-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Intentional reuse of deleted root dir in RequirementTracker #5725
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
Comments
See #5336. |
I see there's a test that removes any I'm happy to put a PR together but I don't understand the intended behavior. |
No! You should not use that, it's for PIP internal use. |
Nonetheless, I hope the maintainers can see the bug here, regardless of the intent. Feel free to ignore and close! |
I still don't understand what is the bug. |
The initial pip process (e.g. the one spawned by the user |
The class uses the environment to remember the first temporary dir it creates, effectively using the process environment as global state. It never un-remembers this. So that root is stuck forever once it's defined in os.environ. If a tracker object is used as a context manager, when the context exits, Code that writes to that directory, assuming it already exists, fails. |
Again, what's the problem? Unless you're using multiple call to pip's main from python, something that is specifically not supported! |
I can see why it's not supported! I'll go ahead and close this since you don't consider the behavior to be a bug. |
See my comment for your use case. |
Terrific - thank you! |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
The constructor uses an environment variable to cache the temp dir it creates:
https://github.com/pypa/pip/blob/18.0/src/pip/_internal/req/req_tracker.py#L17-L25
But RequirementTracker objects are context managers that delete the root dir:
https://github.com/pypa/pip/blob/18.0/src/pip/_internal/req/req_tracker.py#L31-L32
https://github.com/pypa/pip/blob/18.0/src/pip/_internal/req/req_tracker.py#L65-L67
It's not obvious to me looking at the code or associated commit messages what the goal of the root dir reuse is.
The text was updated successfully, but these errors were encountered: