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

Ignore top_level.txt if installed-files.txt is available. #437

Merged
merged 2 commits into from
Jul 10, 2012

Conversation

PiDelport
Copy link
Contributor

This fixes #355: verified locally with Twisted plugin installs.

No new test case yet, but all existing tests pass. Any opinions on how the test for this should be automated?

@carljm
Copy link
Contributor

carljm commented Jan 22, 2012

Fix looks correct. Pip's tests are generally fairly high-level functional tests using scripttest and running pip inside a scratch virtualenv, so the ideal test here should just match the motivating use-case as closely as possible. In other words, add two packages into tests/packages, both of which install code into the same top-level package without using a namespace package. In the test, install both packages, and then uninstall one of them and verify the other one remains.

Thanks for the pull request!

@pnasrat
Copy link
Contributor

pnasrat commented May 13, 2012

@pjdelport do you need a hand with the test strategy @carljm suggested?

@pnasrat
Copy link
Contributor

pnasrat commented Jul 1, 2012

Ping - do you still need testing assistance?

@PiDelport
Copy link
Contributor Author

Pong; apologies for the high latency! I was priority interrupted for a while, there.

I rebased to the current master, and added a test case. (Credit to @mithrandi for the test packages.)

@carljm carljm merged commit 220cde1 into pypa:develop Jul 10, 2012
@carljm
Copy link
Contributor

carljm commented Jul 10, 2012

Merged, thanks!

@@ -433,7 +433,7 @@ def uninstall(self, auto_confirm=False):
for installed_file in dist.get_metadata('installed-files.txt').splitlines():
path = os.path.normpath(os.path.join(egg_info_path, installed_file))
paths_to_remove.add(path)
if dist.has_metadata('top_level.txt'):
elif dist.has_metadata('top_level.txt'):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hey @pjdelport , do you know when this elif will get run? we're already inside a block that's just for for pip installs I think.
also, you might know if we have any tests that run this elif block. I don't see anything right off.
The test you added is great, but it runs through the installed-files.txt block above this

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like that uninstall case would only happen if someone had done the install like so (not within pip)
"python setup.py install --single-version-externally-managed --record=<some log>

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@qwcode: You're right. This particular issue and test was mainly about ensuring that the elif block does not get run when it shouldn't; i don't know what circumstances it would actually be required in.

It doesn't seem to be covered by the test suite, at least: removing the whole block does not seem to induce any failures.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the reason this came up is in pull #646, which is fix for issue #638.
switching from if to elif here exposed an issue that we needed to handle related to __pycache__ removal.
notice that I added specific import calls to your new test and others to make sure we were handling __pycache__ removal.

@lock lock bot added the auto-locked Outdated issues that have been locked by automation label Jun 5, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Jun 5, 2019
@PiDelport PiDelport deleted the feature/issue-355-safe-uninstall branch December 11, 2020 12:25
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants