Make hermetic interpreters compatible to disallow_empty_glob #761
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:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Using Bazel CLI option incompatible_disallow_empty_glob is not compatible with using a hermetic interpreter offered by rules_python.
It causes the error (exemplary for a Linux host):
Issue Number: N/A
What is the underlying problem
A single filegroup is used to aggregate the interpreter files. Its platform specific regex patterns are not compatible to the flag
--incompatible_disallow_empty_glob
which forbids any pattern to return an empty list. For example, on a Linux host the"*.exe",
pattern will be empty.Reproducing
Minimal workspace for reproducing the problem.
WORKSPACE
BUILD
foo.py
Command to generate the error:
bazel run --incompatible_disallow_empty_glob //:foo
What is the new behavior?
One can utilize flag
incompatible_disallow_empty_glob
while using a hermetic Python interpreter offered by rules_python.Does this PR introduce a breaking change?
Other information
What alternatives have been considered.
We could also introduce separate filegroups for the different platforms and use an alias with a platforms based select statement to provide the correct one to the user.
However, given how unlikely it is that an interpreter without files is referenced by rules_python and this is not discovered in any test, we should use the straight forward solution offered in this PR instead of introducing this additional complexity.