@@ -358,6 +358,12 @@ def _whl_library_impl(rctx):
358358 enable_pipstar = (rp_config .enable_pipstar or whl_path ) and rctx .attr .config_load
359359 enable_pipstar_extract = enable_pipstar and rp_config .bazel_8_or_later
360360
361+ if enable_pipstar_extract :
362+ environment = {}
363+ else :
364+ # Manually construct the PYTHONPATH since we cannot use the toolchain here
365+ environment = _create_repository_execution_environment (rctx , python_interpreter , logger = logger )
366+
361367 if not whl_path :
362368 if rctx .attr .urls :
363369 op_tmpl = "whl_library.BuildWheelFromSource({name}, {requirement})"
@@ -374,8 +380,7 @@ def _whl_library_impl(rctx):
374380 python = python_interpreter ,
375381 op = op_tmpl .format (name = rctx .attr .name , requirement = rctx .attr .requirement .split (" " , 1 )[0 ]),
376382 arguments = args ,
377- # Manually construct the PYTHONPATH since we cannot use the toolchain here
378- environment = _create_repository_execution_environment (rctx , python_interpreter , logger = logger ),
383+ environment = environment ,
379384 srcs = rctx .attr ._python_srcs ,
380385 quiet = rctx .attr .quiet ,
381386 timeout = rctx .attr .timeout ,
@@ -412,8 +417,7 @@ def _whl_library_impl(rctx):
412417 python_interpreter = python_interpreter ,
413418 args = args ,
414419 whl_path = whl_path ,
415- # Manually construct the PYTHONPATH since we cannot use the toolchain here
416- environment = _create_repository_execution_environment (rctx , python_interpreter , logger = logger ),
420+ environment = environment ,
417421 logger = logger ,
418422 )
419423
0 commit comments