Allow old- and new-style resources on python targets.

Review Request #387 — Created May 20, 2014 and submitted

benjyw
pants
pants-reviews
jsirois, patricklaw, wickman
New-style (specs of Resurces targets) are provided via the resource_targets= arg.
Old-style (lists of files, filesets) are wrapped in a synthetic target.

This allows a smooth transition from old to new-style resources.

If and when all codebases have switched to resource_targets=, and we get rid of
old-style resource support entirely, we can repurpose the resources= arg
to mean the same as resource_targets=.
Ran all unittests. 

Manually verified that resources end up in the right place in pexes.
PA
  1. 
      
  2. src/python/pants/base/build_graph.py (Diff revision 1)
     
     
    "guaranteed".  You can still inject a synthetic target without giving it an ancestor, we just don't happen to anywhere.
    1. Good point. Modified the comment.
  3. This idiom is now summed up with Target.sources_relative_to_source_root()
    1. D'oh! I should know that... Fixed.
  4. Sufficiently unlike and pathological that we should just raise an exception explaining as much?
    1. I don't see any reason to disallow use of the name "foo_synthetic_resources" in a build file. Seems arbitrary, even if that's a stupid name. 
  5. src/python/pants/tasks/what_changed.py (Diff revision 1)
     
     
    Address has a method `is_synthetic`
  6. 
      
PA
  1. Ship It!
  2. 
      
BE
BE
  1. 
      
  2. src/python/pants/python/python_chroot.py (Diff revisions 1 - 2)
     
     
    Typo - I meant library.sources_relative_to_source_root(). This is fixed in the actual code.
  3. 
      
LA
  1. Pants has a sad:
  2. ./pants
    
    ...
    
      File "/Users/lhosken/workspace/pants/src/python/pants/python/python_chroot.py", line 102, in _dump_library
        for relpath in library.payload.sources_relative_to_sourceroot():
    AttributeError: 'PythonPayload' object has no attribute 'sources_relative_to_sourceroot'
    
    I'll poke around. But if you have the fix on a silver platter, that's lovely.
    
    1. oh, looks like a missing underscore. Even I can slap together a fix for that.
    2. my previous brilliance was, unsurprisingly, wrong:
      AttributeError: 'PythonPayload' object has no attribute 'sources_relative_to_source_root'
      
      I'll poke around
  3. 
      
JS
  1. Ship It!
  2. 
      
BE
Review request changed

Status: Closed (submitted)

Loading...