Skip to content

Commit 34051e0

Browse files
rickeylevgoogle-labs-jules[bot]aignas
committed
fix(local-toolchains): don't watch non-existent include directory (#3048)
Apparently, Macs can mis-report their include directory. Since includes are only needed if C extensions are built, skip watching the directory if it doesn't exist. Work around for #3043 --------- Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> Co-authored-by: Ignas Anikevicius <240938+aignas@users.noreply.github.com> (cherry picked from commit be55942)
1 parent fdaca1b commit 34051e0

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,17 @@ BEGIN_UNRELEASED_TEMPLATE
4747
END_UNRELEASED_TEMPLATE
4848
-->
4949

50+
{#1-5-3}
51+
## [1.5.3] - 2025-08-11
52+
53+
[1.5.3]: https://github.com/bazel-contrib/rules_python/releases/tag/1.5.3
54+
55+
{#v1-5-3-fixed}
56+
### Fixed
57+
* (toolchains) `local_runtime_repo` now checks if the include directory exists
58+
before attempting to watch it, fixing issues on macOS with system Python
59+
({gh-issue}`3043`).
60+
5061
{#1-5-2}
5162
## [1.5.2] - 2025-08-11
5263

@@ -65,6 +76,7 @@ END_UNRELEASED_TEMPLATE
6576
* (core) builds work again on `7.x` `WORKSPACE` configurations
6677
([#3119](https://github.com/bazel-contrib/rules_python/issues/3119)).
6778

79+
6880
{#1-5-1}
6981
## [1.5.1] - 2025-07-06
7082

python/private/local_runtime_repo.bzl

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,15 @@ def _local_runtime_repo_impl(rctx):
9999
interpreter_path = info["base_executable"]
100100

101101
# NOTE: Keep in sync with recursive glob in define_local_runtime_toolchain_impl
102-
repo_utils.watch_tree(rctx, rctx.path(info["include"]))
102+
include_path = rctx.path(info["include"])
103+
104+
# The reported include path may not exist, and watching a non-existant
105+
# path is an error. Silently skip, since includes are only necessary
106+
# if C extensions are built.
107+
if include_path.exists and include_path.is_dir:
108+
repo_utils.watch_tree(rctx, include_path)
109+
else:
110+
pass
103111

104112
# The cc_library.includes values have to be non-absolute paths, otherwise
105113
# the toolchain will give an error. Work around this error by making them

0 commit comments

Comments
 (0)