@@ -59,13 +59,6 @@ load(":py_internal.bzl", "py_internal")
59
59
load (":py_runtime_info.bzl" , "DEFAULT_STUB_SHEBANG" , "PyRuntimeInfo" )
60
60
load (":reexports.bzl" , "BuiltinPyInfo" , "BuiltinPyRuntimeInfo" )
61
61
load (":rule_builders.bzl" , "ruleb" )
62
- load (
63
- ":semantics.bzl" ,
64
- "ALLOWED_MAIN_EXTENSIONS" ,
65
- "BUILD_DATA_SYMLINK_PATH" ,
66
- "IS_BAZEL" ,
67
- "PY_RUNTIME_ATTR_NAME" ,
68
- )
69
62
load (
70
63
":toolchain_types.bzl" ,
71
64
"EXEC_TOOLS_TOOLCHAIN_TYPE" ,
@@ -1116,19 +1109,12 @@ def _get_runtime_details(ctx, semantics):
1116
1109
#
1117
1110
# TOOD(bazelbuild/bazel#7901): Remove this once --python_path flag is removed.
1118
1111
1119
- if IS_BAZEL :
1120
- flag_interpreter_path = ctx .fragments .bazel_py .python_path
1121
- toolchain_runtime , effective_runtime = _maybe_get_runtime_from_ctx (ctx )
1122
- if not effective_runtime :
1123
- # Clear these just in case
1124
- toolchain_runtime = None
1125
- effective_runtime = None
1126
-
1127
- else : # Google code path
1128
- flag_interpreter_path = None
1129
- toolchain_runtime , effective_runtime = _maybe_get_runtime_from_ctx (ctx )
1130
- if not effective_runtime :
1131
- fail ("Unable to find Python runtime" )
1112
+ flag_interpreter_path = ctx .fragments .bazel_py .python_path
1113
+ toolchain_runtime , effective_runtime = _maybe_get_runtime_from_ctx (ctx )
1114
+ if not effective_runtime :
1115
+ # Clear these just in case
1116
+ toolchain_runtime = None
1117
+ effective_runtime = None
1132
1118
1133
1119
if effective_runtime :
1134
1120
direct = [] # List of files
@@ -1207,7 +1193,7 @@ def _maybe_get_runtime_from_ctx(ctx):
1207
1193
effective_runtime = toolchain_runtime
1208
1194
else :
1209
1195
toolchain_runtime = None
1210
- attr_target = getattr ( ctx .attr , PY_RUNTIME_ATTR_NAME )
1196
+ attr_target = ctx .attr . _py_interpreter
1211
1197
1212
1198
# In Bazel, --python_top is null by default.
1213
1199
if attr_target and PyRuntimeInfo in attr_target :
@@ -1335,9 +1321,9 @@ def _create_runfiles_with_build_data(
1335
1321
central_uncachable_version_file ,
1336
1322
extra_write_build_data_env ,
1337
1323
)
1338
- build_data_runfiles = ctx .runfiles (symlinks = {
1339
- BUILD_DATA_SYMLINK_PATH : build_data_file ,
1340
- } )
1324
+ build_data_runfiles = ctx .runfiles (files = [
1325
+ build_data_file ,
1326
+ ] )
1341
1327
return build_data_file , build_data_runfiles
1342
1328
1343
1329
def _write_build_data (ctx , central_uncachable_version_file , extra_write_build_data_env ):
@@ -1552,7 +1538,7 @@ def determine_main(ctx):
1552
1538
"""
1553
1539
if ctx .attr .main :
1554
1540
proposed_main = ctx .attr .main .label .name
1555
- if not proposed_main .endswith (tuple ( ALLOWED_MAIN_EXTENSIONS ) ):
1541
+ if not proposed_main .endswith (".py" ):
1556
1542
fail ("main must end in '.py'" )
1557
1543
else :
1558
1544
if ctx .label .name .endswith (".py" ):
0 commit comments