Skip to content

Commit 2db1440

Browse files
committed
refactor: use version_label
1 parent 57c36d0 commit 2db1440

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

python/extensions/pip.bzl

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ load(
2626
"whl_library",
2727
)
2828
load("@rules_python//python/pip_install:requirements_parser.bzl", parse_requirements = "parse")
29+
load("//python/private:version_label.bzl", "version_label")
2930

3031
def _whl_mods_impl(mctx):
3132
"""Implementation of the pip.whl_mods tag class.
@@ -83,7 +84,7 @@ def _create_versioned_pip_and_whl_repos(module_ctx, pip_attr, whl_map):
8384
# we programtically find it.
8485
hub_name = pip_attr.hub_name
8586
if python_interpreter_target == None:
86-
python_name = "python_{}".format(pip_attr.python_version.replace(".", "_"))
87+
python_name = "python_" + version_label(pip_attr.python_version, sep = "_")
8788
if python_name not in INTERPRETER_LABELS.keys():
8889
fail((
8990
"Unable to find interpreter for pip hub '{hub_name}' for " +
@@ -95,7 +96,10 @@ def _create_versioned_pip_and_whl_repos(module_ctx, pip_attr, whl_map):
9596
))
9697
python_interpreter_target = INTERPRETER_LABELS[python_name]
9798

98-
pip_name = hub_name + "_{}".format(pip_attr.python_version.replace(".", ""))
99+
pip_name = "{}_{}".format(
100+
hub_name,
101+
version_label(pip_attr.python_version),
102+
)
99103
requrements_lock = locked_requirements_label(module_ctx, pip_attr)
100104

101105
# Parse the requirements file directly in starlark to get the information

python/private/coverage_deps.bzl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
1919
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
20+
load("//python/private:version_label.bzl", "version_label")
2021

2122
# Update with './tools/update_coverage_deps.py <version>'
2223
#START: managed by update_coverage_deps.py script
@@ -116,8 +117,7 @@ def coverage_dep(name, python_version, platform, visibility):
116117
# for now as it is not actionable.
117118
return None
118119

119-
python_short_version = python_version.rpartition(".")[0]
120-
abi = python_short_version.replace("3.", "cp3")
120+
abi = "cp" + version_label(python_version)
121121
url, sha256 = _coverage_deps.get(abi, {}).get(platform, (None, ""))
122122

123123
if url == None:

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy