Don't delete wheels from external repos with pip_parse#458
Merged
hrfuller merged 1 commit intobazel-contrib:masterfrom Apr 21, 2021
Merged
Don't delete wheels from external repos with pip_parse#458hrfuller merged 1 commit intobazel-contrib:masterfrom
hrfuller merged 1 commit intobazel-contrib:masterfrom
Conversation
person142
commented
Apr 18, 2021
| class TestWhlFilegroup(unittest.TestCase): | ||
| def setUp(self) -> None: | ||
| self.wheel_name = "example_minimal_package-0.0.1-py3-none-any.whl" | ||
| self.wheel_dir = tempfile.mkdtemp() |
Contributor
Author
There was a problem hiding this comment.
Moved the extraction into a temporary directory to keep the runfiles tree clean between test cases.
person142
commented
Apr 18, 2021
| build_file.write(contents) | ||
|
|
||
| os.remove(whl.path) | ||
| if not incremental: |
Contributor
Author
There was a problem hiding this comment.
The relevant non test change.
cd2cde6 to
b122c27
Compare
Contributor
Author
|
Ping @hrfuller for this (sorry wish I could request reviews like a normal human). |
13 tasks
hrfuller
approved these changes
Apr 20, 2021
| )[2:] # Take off the leading // from the returned label. | ||
| # Assert that the raw wheel ends up in the package. | ||
| self.assertIn(wheel_name, os.listdir(generated_bazel_dir)) | ||
| self.assertIn(self.wheel_name, os.listdir(generated_bazel_dir)) |
Contributor
There was a problem hiding this comment.
The only thing I did differently was also assert a test case that the original wheel at the root is removed in the non-incremental case.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Checklist
Please check if your PR fulfills the following requirements:
.parfiles. See CONTRIBUTING.md for infoPR Type
What kind of change does this PR introduce?
What is the current behavior?
Issue Number: N/A
Wheel targets are broken with
pip_parse. This is because currentlypip_parseextracts the wheel into the repository root, but then deletes it here:https://github.com/bazelbuild/rules_python/blob/master/python/pip_install/extract_wheels/lib/bazel.py#L251
This doesn't happen for
pip_installbecause it copies the wheel into the relevant subdirectory:https://github.com/bazelbuild/rules_python/blob/master/python/pip_install/extract_wheels/lib/bazel.py#L212
What is the new behavior?
Instead of deleting the wheel unconditionally, only do it for the non-incremental case.
Does this PR introduce a breaking change?
Other information
None