Skip to content

Commit 998d2bc

Browse files
honglookerrickeylevgoogle-labs-jules[bot]aignas
authored
fix: backport #3048 to 1.4: don't watch non-existent include directory (#3174)
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: Richard Levasseur <[email protected]> Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> Co-authored-by: Ignas Anikevicius <[email protected]>
1 parent 4f5a693 commit 998d2bc

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,17 @@ END_UNRELEASED_TEMPLATE
4848
-->
4949

5050

51+
{#1-4-2}
52+
## [1.4.2] - 2025-08-13
53+
54+
[1.4.2]: https://github.com/bazel-contrib/rules_python/releases/tag/1.4.2
55+
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+
([#3043](https://github.com/bazel-contrib/rules_python/issues/3043)).
60+
61+
5162
{#1-4-1}
5263
## [1.4.1] - 2025-05-08
5364

python/private/local_runtime_repo.bzl

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,15 @@ def _local_runtime_repo_impl(rctx):
8585
logger.info(lambda: _format_get_info_result(info))
8686

8787
# NOTE: Keep in sync with recursive glob in define_local_runtime_toolchain_impl
88-
repo_utils.watch_tree(rctx, rctx.path(info["include"]))
88+
include_path = rctx.path(info["include"])
89+
90+
# The reported include path may not exist, and watching a non-existant
91+
# path is an error. Silently skip, since includes are only necessary
92+
# if C extensions are built.
93+
if include_path.exists and include_path.is_dir:
94+
repo_utils.watch_tree(rctx, include_path)
95+
else:
96+
pass
8997

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

0 commit comments

Comments
 (0)