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

Do not attempt setup.py clean for failed pep517 builds #7477

Merged
merged 2 commits into from Jan 2, 2020

Conversation

sbidoul
Copy link
Member

@sbidoul sbidoul commented Dec 13, 2019

When a pep517 build fails, pip unconditionally attempts to setup.py clean. This PR makes it do that only for legacy builds, since there may not be any setup.py in the pep517case.

Fixes #6642

@sbidoul sbidoul force-pushed the no-legacy-clean-for-pep517-sbi branch from 8e49ef3 to faefea7 Compare December 13, 2019 21:40
@chrahunt
Copy link
Member

You can use #6642 as the issue for this one.

Copy link
Member

@xavfernandez xavfernandez left a comment

Choose a reason for hiding this comment

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

A test would be nice to prevent a future regression.

@sbidoul sbidoul force-pushed the no-legacy-clean-for-pep517-sbi branch from faefea7 to e0785e3 Compare December 13, 2019 22:31
@sbidoul
Copy link
Member Author

sbidoul commented Dec 13, 2019

A test would be nice to prevent a future regression.

Yep. But I'm actually wondering if the cleanup is still necessary since I believe pip always build in a temporary directory. OTOH there is this idea to have an option to build in place.

@chrahunt
Copy link
Member

I'm actually wondering if the cleanup is still necessary

I would check the history of that line to see if there's any justification, and also see what the setuptools.build_meta:__legacy__ backend does in case there's a build failure.

@sbidoul
Copy link
Member Author

sbidoul commented Dec 14, 2019

For reference, _clean_one comes from #3047

@chrahunt
Copy link
Member

Ah OK, that makes sense. In InstallCommand we fall back to running setup.py install directly, and per the issue associated with that PR (#3006), some leftover files were causing problems in the fallback case. So while we're still reusing the same directory for wheel building and setup.py install, we should keep _clean_one.

@BrownTruck
Copy link
Contributor

Hello!

I am an automated bot and I have noticed that this pull request is not currently able to be merged. If you are able to either merge the master branch into this pull request or rebase this pull request against master then it will be eligible for code review and hopefully merging!

@BrownTruck BrownTruck added the needs rebase or merge PR has conflicts with current master label Dec 31, 2019
@sbidoul sbidoul force-pushed the no-legacy-clean-for-pep517-sbi branch from e0785e3 to fc2bc2a Compare January 1, 2020 11:51
@pypa-bot pypa-bot removed the needs rebase or merge PR has conflicts with current master label Jan 1, 2020
@sbidoul sbidoul force-pushed the no-legacy-clean-for-pep517-sbi branch from fc2bc2a to 2ba4084 Compare January 1, 2020 13:47
@sbidoul
Copy link
Member Author

sbidoul commented Jan 1, 2020

I added a test here.

Copy link
Member

@chrahunt chrahunt left a comment

Choose a reason for hiding this comment

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

A few minor comments, otherwise LGTM.

tests/functional/test_install_cleanup.py Outdated Show resolved Hide resolved
tests/functional/test_install_cleanup.py Outdated Show resolved Hide resolved
tests/functional/test_install_cleanup.py Outdated Show resolved Hide resolved
@sbidoul sbidoul force-pushed the no-legacy-clean-for-pep517-sbi branch from 2ba4084 to 9dbe8df Compare January 1, 2020 20:01
# Must not have built the package
expected = "Failed building wheel for pep517-wrapper-buildsys"
assert expected in str(res)
# Must not have attempted legacy cleanup
Copy link
Member

Choose a reason for hiding this comment

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

Since this is a "negative" test, it might be worth it to add a comment linking to this test in a "positive" test like test_cleanup_after_failed_wheel (for the possible future, when we might modify Running setup.py clean for %s log into something not containing setup.py clean)
PS: tell me if I'm unclear ^^

Copy link
Member Author

Choose a reason for hiding this comment

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

@xavfernandez good point, done.

@sbidoul sbidoul force-pushed the no-legacy-clean-for-pep517-sbi branch from 9dbe8df to 8d1d20d Compare January 2, 2020 11:14
@pradyunsg pradyunsg merged commit 08f61a9 into pypa:master Jan 2, 2020
@pradyunsg
Copy link
Member

Thanks @sbidoul for the PR and @chrahunt + @xavfernandez for the reviews! ^>^

@sbidoul sbidoul deleted the no-legacy-clean-for-pep517-sbi branch January 2, 2020 12:31
@lock lock bot added the auto-locked Outdated issues that have been locked by automation label Feb 1, 2020
@lock lock bot locked as resolved and limited conversation to collaborators Feb 1, 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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Traceback running setup.py clean: ModuleNotFoundError: No module named 'setuptools'
6 participants