Skip to content
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

Globally manage and track some temp build directories #7677

Merged
merged 8 commits into from
Feb 5, 2020

Conversation

chrahunt
Copy link
Member

@chrahunt chrahunt commented Jan 31, 2020

There are several directories cleaned up in InstallRequirement.cleanup(). These directories need to consider the behavior of the --no-clean option:

  1. If --no-clean is provided, they shouldn't be deleted
  2. if a PreviousBuildDirError is raised, they shouldn't be deleted

and the timing of deletion i.e. deleted after all operations are done.

In this PR we tackle this for the build environment temporary directory and InstallRequirement temp build directory, building on top of the tempdir registry introduced in prior PRs to provide the correct behavior for --no-clean, and then mark these two globally_managed so they are cleaned up after our commands are finished.

Progresses #7571 and #7638.

@chrahunt chrahunt added type: refactor Refactoring code skip news Does not need a NEWS file entry (eg: trivial changes) labels Jan 31, 2020
@chrahunt chrahunt changed the title Refactor/remove req set cleanup Globally manage and track some temp build directories Jan 31, 2020
@chrahunt chrahunt marked this pull request as ready for review January 31, 2020 07:02
@chrahunt
Copy link
Member Author

chrahunt commented Feb 4, 2020

Ping.

@chrahunt
Copy link
Member Author

chrahunt commented Feb 4, 2020

Thanks, that was fast. :)

@pradyunsg
Copy link
Member

I was reviewing this when you commented; so that helped. :)

We want to rely on --no-clean being a valid option for
RequirementCommand types, so move it to one place close to the code that
will depend on it.
This mirrors the current logic within the individual requirement-related
commands (install, wheel) for setting options.no_clean, which is used to
determine whether we need to delete directories.

Next, we'll add the actual directories to track and remove them from
being managed by other objects.
Now we can refactor this to be globally managed, and it will have the
same behavior as it does currently (if there is any
PreviousBuildDirError it will not be cleaned up).
InstallRequirement.remove_temporary_source was already being called at
the end of processing (as part of RequirementSet.cleanup()), so this
doesn't change behavior - cleanup still happens right after the command
finishes.
Similar to the InstallRequirement temp build dir, now we'll be able to
refactor this to be globally managed.
@chrahunt chrahunt force-pushed the refactor/remove-req-set-cleanup branch from cb64543 to e800cb1 Compare February 5, 2020 01:34
@chrahunt chrahunt added skip news Does not need a NEWS file entry (eg: trivial changes) and removed skip news Does not need a NEWS file entry (eg: trivial changes) labels Feb 5, 2020
@chrahunt
Copy link
Member Author

chrahunt commented Feb 5, 2020

Thank you for the reviews and nice feedback.

@chrahunt chrahunt merged commit 34d97cf into pypa:master Feb 5, 2020
@chrahunt chrahunt deleted the refactor/remove-req-set-cleanup branch February 5, 2020 02:07
@lock lock bot added the auto-locked Outdated issues that have been locked by automation label Mar 10, 2020
@lock lock bot locked as resolved and limited conversation to collaborators Mar 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
auto-locked Outdated issues that have been locked by automation skip news Does not need a NEWS file entry (eg: trivial changes) type: refactor Refactoring code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants