limited-insurance-37393
04/28/2021, 7:42 PMtemplates
directory in my repository that has some Python files and other templates, but shouldn't necessarily have any BUILD files. When I run ./pants tailor
it errors out because one of the subdirectories doesn't have a BUILD file, and there doesn't appear to be a way to tell the command to ignore any directories, or to tell it to run only against the src/
directory.--print-stacktrace
./pants --print-stacktrace tailor
15:43:02.77 [ERROR] Exception caught: (pants.engine.internals.scheduler.ExecutionError)
File "/home/tmacey/.cache/pants/setup/bootstrap-Linux-x86_64/2.4.0_py37/lib/python3.7/site-packages/pants/bin/local_pants_runner.py", line 229, in _run_inner
return self._perform_run(goals)
File "/home/tmacey/.cache/pants/setup/bootstrap-Linux-x86_64/2.4.0_py37/lib/python3.7/site-packages/pants/bin/local_pants_runner.py", line 168, in _perform_run
return self._perform_run_body(goals, poll=False)
File "/home/tmacey/.cache/pants/setup/bootstrap-Linux-x86_64/2.4.0_py37/lib/python3.7/site-packages/pants/bin/local_pants_runner.py", line 190, in _perform_run_body
poll_delay=(0.1 if poll else None),
File "/home/tmacey/.cache/pants/setup/bootstrap-Linux-x86_64/2.4.0_py37/lib/python3.7/site-packages/pants/init/engine_initializer.py", line 136, in run_goal_rules
goal_product, params, poll=poll, poll_delay=poll_delay
File "/home/tmacey/.cache/pants/setup/bootstrap-Linux-x86_64/2.4.0_py37/lib/python3.7/site-packages/pants/engine/internals/scheduler.py", line 530, in run_goal_rule
self._raise_on_error([t for _, t in throws])
File "/home/tmacey/.cache/pants/setup/bootstrap-Linux-x86_64/2.4.0_py37/lib/python3.7/site-packages/pants/engine/internals/scheduler.py", line 494, in _raise_on_error
wrapped_exceptions=tuple(t.exc for t in throws),
Exception message: 1 Exception encountered:
Engine traceback:
in select
in pants.core.goals.tailor.tailor
in pants.backend.python.goals.tailor.find_putative_targets
in pants.core.goals.tailor.determine_all_owned_sources
in pants.engine.internals.graph.resolve_unexpanded_targets
in pants.engine.internals.build_files.addresses_from_address_specs
in pants.engine.internals.build_files.parse_address_family (templates/pyinfra_component/[[ _copier_answers.component_name ]])
Traceback (most recent call last):
File "/home/tmacey/.cache/pants/setup/bootstrap-Linux-x86_64/2.4.0_py37/lib/python3.7/site-packages/pants/engine/internals/selectors.py", line 654, in native_engine_generator_send
res = func.send(arg)
File "/home/tmacey/.cache/pants/setup/bootstrap-Linux-x86_64/2.4.0_py37/lib/python3.7/site-packages/pants/engine/internals/build_files.py", line 106, in parse_address_family
raise ResolveError(f"Directory '{directory.path}' does not contain any BUILD files.")
pants.base.exceptions.ResolveError: Directory 'templates/pyinfra_component/[[ _copier_answers.component_name ]]' does not contain any BUILD files.
(Use --print-stacktrace to see more error details.)
happy-kitchen-89482
04/29/2021, 2:13 AMtailor
should not error like that even if it gets confused. Thanks for posting the repo that exposes this, I will take a look.hundreds-father-404
04/29/2021, 10:56 PM[[ _copier_answers.component_name ]]
and it causes Pants to get confused if there is or is not a BUILD file there. I'm creating a minimal repro nowhappy-kitchen-89482
04/29/2021, 11:12 PMhundreds-father-404
04/29/2021, 11:16 PM[[
]]
, spaces were fine. Still narrowing it down, got pulled into some other thingsPathGlobs
syntax uses .gitignore
syntax, and [a-zA-Z]
can be used as a range, per: https://git-scm.com/docs/gitignore#_pattern_format.
For example:
$ ./pants list 'debug/[abc::'
...
Exception: Could not parse "debug/[abc/**/BUILD" as a glob: PatternError { pos: 0, msg: "invalid range pattern" }
@limited-insurance-37393 the (temporary) workaround is to not use [
and ]
in a file pathhappy-kitchen-89482
04/30/2021, 12:14 AMhundreds-father-404
04/30/2021, 12:17 AM\[
), but yeah, presumably through escaping
I think the tricky thing is if we do ever want to support [
ranges, e.g. is that useful in the sources
field? We've only really documented !
and `*`/`**` being supported. If we do want to support, I think we would need to selectively add the normalizationlimited-insurance-37393
04/30/2021, 2:09 AM