Skip to content

Commit

Permalink
fixes for bazelbuild#1930
Browse files Browse the repository at this point in the history
  • Loading branch information
aignas committed May 30, 2024
1 parent 1800f77 commit 6dff723
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ A brief description of the categories of changes:
"panic: runtime error: invalid memory address or nil pointer dereference"
* (bzlmod) remove `pip.parse(annotations)` attribute as it is unused and has been
replaced by whl_modifications.
* (pip) Correctly select wheels when the python tag includes minor versions.
See ([#1930](https://github.com/bazelbuild/rules_python/issues/1930))

### Added
* (rules) Precompiling Python source at build time is available. but is
Expand Down
4 changes: 2 additions & 2 deletions python/private/whl_target_platforms.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,8 @@ def select_whls(*, whls, want_version = None, want_abis = [], want_platforms = [

if parsed.platform_tag == "any" or not want_platforms:
whl_version_min = 0
if parsed.python_tag.startswith("cp3"):
whl_version_min = int(parsed.python_tag[len("cp3"):])
if parsed.python_tag.startswith("cp3") or parsed.python_tag.startswith("py3"):
whl_version_min = int(parsed.python_tag[len("xx3"):] or 0)

if version_limit != -1 and whl_version_min > version_limit:
continue
Expand Down
8 changes: 8 additions & 0 deletions tests/private/whl_target_platforms/select_whl_tests.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ WHL_LIST = [
"pkg-0.0.1-cp39-cp39-win32.whl",
"pkg-0.0.1-cp39-cp39-win_amd64.whl",
"pkg-0.0.1-cp39-abi3-any.whl",
"pkg-0.0.1-py310-abi3-any.whl",
"pkg-0.0.1-py3-abi3-any.whl",
"pkg-0.0.1-py3-none-any.whl",
]
Expand Down Expand Up @@ -127,6 +128,13 @@ def _test_select_by_supported_py_version(env):
"pkg-0.0.1-cp39-abi3-any.whl",
)

got = select_whls(whls = WHL_LIST, want_abis = ["abi3"], want_platforms = ["ignored"], want_version = "3.10")
_match(
env,
got,
"pkg-0.0.1-py310-abi3-any.whl",
)

_tests.append(_test_select_by_supported_py_version)

def _test_match_abi_and_not_py_version(env):
Expand Down

0 comments on commit 6dff723

Please sign in to comment.