@@ -17,6 +17,7 @@ load("@rules_cc//cc:cc_library.bzl", "cc_library")
17
17
load ("//python:py_runtime.bzl" , "py_runtime" )
18
18
load ("//python:py_runtime_pair.bzl" , "py_runtime_pair" )
19
19
load ("//python/cc:py_cc_toolchain.bzl" , "py_cc_toolchain" )
20
+ load ("//python/private:config_settings.bzl" , "is_python_version_at_least" )
20
21
load (":py_exec_tools_toolchain.bzl" , "py_exec_tools_toolchain" )
21
22
load (":toolchain_types.bzl" , "EXEC_TOOLS_TOOLCHAIN_TYPE" , "PY_CC_TOOLCHAIN_TYPE" , "TARGET_TOOLCHAIN_TYPE" )
22
23
@@ -38,14 +39,19 @@ def define_runtime_env_toolchain(name):
38
39
"""
39
40
base_name = name .replace ("_toolchain" , "" )
40
41
42
+ supports_build_time_venv = select ({
43
+ ":_is_at_least_py3.11" : True ,
44
+ "//conditions:default" : False ,
45
+ })
46
+
41
47
py_runtime (
42
48
name = "_runtime_env_py3_runtime" ,
43
49
interpreter = "//python/private:runtime_env_toolchain_interpreter.sh" ,
44
50
python_version = "PY3" ,
45
51
stub_shebang = "#!/usr/bin/env python3" ,
46
52
visibility = ["//visibility:private" ],
47
53
tags = ["manual" ],
48
- supports_build_time_venv = False ,
54
+ supports_build_time_venv = supports_build_time_venv ,
49
55
)
50
56
51
57
# This is a dummy runtime whose interpreter_path triggers the native rule
@@ -57,7 +63,7 @@ def define_runtime_env_toolchain(name):
57
63
python_version = "PY3" ,
58
64
visibility = ["//visibility:private" ],
59
65
tags = ["manual" ],
60
- supports_build_time_venv = False ,
66
+ supports_build_time_venv = supports_build_time_venv ,
61
67
)
62
68
63
69
py_runtime_pair (
@@ -112,3 +118,7 @@ def define_runtime_env_toolchain(name):
112
118
toolchain_type = PY_CC_TOOLCHAIN_TYPE ,
113
119
visibility = ["//visibility:public" ],
114
120
)
121
+ is_python_version_at_least (
122
+ name = "_is_at_least_py3.11" ,
123
+ at_least = "3.11" ,
124
+ )
0 commit comments