@@ -17,6 +17,7 @@ load("@rules_cc//cc:cc_library.bzl", "cc_library")
1717load ("//python:py_runtime.bzl" , "py_runtime" )
1818load ("//python:py_runtime_pair.bzl" , "py_runtime_pair" )
1919load ("//python/cc:py_cc_toolchain.bzl" , "py_cc_toolchain" )
20+ load ("//python/private:config_settings.bzl" , "is_python_version_at_least" )
2021load (":py_exec_tools_toolchain.bzl" , "py_exec_tools_toolchain" )
2122load (":toolchain_types.bzl" , "EXEC_TOOLS_TOOLCHAIN_TYPE" , "PY_CC_TOOLCHAIN_TYPE" , "TARGET_TOOLCHAIN_TYPE" )
2223
@@ -38,14 +39,19 @@ def define_runtime_env_toolchain(name):
3839 """
3940 base_name = name .replace ("_toolchain" , "" )
4041
42+ supports_build_time_venv = select ({
43+ ":_is_at_least_py3.11" : True ,
44+ "//conditions:default" : False ,
45+ })
46+
4147 py_runtime (
4248 name = "_runtime_env_py3_runtime" ,
4349 interpreter = "//python/private:runtime_env_toolchain_interpreter.sh" ,
4450 python_version = "PY3" ,
4551 stub_shebang = "#!/usr/bin/env python3" ,
4652 visibility = ["//visibility:private" ],
4753 tags = ["manual" ],
48- supports_build_time_venv = False ,
54+ supports_build_time_venv = supports_build_time_venv ,
4955 )
5056
5157 # This is a dummy runtime whose interpreter_path triggers the native rule
@@ -57,7 +63,7 @@ def define_runtime_env_toolchain(name):
5763 python_version = "PY3" ,
5864 visibility = ["//visibility:private" ],
5965 tags = ["manual" ],
60- supports_build_time_venv = False ,
66+ supports_build_time_venv = supports_build_time_venv ,
6167 )
6268
6369 py_runtime_pair (
@@ -112,3 +118,7 @@ def define_runtime_env_toolchain(name):
112118 toolchain_type = PY_CC_TOOLCHAIN_TYPE ,
113119 visibility = ["//visibility:public" ],
114120 )
121+ is_python_version_at_least (
122+ name = "_is_at_least_py3.11" ,
123+ at_least = "3.11" ,
124+ )
0 commit comments