@@ -20,7 +20,7 @@ load("@pythons_hub//:versions.bzl", "DEFAULT_PYTHON_VERSION", "MINOR_MAPPING")
2020load ("//python:py_binary.bzl" , "py_binary" )
2121load ("//python/private:bzlmod_enabled.bzl" , "BZLMOD_ENABLED" ) # buildifier: disable=bzl-visibility
2222load ("//python/private:full_version.bzl" , "full_version" )
23- load ("//python/private:toolchain_types.bzl" , "TARGET_TOOLCHAIN_TYPE " ) # buildifier: disable=bzl-visibility
23+ load ("//python/private:toolchain_types.bzl" , "EXEC_TOOLS_TOOLCHAIN_TYPE " ) # buildifier: disable=bzl-visibility
2424load (":toolchain_types.bzl" , "UV_TOOLCHAIN_TYPE" )
2525
2626visibility (["//..." ])
@@ -83,7 +83,7 @@ def _lock_impl(ctx):
8383 toolchain_info = ctx .toolchains [UV_TOOLCHAIN_TYPE ]
8484 uv = toolchain_info .uv_toolchain_info .uv [DefaultInfo ].files_to_run .executable
8585
86- py_runtime = ctx .toolchains [TARGET_TOOLCHAIN_TYPE ]. py3_runtime
86+ interpreter = ctx .toolchains [EXEC_TOOLS_TOOLCHAIN_TYPE ]. exec_tools . exec_interpreter [ DefaultInfo ]
8787
8888 args = _args (ctx )
8989 args .add_all ([
@@ -104,7 +104,7 @@ def _lock_impl(ctx):
104104 args .add_all (ctx .files .constraints , before_each = "--constraints" )
105105 args .add_all (ctx .attr .args )
106106
107- python = py_runtime . interpreter if py_runtime . interpreter else py_runtime . interpreter_path
107+ python = interpreter . files_to_run . executable or "python"
108108 args .add ("--python" , python )
109109 args .add_all (srcs )
110110
@@ -134,7 +134,10 @@ def _lock_impl(ctx):
134134 mnemonic = "PyRequirementsLockUv" ,
135135 outputs = [output ],
136136 arguments = [args .run_shell ],
137- tools = [uv ],
137+ tools = [
138+ uv ,
139+ interpreter .files_to_run ,
140+ ],
138141 progress_message = "Creating a requirements.txt with uv: //{}:{}" .format (
139142 ctx .label .package ,
140143 ctx .label .name ,
@@ -149,9 +152,7 @@ def _lock_impl(ctx):
149152 env = ctx .attr .env ,
150153 srcs = depset (
151154 srcs + [uv ] + ctx .files .build_constraints + ctx .files .constraints ,
152- transitive = [
153- py_runtime .files ,
154- ],
155+ transitive = [interpreter .files ],
155156 ),
156157 ),
157158 ]
@@ -240,9 +241,8 @@ The string to input for the 'uv pip compile'.
240241 ),
241242 },
242243 toolchains = [
244+ EXEC_TOOLS_TOOLCHAIN_TYPE ,
243245 UV_TOOLCHAIN_TYPE ,
244- # FIXME @aignas 2025-03-17: should this be instead EXEC_TOOLCHAIN_TYPE?
245- TARGET_TOOLCHAIN_TYPE ,
246246 ],
247247 cfg = _python_version_transition ,
248248)
0 commit comments