Skip to content

Commit 6d08795

Browse files
committed
Make target_platforms a keyword argument
The `pypi_repo_name` function was using `*target_platforms` to accept a variable number of positional arguments. This is changed to a keyword argument `target_platforms` with a default value of empty string, making the function signature more explicit and the call site clearer.
1 parent 66a76df commit 6d08795

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

python/private/pypi/extension.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ def _whl_repo(
420420
return struct(
421421
repo_name = pypi_repo_name(
422422
normalize_name(src.distribution),
423-
*target_platforms
423+
target_platforms = target_platforms,
424424
),
425425
args = args,
426426
config_setting = whl_config_setting(

python/private/pypi/whl_repo_name.bzl

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,19 +61,17 @@ def whl_repo_name(filename, sha256):
6161

6262
return "_".join(parts)
6363

64-
def pypi_repo_name(whl_name, *target_platforms):
64+
def pypi_repo_name(whl_name, target_platforms=[]):
6565
"""Return a valid whl_library given a requirement line.
6666
6767
Args:
6868
whl_name: {type}`str` the whl_name to use.
69-
*target_platforms: {type}`list[str]` the target platforms to use in the name.
69+
target_platforms: {type}`list[str]` the target platforms to use in the name.
7070
7171
Returns:
7272
{type}`str` that can be used in {obj}`whl_library`.
7373
"""
74-
parts = [
75-
normalize_name(whl_name),
76-
]
74+
parts = [normalize_name(whl_name)]
7775
parts.extend([p.partition("_")[-1] for p in target_platforms])
7876

7977
return "_".join(parts)

0 commit comments

Comments
 (0)