Skip to content

Commit

Permalink
make 'key' default to the target spec!
Browse files Browse the repository at this point in the history
  • Loading branch information
cosmicexplorer committed Mar 3, 2019
1 parent 543e627 commit c6a4031
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions tests/python/pants_test/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -685,10 +685,11 @@ def retrieve_single_product_at_target_base(self, product_mapping, target):
def populate_target_dict(self, target_map):
"""Return a dict containing targets with files generated according to `target_map`.
The values of `target_map` should themselves be a flat dict, which contains keyword arguments
fed into `self.make_target()`, along with a few special keys. Special keys are:
- 'key' (required -- used to index into the returned dict).
- 'filemap' (creates files at the specified relative paths to the target).
The keys of `target_map` are target address strings, while the values of `target_map` should be
a dict which contains keyword arguments fed into `self.make_target()`, along with a few special
keys. Special keys are:
- 'key': used to access the target in the returned dict. Defaults to the target address spec.
- 'filemap': creates files at the specified relative paths to the target.
An `OrderedDict` of 2-tuples must be used with the targets topologically ordered, if
they have dependencies on each other. Note that dependency cycles are not currently supported
Expand Down Expand Up @@ -716,8 +717,8 @@ def populate_target_dict(self, target_map):

# Ensure any dependencies exist in the target dict (`target_map` must then be an
# OrderedDict).
# The 'key' is used to access the target in `target_dict`.
key = unprocessed_kwargs.pop('key')
# The 'key' is used to access the target in `target_dict`, and defaults to `target_spec`.
key = unprocessed_kwargs.pop('key', target_spec)
dep_targets = []
for dep_spec in unprocessed_kwargs.pop('dependencies', []):
existing_tgt_key = target_map[dep_spec]['key']
Expand Down

0 comments on commit c6a4031

Please sign in to comment.