fix(multi-versions): correctly default 'main' arg for transition rules#1316
Merged
rickeylev merged 1 commit intobazel-contrib:mainfrom Jul 20, 2023
Merged
Conversation
bffc8b1 to
5946109
Compare
Collaborator
|
Some fun trivia about how py_binary finds main: it's basically a suffix search. e.g. |
rickeylev
requested changes
Jul 14, 2023
Collaborator
rickeylev
left a comment
There was a problem hiding this comment.
Mostly lgtm, but one bug to fix and some nits
Before the change the version-aware py_binary and py_test rules would not default the 'main' argument correctly and this change adds unit tests and a helper function to do the defaulting. Work towards bazel-contrib#1262
5946109 to
482c45a
Compare
Collaborator
Author
|
@rickeylev, yeah, the fact that As for the comment about modification in place test, it is there already because the |
rickeylev
approved these changes
Jul 20, 2023
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.
This fixes a bug where the version-aware rules required
mainto always be explicitlyspecified. This was necessary because the main file is named after the outer target
(e.g. "foo"), but usage of the main file is done by the inner target ("_foo"). The net
effect is the inner target looks for "_foo.py", while only "foo.py" is in srcs.
To fix, the wrappers set main, if it isn't already set, to their name + ".py"
Work towards #1262