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 InstallRequirement.source_dir #7696

Merged
merged 9 commits into from
Feb 6, 2020

Conversation

chrahunt
Copy link
Member

@chrahunt chrahunt commented Feb 5, 2020

Originally we would write a marker file to determine whether we needed to automatically delete
the InstallRequirement source directory

Now, we manage this explicitly using the machinery that we set up in #7677.

Progresses #7571 and #7638.

@chrahunt chrahunt added type: refactor Refactoring code skip news Does not need a NEWS file entry (eg: trivial changes) labels Feb 5, 2020
@chrahunt chrahunt marked this pull request as ready for review February 5, 2020 04:41
@pradyunsg
Copy link
Member

Nice!

I think we can also drop the marker_files module here.

@chrahunt
Copy link
Member Author

chrahunt commented Feb 5, 2020

marker_files is already gone :)

@chrahunt chrahunt force-pushed the refactor/auto-cleanup-source-dir branch from 7c5fa63 to 3adcdab Compare February 5, 2020 05:46
@pradyunsg
Copy link
Member

marker_files is already gone :)

Indeed! I missed this change, because the UI collapsed that. I'm legit glad that we finally got rid of marker_files -- that's always stuck out as a architectural-nit to me. :)

LGTM (I've desk-reviewed this one🤷‍♂)

We want to use this value to determine whether a globally-managed
source_dir should delegate choosing deletion to the global tempdir
manager, so it needs to be above our call to
InstallRequirement.ensure_has_source_dir.
Since we explicitly disable deletion this is a no-op, but we'll
parameterize the deletion soon.
Previously we were writing a delete marker file which is checked in
InstallRequirement.remove_temporary_source which is only invoked if the
user did not pass --no-clean (and a PreviousBuildDirError was not
raised). Since our TempDirectory machinery now respects these conditions
we can just wrap our source directory in that instead of using this
ad-hoc mechanism for tracking our delete preference.

This will let us clean up a lot of dead code that only existed for this
use case.
Since nothing in our code writes the delete marker file, this block will
never execute.
Nothing checks for this file, so no need to write it.
Since all directories are now globally-managed, we don't need to be
concerned with resetting the member values.

This will also let us remove several responsibilities from
RequirementSet, which will make integrating the new resolver easier.
@chrahunt chrahunt force-pushed the refactor/auto-cleanup-source-dir branch from 3adcdab to 85ab574 Compare February 6, 2020 01:16
@chrahunt
Copy link
Member Author

chrahunt commented Feb 6, 2020

Updated to fix trivial merge conflict.

@chrahunt chrahunt merged commit b395c9f into pypa:master Feb 6, 2020
@chrahunt
Copy link
Member Author

chrahunt commented Feb 6, 2020

Thanks for reviewing!

@chrahunt chrahunt deleted the refactor/auto-cleanup-source-dir branch February 6, 2020 02:00
@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.

2 participants