@@ -59,13 +59,6 @@ load(":py_internal.bzl", "py_internal")
5959load (":py_runtime_info.bzl" , "DEFAULT_STUB_SHEBANG" , "PyRuntimeInfo" )
6060load (":reexports.bzl" , "BuiltinPyInfo" , "BuiltinPyRuntimeInfo" )
6161load (":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- )
6962load (
7063 ":toolchain_types.bzl" ,
7164 "EXEC_TOOLS_TOOLCHAIN_TYPE" ,
@@ -1116,19 +1109,12 @@ def _get_runtime_details(ctx, semantics):
11161109 #
11171110 # TOOD(bazelbuild/bazel#7901): Remove this once --python_path flag is removed.
11181111
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
11321118
11331119 if effective_runtime :
11341120 direct = [] # List of files
@@ -1207,7 +1193,7 @@ def _maybe_get_runtime_from_ctx(ctx):
12071193 effective_runtime = toolchain_runtime
12081194 else :
12091195 toolchain_runtime = None
1210- attr_target = getattr ( ctx .attr , PY_RUNTIME_ATTR_NAME )
1196+ attr_target = ctx .attr . _py_interpreter
12111197
12121198 # In Bazel, --python_top is null by default.
12131199 if attr_target and PyRuntimeInfo in attr_target :
@@ -1335,9 +1321,9 @@ def _create_runfiles_with_build_data(
13351321 central_uncachable_version_file ,
13361322 extra_write_build_data_env ,
13371323 )
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+ ] )
13411327 return build_data_file , build_data_runfiles
13421328
13431329def _write_build_data (ctx , central_uncachable_version_file , extra_write_build_data_env ):
@@ -1552,7 +1538,7 @@ def determine_main(ctx):
15521538 """
15531539 if ctx .attr .main :
15541540 proposed_main = ctx .attr .main .label .name
1555- if not proposed_main .endswith (tuple ( ALLOWED_MAIN_EXTENSIONS ) ):
1541+ if not proposed_main .endswith (".py" ):
15561542 fail ("main must end in '.py'" )
15571543 else :
15581544 if ctx .label .name .endswith (".py" ):
0 commit comments