Skip to content

Commit 8d418f4

Browse files
committed
adjust the code so that the experimental_target_platforms is set in download_only case
1 parent 0d468df commit 8d418f4

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

docs/pypi-dependencies.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -348,12 +348,6 @@ pip.parse(
348348
"requirements.linux_x86_64.txt": "linux_x86_64",
349349
"requirements.osx_aarch64.txt": "osx_aarch64",
350350
},
351-
# We need to set these values to ensure that the METADATA is
352-
# correctly parsed after downloading wheels.
353-
experimental_target_platforms = [
354-
"cp39_linux_x86_64",
355-
"cp39_osx_aarch64",
356-
],
357351
)
358352
```
359353

examples/bzlmod/MODULE.bazel.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

python/private/pypi/extension.bzl

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -323,9 +323,12 @@ def _create_whl_repos(
323323
if get_index_urls:
324324
logger.warn(lambda: "falling back to pip for installing the right file for {}".format(requirement.requirement_line))
325325

326-
whl_library_args["requirement"] = requirement.requirement_line
326+
args = dict(whl_library_args.items()) # make a copy
327+
args["requirement"] = requirement.requirement_line
327328
if requirement.extra_pip_args:
328-
whl_library_args["extra_pip_args"] = requirement.extra_pip_args
329+
args["extra_pip_args"] = requirement.extra_pip_args
330+
if pip_attr.download_only:
331+
args.setdefault("experimental_target_platforms", requirement.target_platforms)
329332

330333
repo_name = "{}_{}".format(pip_name, whl_name)
331334
if len(requirements) > 1:
@@ -334,7 +337,7 @@ def _create_whl_repos(
334337
for p in requirement.target_platforms
335338
])))
336339

337-
whl_libraries[repo_name] = dict(whl_library_args.items())
340+
whl_libraries[repo_name] = args
338341
whl_map.setdefault(whl_name, []).append(
339342
whl_alias(
340343
repo = repo_name,

tests/pypi/extension/extension_tests.bzl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,7 @@ simple==0.0.3 --hash=sha256:deadbaaf
321321
"pypi_315_extra": {
322322
"dep_template": "@pypi//{name}:{target}",
323323
"download_only": True,
324+
"experimental_target_platforms": ["cp315_linux_x86_64"],
324325
"extra_pip_args": ["--platform=manylinux_2_17_x86_64", "--python-version=315", "--implementation=cp", "--abi=cp315"],
325326
"python_interpreter_target": "unit_test_interpreter_target",
326327
"repo": "pypi_315",
@@ -329,6 +330,7 @@ simple==0.0.3 --hash=sha256:deadbaaf
329330
"pypi_315_simple__linux_x86_64": {
330331
"dep_template": "@pypi//{name}:{target}",
331332
"download_only": True,
333+
"experimental_target_platforms": ["cp315_linux_x86_64"],
332334
"extra_pip_args": ["--platform=manylinux_2_17_x86_64", "--python-version=315", "--implementation=cp", "--abi=cp315"],
333335
"python_interpreter_target": "unit_test_interpreter_target",
334336
"repo": "pypi_315",
@@ -337,6 +339,7 @@ simple==0.0.3 --hash=sha256:deadbaaf
337339
"pypi_315_simple__osx_aarch64": {
338340
"dep_template": "@pypi//{name}:{target}",
339341
"download_only": True,
342+
"experimental_target_platforms": ["cp315_osx_aarch64"],
340343
"extra_pip_args": ["--platform=macosx_10_9_arm64", "--python-version=315", "--implementation=cp", "--abi=cp315"],
341344
"python_interpreter_target": "unit_test_interpreter_target",
342345
"repo": "pypi_315",

0 commit comments

Comments
 (0)