@@ -32,7 +32,6 @@ load(":simpleapi_download.bzl", "simpleapi_download")
3232load (":whl_config_setting.bzl" , "whl_config_setting" )
3333load (":whl_library.bzl" , "whl_library" )
3434load (":whl_repo_name.bzl" , "pypi_repo_name" , "whl_repo_name" )
35- load (":whl_target_platforms.bzl" , "whl_target_platforms" )
3635
3736def _major_minor_version (version ):
3837 version = semver (version )
@@ -68,7 +67,6 @@ def _create_whl_repos(
6867 * ,
6968 pip_attr ,
7069 whl_overrides ,
71- evaluate_markers = evaluate_markers ,
7270 available_interpreters = INTERPRETER_LABELS ,
7371 get_index_urls = None ):
7472 """create all of the whl repositories
@@ -77,7 +75,6 @@ def _create_whl_repos(
7775 module_ctx: {type}`module_ctx`.
7876 pip_attr: {type}`struct` - the struct that comes from the tag class iteration.
7977 whl_overrides: {type}`dict[str, struct]` - per-wheel overrides.
80- evaluate_markers: the function to use to evaluate markers.
8178 get_index_urls: A function used to get the index URLs
8279 available_interpreters: {type}`dict[str, Label]` The dictionary of available
8380 interpreters that have been registered using the `python` bzlmod extension.
@@ -162,14 +159,12 @@ def _create_whl_repos(
162159 requirements_osx = pip_attr .requirements_darwin ,
163160 requirements_windows = pip_attr .requirements_windows ,
164161 extra_pip_args = pip_attr .extra_pip_args ,
162+ # TODO @aignas 2025-04-15: pass the full version into here
165163 python_version = major_minor ,
166164 logger = logger ,
167165 ),
168166 extra_pip_args = pip_attr .extra_pip_args ,
169167 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.
173168 evaluate_markers = evaluate_markers ,
174169 logger = logger ,
175170 )
@@ -191,7 +186,6 @@ def _create_whl_repos(
191186 enable_implicit_namespace_pkgs = pip_attr .enable_implicit_namespace_pkgs ,
192187 environment = pip_attr .environment ,
193188 envsubst = pip_attr .envsubst ,
194- experimental_target_platforms = pip_attr .experimental_target_platforms ,
195189 group_deps = group_deps ,
196190 group_name = group_name ,
197191 pip_data_exclude = pip_attr .pip_data_exclude ,
@@ -244,6 +238,12 @@ def _create_whl_repos(
244238 },
245239 extra_aliases = extra_aliases ,
246240 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+ },
247247 )
248248
249249def _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
274274 args ["urls" ] = [distribution .url ]
275275 args ["sha256" ] = distribution .sha256
276276 args ["filename" ] = distribution .filename
277- args ["experimental_target_platforms" ] = requirement .target_platforms
278277
279278 # Pure python wheels or sdists may need to have a platform here
280279 target_platforms = None
281280 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
291282 elif multiple_requirements_for_whl :
292283 target_platforms = requirement .target_platforms
293284
@@ -416,6 +407,7 @@ You cannot use both the additive_build_content and additive_build_content_file a
416407 hub_group_map = {}
417408 exposed_packages = {}
418409 extra_aliases = {}
410+ target_platforms = {}
419411 whl_libraries = {}
420412
421413 for mod in module_ctx .modules :
@@ -498,6 +490,7 @@ You cannot use both the additive_build_content and additive_build_content_file a
498490 for whl_name , aliases in out .extra_aliases .items ():
499491 extra_aliases [hub_name ].setdefault (whl_name , {}).update (aliases )
500492 exposed_packages .setdefault (hub_name , {}).update (out .exposed_packages )
493+ target_platforms .setdefault (hub_name , {}).update (out .target_platforms )
501494 whl_libraries .update (out .whl_libraries )
502495
503496 # 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
535528 }
536529 for hub_name , extra_whl_aliases in extra_aliases .items ()
537530 },
531+ target_platforms = {
532+ hub_name : sorted (p )
533+ for hub_name , p in target_platforms .items ()
534+ },
538535 whl_libraries = {
539536 k : dict (sorted (args .items ()))
540537 for k , args in sorted (whl_libraries .items ())
@@ -626,15 +623,13 @@ def _pip_impl(module_ctx):
626623 },
627624 packages = mods .exposed_packages .get (hub_name , []),
628625 groups = mods .hub_group_map .get (hub_name ),
626+ target_platforms = mods .target_platforms .get (hub_name , []),
629627 )
630628
631629 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.
638633 return module_ctx .extension_metadata (reproducible = True )
639634 else :
640635 return None
0 commit comments