def ExpandTargets(targets_wanted): """Expand any possible toolchain aliases into full targets This will expand 'all' and 'sdk' into the respective toolchain tuples. Args: targets_wanted: The targets specified by the user. Returns: Dictionary of concrete targets and their toolchain tuples. """ targets_wanted = set(targets_wanted) if targets_wanted == set(['boards']): # Only pull targets from the included boards. return {} all_targets = toolchain.GetAllTargets() if targets_wanted == set(['all']): return all_targets if targets_wanted == set(['sdk']): # Filter out all the non-sdk toolchains as we don't want to mess # with those in all of our builds. return toolchain.FilterToolchains(all_targets, 'sdk', True) # Verify user input. nonexistent = targets_wanted.difference(all_targets) if nonexistent: raise ValueError('Invalid targets: %s', ','.join(nonexistent)) return {t: all_targets[t] for t in targets_wanted}
def ExpandTargets(targets_wanted): """Expand any possible toolchain aliases into full targets This will expand 'all' and 'sdk' into the respective toolchain tuples. Args: targets_wanted: The targets specified by the user. Returns: Full list of tuples with pseudo targets removed. """ alltargets = toolchain.GetAllTargets() targets_wanted = set(targets_wanted) if targets_wanted == set(['all']): targets = alltargets elif targets_wanted == set(['sdk']): # Filter out all the non-sdk toolchains as we don't want to mess # with those in all of our builds. targets = toolchain.FilterToolchains(alltargets, 'sdk', True) else: # Verify user input. nonexistent = targets_wanted.difference(alltargets) if nonexistent: raise ValueError('Invalid targets: %s', ','.join(nonexistent)) targets = dict((t, alltargets[t]) for t in targets_wanted) return targets