Skip to content

Commit

Permalink
Default to invalidating for requirements.txt to ameliorate pantsbui…
Browse files Browse the repository at this point in the history
…ld#7022.

[ci skip-rust-tests]
[ci skip-jvm-tests]
  • Loading branch information
stuhood committed May 22, 2020
1 parent 8b1b8d0 commit 1f6cd4d
Showing 1 changed file with 17 additions and 11 deletions.
28 changes: 17 additions & 11 deletions src/python/pants/init/options_initializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,20 +136,15 @@ def compute_pantsd_invalidation_globs(buildroot, bootstrap_options):
invalidation_globs provided by users.
"""
invalidation_globs = OrderedSet()
globs = [

# Globs calculated from the sys.path and other file-like configuration need to be sanitized
# to relative globs (where possible).
potentially_absolute_globs = (
*sys.path,
*bootstrap_options.pythonpath,
*bootstrap_options.pants_config_files,
"!*.pyc",
"!__pycache__/",
*bootstrap_options.pantsd_invalidation_globs,
]

for glob in globs:
if glob.startswith("!"):
invalidation_globs.add(glob)
continue

)
for glob in potentially_absolute_globs:
glob_relpath = fast_relpath_optional(glob, buildroot) if os.path.isabs(glob) else glob
if glob_relpath:
invalidation_globs.update([glob_relpath, glob_relpath + "/**"])
Expand All @@ -158,6 +153,17 @@ def compute_pantsd_invalidation_globs(buildroot, bootstrap_options):
f"Changes to {glob}, outside of the buildroot, will not be invalidated."
)

# Explicitly specified globs are already relative, and added verbatim.
invalidation_globs.update(
(
"!*.pyc",
"!__pycache__/",
# TODO: See https://github.com/pantsbuild/pants/issues/7022.
"**/requirements.txt",
*bootstrap_options.pantsd_invalidation_globs,
)
)

return list(invalidation_globs)

@classmethod
Expand Down

0 comments on commit 1f6cd4d

Please sign in to comment.