Skip to content

Commit c3d7224

Browse files
committed
refactor: use version_label
1 parent 891691b commit c3d7224

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
@@ -27,6 +27,7 @@ load(
2727
)
2828
load("@rules_python//python/pip_install:requirements_parser.bzl", parse_requirements = "parse")
2929
load("//python/private:normalize_name.bzl", "normalize_name")
30+
load("//python/private:version_label.bzl", "version_label")
3031

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

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

102106
# 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