Provide a better error message when target `dependencies` is passed a string, not a list

Review Request #4024 - Created June 25, 2016 and submitted

Eric Ayers
benjyw, gmalmquist, kwlzn, nhoward_tw, stuhood

Previously, a malformed target of the form:

target(name='foo', dependencies=':bar')

was parsed as the dependencies ':', 'b', 'a', 'r'. Pants exited cryptically without a path to the BUILD file or indication of which target was wrong:

Exception caught: (<type 'exceptions.ValueError'>)
  File "/Users/zundel/Src/Pants/src/python/pants/build_graph/", line 84, in parse_spec
  File "/Users/zundel/Src/Pants/src/python/pants/build_graph/", line 71, in check_target_name
    raise ValueError('Spec \{spec\} has no name part'.format(spec=spec))

Exception message: Spec : has no name part

Now we check to see that dependencies is a list, set, or tuple.

Exception message: Invalid target TargetAddressable(target_type=<class ''>, name=foo, **kwargs=...): dependencies passed to Target constructors must be a sequence of strings, received <type 'str'>
 while executing BUILD file BuildFile(BUILD, FileSystemProjectTree(/Users/zundel/Src/pants))
 Loading addresses from '' failed.
  when translating spec :foo

Also, catch spec parsing error and convert to AddressLookupError to at least get a path to error if something
like this slips through again.

CI is green at

Eric Ayers
Garrett Malmquist
Benjy Weinberger
Kris Wilson
Eric Ayers
Review request changed

Status: Closed (submitted)

Change Summary:

Thanks Kris, Garrett, Benjy. Commit fa29329