27
27
)
28
28
load ("@rules_python//python/pip_install:requirements_parser.bzl" , parse_requirements = "parse" )
29
29
load ("//python/private:normalize_name.bzl" , "normalize_name" )
30
+ load ("//python/private:version_label.bzl" , "version_label" )
30
31
31
32
def _whl_mods_impl (mctx ):
32
33
"""Implementation of the pip.whl_mods tag class.
@@ -84,7 +85,7 @@ def _create_versioned_pip_and_whl_repos(module_ctx, pip_attr, whl_map):
84
85
# we programtically find it.
85
86
hub_name = pip_attr .hub_name
86
87
if python_interpreter_target == None :
87
- python_name = "python_{}" . format (pip_attr .python_version . replace ( "." , "_" ) )
88
+ python_name = "python_" + version_label (pip_attr .python_version , sep = "_" )
88
89
if python_name not in INTERPRETER_LABELS .keys ():
89
90
fail ((
90
91
"Unable to find interpreter for pip hub '{hub_name}' for " +
@@ -96,7 +97,10 @@ def _create_versioned_pip_and_whl_repos(module_ctx, pip_attr, whl_map):
96
97
))
97
98
python_interpreter_target = INTERPRETER_LABELS [python_name ]
98
99
99
- pip_name = hub_name + "_{}" .format (pip_attr .python_version .replace ("." , "" ))
100
+ pip_name = "{}_{}" .format (
101
+ hub_name ,
102
+ version_label (pip_attr .python_version ),
103
+ )
100
104
requrements_lock = locked_requirements_label (module_ctx , pip_attr )
101
105
102
106
# Parse the requirements file directly in starlark to get the information
0 commit comments