fix(py_image_layer): Fix interpreter regex matching pip packages#822
Merged
fix(py_image_layer): Fix interpreter regex matching pip packages#822
Conversation
|
|
0ed1a3d to
cde2a75
Compare
|
The interpreter layer regex was too broad — it matched any runfiles path segment containing both "python" and an architecture string. This caused pip packages with arch tags in their canonical repo name (e.g. `rules_python++pip+pypi_313_argon2_cffi_bindings_cp36_abi3_manylinux_2_17_x86_64_...`) to be incorrectly placed in the interpreter layer instead of packages. Replace with a regex that matches the Python interpreter repo naming convention: `python[_]<major>_<minor>[_<patch>]_<arch>[-_]<vendor>[-_]<os>`, keying on the platform triplet vendor field (unknown/apple/pc). Handles both rules_python style (hyphens) and aspect_rules_py provisioned style (underscores), as well as both bzlmod (+) and WORKSPACE (~) separators. Fixes #787
6bfe534 to
4fef9ef
Compare
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.

The interpreter layer regex in
py_image_layerwas too broad — it matched any runfiles path segment containing both "python" and an architecture string. Pip packages with arch tags in their canonical repo name (e.g.rules_python++pip+pypi_313_argon2_cffi_bindings_cp36_abi3_manylinux_2_17_x86_64_...) were incorrectly placed in the interpreter layer.New regex matches the interpreter repo naming convention:
python[_]<major>_<minor>[_<patch>]_<arch>[-_]<vendor>[-_]<os>, keying on the platform triplet vendor field (unknown/apple/pc). Handles:python_3_9_x86_64-unknown-linux-gnu)python_3_11_x86_64_unknown_linux_gnu)+) and WORKSPACE (~) module separatorsFixes #787
Changes are visible to end-users: yes
Release note: Fix
py_image_layerincorrectly placing pip packages with architecture strings in their name into the interpreter layer instead of the packages layer.Test plan
//py/tests/py_image_layer_regex:test_interpreter_regex— 19 assertions covering interpreter repos (both naming conventions), pip packages, and main repo paths