@@ -26,6 +26,7 @@ load("//python/private:auth.bzl", "AUTH_ATTRS")
26
26
load ("//python/private:normalize_name.bzl" , "normalize_name" )
27
27
load ("//python/private:parse_requirements.bzl" , "host_platform" , "parse_requirements" , "select_requirement" )
28
28
load ("//python/private:parse_whl_name.bzl" , "parse_whl_name" )
29
+ load ("//python/private:pip_repo_name.bzl" , "pip_repo_name" )
29
30
load ("//python/private:pypi_index.bzl" , "simpleapi_download" )
30
31
load ("//python/private:render_pkg_aliases.bzl" , "whl_alias" )
31
32
load ("//python/private:repo_utils.bzl" , "repo_utils" )
@@ -260,7 +261,7 @@ def _create_whl_repos(module_ctx, pip_attr, whl_map, whl_overrides, group_map, s
260
261
# This is no-op because pip is not used to download the wheel.
261
262
whl_library_args .pop ("download_only" , None )
262
263
263
- repo_name = _repo_name (pip_name , distribution .filename )
264
+ repo_name = pip_repo_name (pip_name , distribution .filename , distribution . sha256 )
264
265
whl_library_args ["requirement" ] = requirement .srcs .requirement
265
266
whl_library_args ["urls" ] = [distribution .url ]
266
267
whl_library_args ["sha256" ] = distribution .sha256
@@ -317,21 +318,6 @@ def _create_whl_repos(module_ctx, pip_attr, whl_map, whl_overrides, group_map, s
317
318
),
318
319
)
319
320
320
- def _repo_name (prefix , filename ):
321
- if not filename .endswith (".whl" ):
322
- # Then the filename is basically foo-3.2.1.<ext>
323
- name = normalize_name (filename )
324
- else :
325
- parsed = parse_whl_name (filename )
326
- name = "{}_{}_{}_{}_{}" .format (
327
- parsed .distribution ,
328
- parsed .version ,
329
- parsed .python_tag ,
330
- parsed .abi_tag ,
331
- parsed .platform_tag ,
332
- )
333
- return "{}__{}" .format (prefix , normalize_name (name ))
334
-
335
321
def _pip_impl (module_ctx ):
336
322
"""Implementation of a class tag that creates the pip hub and corresponding pip spoke whl repositories.
337
323
0 commit comments