Skip to content

Commit 855e820

Browse files
Fix: Check for include directory before watching in local_runtime_repo
The local_runtime_repo rule was failing on macOS when the Python interpreter's metadata pointed to an include directory that did not exist. This change modifies the rule to check if the include directory exists and is a directory before attempting to watch it with `watch_tree`.
1 parent 4e22d25 commit 855e820

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

python/private/local_runtime_repo.bzl

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,14 @@ 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+
if include_path.exists and include_path.is_dir:
104+
repo_utils.watch_tree(rctx, include_path)
105+
else:
106+
# If the path doesn't exist or is not a directory, do not watch it.
107+
# This handles the case where the include path specified in Python metadata
108+
# is invalid or points to a file.
109+
pass
103110

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

0 commit comments

Comments
 (0)