Skip to content

Commit 0296116

Browse files
committed
fixup the watching
1 parent ff5b449 commit 0296116

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

python/private/pypi/evaluate_markers.bzl

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -40,20 +40,21 @@ def evaluate_markers(ctx, *, requirements, python_interpreter, python_interprete
4040
out_file = ctx.path("requirements_with_markers.out.json")
4141
ctx.file(in_file, json.encode(requirements))
4242

43-
srcdir = ctx.path(Label(":BUILD.bazel")).dirname
44-
_watch_srcs(
45-
ctx,
46-
# NOTE @aignas 2024-07-13: we could in theory have a label list that
47-
# lists the files that we should include as dependencies to the pip
48-
# repo, however, this way works better because we can select files from
49-
# within the `pypi__packaging` repository and re-execute whenever they
50-
# change. This includes re-executing when the 'packaging' version is
51-
# upgraded.
52-
srcs = ctx.path(Label("@pypi__packaging//:BUILD.bazel")).dirname.get_child("packaging").readdir(watch = "no") + [
53-
srcdir.get_child("whl_installer", "platform.py"),
54-
srcdir.get_child("requirements_parser", "resolve_target_platforms.py"),
55-
],
56-
)
43+
if hasattr(ctx, "watch"):
44+
srcdir = ctx.path(Label(":BUILD.bazel")).dirname
45+
_watch_srcs(
46+
ctx,
47+
# NOTE @aignas 2024-07-13: we could in theory have a label list that
48+
# lists the files that we should include as dependencies to the pip
49+
# repo, however, this way works better because we can select files from
50+
# within the `pypi__packaging` repository and re-execute whenever they
51+
# change. This includes re-executing when the 'packaging' version is
52+
# upgraded.
53+
srcs = ctx.path(Label("@pypi__packaging//:BUILD.bazel")).dirname.get_child("packaging").readdir(watch = "no") + [
54+
srcdir.get_child("whl_installer", "platform.py"),
55+
srcdir.get_child("requirements_parser", "resolve_target_platforms.py"),
56+
],
57+
)
5758

5859
repo_utils.execute_checked(
5960
ctx,
@@ -97,5 +98,4 @@ def _watch_srcs(ctx, *, srcs):
9798
# Do not include anything that is not a Python src file
9899
continue
99100

100-
if hasattr(ctx, "watch"):
101-
ctx.watch(src)
101+
ctx.watch(src)

0 commit comments

Comments
 (0)