@@ -35,7 +35,8 @@ Sharing model:
3535load ("//py/private:providers.bzl" , "PyWheelsInfo" )
3636load ("//py/private:py_info.bzl" , "PyInfo" )
3737load ("//py/private:py_info_interop.bzl" , "has_py_info" )
38- load ("//py/private/toolchain:types.bzl" , "PY_TOOLCHAIN" )
38+ load ("//py/private/py_venv:types.bzl" , "PY_VENV_KINDS" )
39+ load ("//py/private/toolchain:types.bzl" , "PY_TOOLCHAIN" , "interpreter_files_and_version" )
3940
4041_TAR_TOOLCHAIN = "@tar.bzl//tar/toolchain:type"
4142
@@ -182,8 +183,6 @@ _LayerInfo = provider(
182183 },
183184)
184185
185- _PY_VENV_KINDS = ("py_venv" , "_py_venv" , "_py_venv_lib" )
186-
187186def _collect_from_deps (ctx , provider ):
188187 """Walk deps/data/actual/venv and return a list of provider values from each matching dep."""
189188 results = []
@@ -307,11 +306,9 @@ def _layer_aspect_impl(target, ctx):
307306 # (NOT ctx.toolchains) is how the binary reads it back, which correctly
308307 # follows the binary's target-platform transition.
309308 if platform_common .ToolchainInfo in target :
310- py3 = getattr (target [ platform_common . ToolchainInfo ], "py3_runtime" , None )
311- if py3 == None or py3 . files == None :
309+ interp_depset , _ = interpreter_files_and_version (target )
310+ if interp_depset == None :
312311 return []
313- direct = [py3 .interpreter ] if getattr (py3 , "interpreter" , None ) != None else []
314- interp_depset = depset (direct = direct , transitive = [py3 .files ])
315312 plan = ctx .attr ._layer_tier [PyLayerTierInfo ]
316313 interp_group = plan .interpreter_group
317314 interp_layer = None
@@ -399,7 +396,7 @@ def _layer_aspect_impl(target, ctx):
399396
400397 # Skip PyInfo deps (including wheel-leaf targets, which also emit PyInfo) —
401398 # they self-capture via the aspect.
402- if kind not in _PY_VENV_KINDS and has_py_info (target ) and not is_binary :
399+ if kind not in PY_VENV_KINDS and has_py_info (target ) and not is_binary :
403400 own_parts = [target [DefaultInfo ].files ]
404401 for attr_name in ("data" , "deps" ):
405402 attr_val = getattr (ctx .rule .attr , attr_name , None )
@@ -424,7 +421,7 @@ def _layer_aspect_impl(target, ctx):
424421 else :
425422 own_source .append (own_depset )
426423
427- if kind in _PY_VENV_KINDS :
424+ if kind in PY_VENV_KINDS :
428425 if PY_TOOLCHAIN in ctx .rule .toolchains :
429426 py_tc = ctx .rule .toolchains [PY_TOOLCHAIN ]
430427 if _LayerInfo in py_tc :
0 commit comments