diff --git a/CHANGELOG.md b/CHANGELOG.md index 04979e8c41..b235989f6a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -109,6 +109,8 @@ END_UNRELEASED_TEMPLATE * (toolchains) use "command -v" to find interpreter in `$PATH` ([#3150](https://github.com/bazel-contrib/rules_python/pull/3150)). * (pypi) `bazel vendor` now works in `bzlmod` ({gh-issue}`3079`). +* (core) builds work again on `7.x` `WORKSPACE` configurations + ([#3119](https://github.com/bazel-contrib/rules_python/issues/3119)). {#v0-0-0-added} ### Added diff --git a/python/private/py_executable.bzl b/python/private/py_executable.bzl index 7e50247e61..9927975aa8 100644 --- a/python/private/py_executable.bzl +++ b/python/private/py_executable.bzl @@ -796,6 +796,7 @@ def _create_stage1_bootstrap( is_for_zip, runtime_details, venv = None): + """Create a legacy bootstrap script that is written in Python.""" runtime = runtime_details.effective_runtime if venv: @@ -805,8 +806,11 @@ def _create_stage1_bootstrap( python_binary_actual = venv.interpreter_actual_path if venv else "" - # Runtime may be None on Windows due to the --python_path flag. - if runtime and runtime.supports_build_time_venv: + # Guard against the following: + # * Runtime may be None on Windows due to the --python_path flag. + # * Runtime may not have 'supports_build_time_venv' if a really old version is autoloaded + # on bazel 7.6.x. + if runtime and getattr(runtime, "supports_build_time_venv", False): resolve_python_binary_at_runtime = "0" else: resolve_python_binary_at_runtime = "1"