@@ -144,8 +144,8 @@ def _build(self):
144144 whl_libraries = self ._whl_libraries ,
145145 )
146146
147- def _pip_parse (self , module_ctx , pip_attr ):
148- python_version = pip_attr .python_version
147+ def _pip_parse (self , module_ctx , pip_attr , python_version = None ):
148+ python_version = python_version or pip_attr .python_version
149149 if python_version in self ._platforms :
150150 fail ((
151151 "Duplicate pip python version '{version}' for hub " +
@@ -191,7 +191,8 @@ def _pip_parse(self, module_ctx, pip_attr):
191191 self ,
192192 module_ctx ,
193193 pip_attr = pip_attr ,
194- enable_pipstar_extract = bool (self ._config .enable_pipstar_extract or self ._get_index_urls .get (pip_attr .python_version )),
194+ python_version = python_version ,
195+ enable_pipstar_extract = bool (self ._config .enable_pipstar_extract or self ._get_index_urls .get (python_version )),
195196 )
196197
197198### end of PUBLIC methods
@@ -393,11 +394,11 @@ def _set_get_index_urls(self, mctx, pip_attr):
393394 )
394395 return True
395396
396- def _detect_interpreter (self , pip_attr ):
397+ def _detect_interpreter (self , pip_attr , python_version ):
397398 python_interpreter_target = pip_attr .python_interpreter_target
398399 if python_interpreter_target == None and not pip_attr .python_interpreter :
399400 python_name = "python_{}_host" .format (
400- pip_attr . python_version .replace ("." , "_" ),
401+ python_version .replace ("." , "_" ),
401402 )
402403 if python_name not in self ._available_interpreters :
403404 fail ((
@@ -407,7 +408,7 @@ def _detect_interpreter(self, pip_attr):
407408 "Expected to find {python_name} among registered versions:\n {labels}"
408409 ).format (
409410 hub_name = self .name ,
410- version = pip_attr . python_version ,
411+ version = python_version ,
411412 python_name = python_name ,
412413 labels = " \n " .join (self ._available_interpreters ),
413414 ))
@@ -476,17 +477,19 @@ def _create_whl_repos(
476477 module_ctx ,
477478 * ,
478479 pip_attr ,
480+ python_version ,
479481 enable_pipstar_extract = False ):
480482 """create all of the whl repositories
481483
482484 Args:
483485 self: the builder.
484486 module_ctx: {type}`module_ctx`.
485487 pip_attr: {type}`struct` - the struct that comes from the tag class iteration.
488+ python_version: {type}`str` - the resolved python version for this pip.parse call.
486489 enable_pipstar_extract: {type}`bool` - enable the pipstar extraction or not.
487490 """
488491 logger = self ._logger
489- platforms = self ._platforms [pip_attr . python_version ]
492+ platforms = self ._platforms [python_version ]
490493 requirements_by_platform = parse_requirements (
491494 module_ctx ,
492495 requirements_by_platform = requirements_files_by_platform (
@@ -498,7 +501,7 @@ def _create_whl_repos(
498501 extra_pip_args = pip_attr .extra_pip_args ,
499502 platforms = sorted (platforms ), # here we only need keys
500503 python_version = full_version (
501- version = pip_attr . python_version ,
504+ version = python_version ,
502505 minor_mapping = self ._minor_mapping ,
503506 ),
504507 logger = logger ,
@@ -528,7 +531,7 @@ def _create_whl_repos(
528531 pip_attr = pip_attr ,
529532 )
530533
531- interpreter = _detect_interpreter (self , pip_attr )
534+ interpreter = _detect_interpreter (self , pip_attr , python_version )
532535
533536 for whl in requirements_by_platform :
534537 whl_library_args = common_args | _whl_library_args (
@@ -543,16 +546,16 @@ def _create_whl_repos(
543546 whl_library_args = whl_library_args ,
544547 download_only = pip_attr .download_only ,
545548 netrc = self ._config .netrc or pip_attr .netrc ,
546- use_downloader = src .url and _use_downloader (self , pip_attr . python_version , whl .name ),
549+ use_downloader = src .url and _use_downloader (self , python_version , whl .name ),
547550 auth_patterns = self ._config .auth_patterns or pip_attr .auth_patterns ,
548- python_version = _major_minor_version (pip_attr . python_version ),
551+ python_version = _major_minor_version (python_version ),
549552 is_multiple_versions = whl .is_multiple_versions ,
550553 interpreter = interpreter ,
551554 enable_pipstar_extract = enable_pipstar_extract ,
552555 )
553556 _add_whl_library (
554557 self ,
555- python_version = pip_attr . python_version ,
558+ python_version = python_version ,
556559 whl = whl ,
557560 repo = repo ,
558561 )
0 commit comments