Skip to content

Commit be55942

Browse files
rickeylevgoogle-labs-jules[bot]aignas
authored
fix(local-toolchains): don't watch non-existent include directory (bazel-contrib#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 bazel-contrib#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>
1 parent 5af778a commit be55942

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,9 @@ END_UNRELEASED_TEMPLATE
7979
* (runfiles) The pypi runfiles package now includes `py.typed` to indicate it
8080
supports type checking
8181
([#2503](https://github.com/bazel-contrib/rules_python/issues/2503)).
82+
* (toolchains) `local_runtime_repo` now checks if the include directory exists
83+
before attempting to watch it, fixing issues on macOS with system Python
84+
({gh-issue}`3043`).
8285

8386
{#v0-0-0-added}
8487
### Added

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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy