@@ -23,7 +23,6 @@ load("//python/private:full_version.bzl", "full_version")
2323load ("//python/private:normalize_name.bzl" , "normalize_name" )
2424load ("//python/private:repo_utils.bzl" , "repo_utils" )
2525load ("//python/private:version.bzl" , "version" )
26- load ("//python/private:version_label.bzl" , "version_label" )
2726load (":attrs.bzl" , "use_isolated" )
2827load (":evaluate_markers.bzl" , "evaluate_markers_py" , EVALUATE_MARKERS_SRCS = "SRCS" , evaluate_markers_star = "evaluate_markers" )
2928load (":hub_builder.bzl" , "hub_builder" )
@@ -106,14 +105,6 @@ def _create_whl_repos(
106105 whl_name : {alias : True for alias in aliases }
107106 for whl_name , aliases in pip_attr .extra_hub_aliases .items ()
108107 }
109- whl_libraries = {}
110-
111- # TODO @aignas 2025-06-29: we should not need the version in the pip_name if
112- # we are using pipstar and we are downloading the wheel using the downloader
113- pip_name = "{}_{}" .format (
114- hub .name ,
115- version_label (pip_attr .python_version ),
116- )
117108
118109 whl_modifications = {}
119110 if pip_attr .whl_modifications != None :
@@ -264,47 +255,15 @@ def _create_whl_repos(
264255 is_multiple_versions = whl .is_multiple_versions ,
265256 enable_pipstar = hub .config .enable_pipstar ,
266257 )
267- if repo == None :
268- # NOTE @aignas 2025-07-07: we guard against an edge-case where there
269- # are more platforms defined than there are wheels for and users
270- # disallow building from sdist.
271- continue
272-
273- repo_name = "{}_{}" .format (pip_name , repo .repo_name )
274- if repo_name in whl_libraries :
275- fail ("attempting to create a duplicate library {} for {}" .format (
276- repo_name ,
277- whl .name ,
278- ))
279- whl_libraries [repo_name ] = repo .args
280-
281- if not hub .config .enable_pipstar and "experimental_target_platforms" in repo .args :
282- whl_libraries [repo_name ] |= {
283- "experimental_target_platforms" : sorted ({
284- # TODO @aignas 2025-07-07: this should be solved in a better way
285- platforms [candidate ].triple .partition ("_" )[- 1 ]: None
286- for p in repo .args ["experimental_target_platforms" ]
287- for candidate in platforms
288- if candidate .endswith (p )
289- }),
290- }
291-
292- mapping = hub .whl_map .setdefault (whl .name , {})
293- if repo .config_setting in mapping and mapping [repo .config_setting ] != repo_name :
294- fail (
295- "attempting to override an existing repo '{}' for config setting '{}' with a new repo '{}'" .format (
296- mapping [repo .config_setting ],
297- repo .config_setting ,
298- repo_name ,
299- ),
300- )
301- else :
302- mapping [repo .config_setting ] = repo_name
258+ hub .add_whl_library (
259+ python_version = pip_attr .python_version ,
260+ whl = whl ,
261+ repo = repo ,
262+ )
303263
304264 return struct (
305265 exposed_packages = exposed_packages ,
306266 extra_aliases = extra_aliases ,
307- whl_libraries = whl_libraries ,
308267 )
309268
310269def _whl_repo (
@@ -631,15 +590,6 @@ You cannot use both the additive_build_content and additive_build_content_file a
631590 continue
632591 intersection [pkg ] = None
633592 exposed_packages [hub_name ] = intersection
634- whl_libraries .update (out .whl_libraries )
635- for whl_name , lib in out .whl_libraries .items ():
636- if enable_pipstar :
637- whl_libraries .setdefault (whl_name , lib )
638- elif whl_name in lib :
639- fail ("'{}' already in created" .format (whl_name ))
640- else :
641- # replicate whl_libraries.update(out.whl_libraries)
642- whl_libraries [whl_name ] = lib
643593
644594 # TODO @aignas 2024-04-05: how do we support different requirement
645595 # cycles for different abis/oses? For now we will need the users to
@@ -653,6 +603,14 @@ You cannot use both the additive_build_content and additive_build_content_file a
653603 for setting , repo in settings .items ():
654604 hub_whl_map [hub .name ].setdefault (key , {}).setdefault (repo , []).append (setting )
655605
606+ whl_libraries .update (hub .whl_libraries )
607+ for whl_name , lib in hub .whl_libraries .items ():
608+ if whl_name in lib :
609+ fail ("'{}' already in created" .format (whl_name ))
610+ else :
611+ # replicate whl_libraries.update(out.whl_libraries)
612+ whl_libraries [whl_name ] = lib
613+
656614 return struct (
657615 # We sort so that the lock-file remains the same no matter the order of how the
658616 # args are manipulated in the code going before.
0 commit comments