Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 7dd901c

Browse filesBrowse files
keithrickeylev
authored andcommitted
fix: escape more invalid repo string characters (bazel-contrib#2801)
Also escape plus and percent when generating the repo name from the wheel version. Sometimes they have such characters in them. Fixes bazel-contrib#2799 Co-authored-by: Richard Levasseur <rlevasseur@google.com> (cherry picked from commit e14cd37)
1 parent 079bea3 commit 7dd901c
Copy full SHA for 7dd901c

File tree

Expand file treeCollapse file tree

2 files changed

+13
-1
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+13
-1
lines changed

‎python/private/pypi/whl_repo_name.bzl

Copy file name to clipboardExpand all lines: python/private/pypi/whl_repo_name.bzl
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def whl_repo_name(filename, sha256):
4444
else:
4545
parsed = parse_whl_name(filename)
4646
name = normalize_name(parsed.distribution)
47-
version = parsed.version.replace(".", "_").replace("!", "_")
47+
version = parsed.version.replace(".", "_").replace("!", "_").replace("+", "_").replace("%", "_")
4848
python_tag, _, _ = parsed.python_tag.partition(".")
4949
abi_tag, _, _ = parsed.abi_tag.partition(".")
5050
platform_tag, _, _ = parsed.platform_tag.partition(".")

‎tests/pypi/whl_repo_name/whl_repo_name_tests.bzl

Copy file name to clipboardExpand all lines: tests/pypi/whl_repo_name/whl_repo_name_tests.bzl
+12Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,18 @@ def _test_platform_whl(env):
5454

5555
_tests.append(_test_platform_whl)
5656

57+
def _test_name_with_plus(env):
58+
got = whl_repo_name("gptqmodel-2.0.0+cu126torch2.6-cp312-cp312-linux_x86_64.whl", "")
59+
env.expect.that_str(got).equals("gptqmodel_2_0_0_cu126torch2_6_cp312_cp312_linux_x86_64")
60+
61+
_tests.append(_test_name_with_plus)
62+
63+
def _test_name_with_percent(env):
64+
got = whl_repo_name("gptqmodel-2.0.0%2Bcu126torch2.6-cp312-cp312-linux_x86_64.whl", "")
65+
env.expect.that_str(got).equals("gptqmodel_2_0_0_2Bcu126torch2_6_cp312_cp312_linux_x86_64")
66+
67+
_tests.append(_test_name_with_percent)
68+
5769
def whl_repo_name_test_suite(name):
5870
"""Create the test suite.
5971

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.