@@ -32,7 +32,6 @@ load(":simpleapi_download.bzl", "simpleapi_download")
32
32
load (":whl_config_setting.bzl" , "whl_config_setting" )
33
33
load (":whl_library.bzl" , "whl_library" )
34
34
load (":whl_repo_name.bzl" , "pypi_repo_name" , "whl_repo_name" )
35
- load (":whl_target_platforms.bzl" , "whl_target_platforms" )
36
35
37
36
def _major_minor_version (version ):
38
37
version = semver (version )
@@ -68,7 +67,6 @@ def _create_whl_repos(
68
67
* ,
69
68
pip_attr ,
70
69
whl_overrides ,
71
- evaluate_markers = evaluate_markers ,
72
70
available_interpreters = INTERPRETER_LABELS ,
73
71
get_index_urls = None ):
74
72
"""create all of the whl repositories
@@ -77,7 +75,6 @@ def _create_whl_repos(
77
75
module_ctx: {type}`module_ctx`.
78
76
pip_attr: {type}`struct` - the struct that comes from the tag class iteration.
79
77
whl_overrides: {type}`dict[str, struct]` - per-wheel overrides.
80
- evaluate_markers: the function to use to evaluate markers.
81
78
get_index_urls: A function used to get the index URLs
82
79
available_interpreters: {type}`dict[str, Label]` The dictionary of available
83
80
interpreters that have been registered using the `python` bzlmod extension.
@@ -162,14 +159,12 @@ def _create_whl_repos(
162
159
requirements_osx = pip_attr .requirements_darwin ,
163
160
requirements_windows = pip_attr .requirements_windows ,
164
161
extra_pip_args = pip_attr .extra_pip_args ,
162
+ # TODO @aignas 2025-04-15: pass the full version into here
165
163
python_version = major_minor ,
166
164
logger = logger ,
167
165
),
168
166
extra_pip_args = pip_attr .extra_pip_args ,
169
167
get_index_urls = get_index_urls ,
170
- # NOTE @aignas 2025-02-24: we will use the "cp3xx_os_arch" platform labels
171
- # for converting to the PEP508 environment and will evaluate them in starlark
172
- # without involving the interpreter at all.
173
168
evaluate_markers = evaluate_markers ,
174
169
logger = logger ,
175
170
)
@@ -191,7 +186,6 @@ def _create_whl_repos(
191
186
enable_implicit_namespace_pkgs = pip_attr .enable_implicit_namespace_pkgs ,
192
187
environment = pip_attr .environment ,
193
188
envsubst = pip_attr .envsubst ,
194
- experimental_target_platforms = pip_attr .experimental_target_platforms ,
195
189
group_deps = group_deps ,
196
190
group_name = group_name ,
197
191
pip_data_exclude = pip_attr .pip_data_exclude ,
@@ -244,6 +238,12 @@ def _create_whl_repos(
244
238
},
245
239
extra_aliases = extra_aliases ,
246
240
whl_libraries = whl_libraries ,
241
+ target_platforms = {
242
+ plat : None
243
+ for reqs in requirements_by_platform .values ()
244
+ for req in reqs
245
+ for plat in req .target_platforms
246
+ },
247
247
)
248
248
249
249
def _whl_repos (* , requirement , whl_library_args , download_only , netrc , auth_patterns , multiple_requirements_for_whl = False , python_version ):
@@ -274,20 +274,11 @@ def _whl_repos(*, requirement, whl_library_args, download_only, netrc, auth_patt
274
274
args ["urls" ] = [distribution .url ]
275
275
args ["sha256" ] = distribution .sha256
276
276
args ["filename" ] = distribution .filename
277
- args ["experimental_target_platforms" ] = requirement .target_platforms
278
277
279
278
# Pure python wheels or sdists may need to have a platform here
280
279
target_platforms = None
281
280
if distribution .filename .endswith (".whl" ) and not distribution .filename .endswith ("-any.whl" ):
282
- parsed_whl = parse_whl_name (distribution .filename )
283
- whl_platforms = whl_target_platforms (
284
- platform_tag = parsed_whl .platform_tag ,
285
- )
286
- args ["experimental_target_platforms" ] = [
287
- p
288
- for p in requirement .target_platforms
289
- if [None for wp in whl_platforms if p .endswith (wp .target_platform )]
290
- ]
281
+ pass
291
282
elif multiple_requirements_for_whl :
292
283
target_platforms = requirement .target_platforms
293
284
@@ -416,6 +407,7 @@ You cannot use both the additive_build_content and additive_build_content_file a
416
407
hub_group_map = {}
417
408
exposed_packages = {}
418
409
extra_aliases = {}
410
+ target_platforms = {}
419
411
whl_libraries = {}
420
412
421
413
for mod in module_ctx .modules :
@@ -498,6 +490,7 @@ You cannot use both the additive_build_content and additive_build_content_file a
498
490
for whl_name , aliases in out .extra_aliases .items ():
499
491
extra_aliases [hub_name ].setdefault (whl_name , {}).update (aliases )
500
492
exposed_packages .setdefault (hub_name , {}).update (out .exposed_packages )
493
+ target_platforms .setdefault (hub_name , {}).update (out .target_platforms )
501
494
whl_libraries .update (out .whl_libraries )
502
495
503
496
# TODO @aignas 2024-04-05: how do we support different requirement
@@ -535,6 +528,10 @@ You cannot use both the additive_build_content and additive_build_content_file a
535
528
}
536
529
for hub_name , extra_whl_aliases in extra_aliases .items ()
537
530
},
531
+ target_platforms = {
532
+ hub_name : sorted (p )
533
+ for hub_name , p in target_platforms .items ()
534
+ },
538
535
whl_libraries = {
539
536
k : dict (sorted (args .items ()))
540
537
for k , args in sorted (whl_libraries .items ())
@@ -626,15 +623,13 @@ def _pip_impl(module_ctx):
626
623
},
627
624
packages = mods .exposed_packages .get (hub_name , []),
628
625
groups = mods .hub_group_map .get (hub_name ),
626
+ target_platforms = mods .target_platforms .get (hub_name , []),
629
627
)
630
628
631
629
if bazel_features .external_deps .extension_metadata_has_reproducible :
632
- # If we are not using the `experimental_index_url feature, the extension is fully
633
- # deterministic and we don't need to create a lock entry for it.
634
- #
635
- # In order to be able to dogfood the `experimental_index_url` feature before it gets
636
- # stabilized, we have created the `_pip_non_reproducible` function, that will result
637
- # in extra entries in the lock file.
630
+ # NOTE @aignas 2025-04-15: this is set to be reproducible, because the
631
+ # results after calling the PyPI index should be reproducible on each
632
+ # machine.
638
633
return module_ctx .extension_metadata (reproducible = True )
639
634
else :
640
635
return None
0 commit comments