diff --git a/src/main/starlark/builtins_bzl/common/python/py_executable.bzl b/src/main/starlark/builtins_bzl/common/python/py_executable.bzl index 48ee8b365542b6..714e028c2cbd2b 100644 --- a/src/main/starlark/builtins_bzl/common/python/py_executable.bzl +++ b/src/main/starlark/builtins_bzl/common/python/py_executable.bzl @@ -45,8 +45,6 @@ load( "BUILD_DATA_SYMLINK_PATH", "IS_BAZEL", "PY_RUNTIME_ATTR_NAME", - "PY_RUNTIME_FRAGMENT_ATTR_NAME", - "PY_RUNTIME_FRAGMENT_NAME", ) _cc_common = _builtins.toplevel.cc_common @@ -227,10 +225,9 @@ def _get_runtime_details(ctx, semantics): # # TODO(b/230428071): Remove this once Google's --python_binary flag is removed. # TOOD(bazelbuild/bazel#7901): Remove this once --python_path flag is removed. - fragment = getattr(ctx.fragments, PY_RUNTIME_FRAGMENT_NAME) - flag_interpreter_path = getattr(fragment, PY_RUNTIME_FRAGMENT_ATTR_NAME) if IS_BAZEL: + flag_interpreter_path = ctx.fragments.bazel_py.python_path toolchain_runtime, effective_runtime = _maybe_get_runtime_from_ctx(ctx) if not effective_runtime: # Clear these just in case @@ -238,15 +235,10 @@ def _get_runtime_details(ctx, semantics): effective_runtime = None else: # Google code path - # TODO(b/230428071): This codepath can go away once Google's - # --python_binary flag is removed. - if flag_interpreter_path: - toolchain_runtime = None - effective_runtime = None - else: - toolchain_runtime, effective_runtime = _maybe_get_runtime_from_ctx(ctx) - if not effective_runtime: - fail("should have found runtime") + flag_interpreter_path = None + toolchain_runtime, effective_runtime = _maybe_get_runtime_from_ctx(ctx) + if not effective_runtime: + fail("Unable to find Python runtime") if effective_runtime: direct = [] # List of files diff --git a/src/main/starlark/builtins_bzl/common/python/semantics.bzl b/src/main/starlark/builtins_bzl/common/python/semantics.bzl index 3b60b78607781b..6af9ac73bbd36f 100644 --- a/src/main/starlark/builtins_bzl/common/python/semantics.bzl +++ b/src/main/starlark/builtins_bzl/common/python/semantics.bzl @@ -23,8 +23,6 @@ SRCS_ATTR_ALLOW_FILES = [".py", ".py3"] DEPS_ATTR_ALLOW_RULES = None PY_RUNTIME_ATTR_NAME = "_py_interpreter" -PY_RUNTIME_FRAGMENT_NAME = "bazel_py" -PY_RUNTIME_FRAGMENT_ATTR_NAME = "python_path" BUILD_DATA_SYMLINK_PATH = None