def _dep_node(self, dependency): variants = self.variants if isinstance(dependency, Address): # If a subject has literal variants for particular dependencies, they win over all else. dependency, literal_variants = parse_variants(dependency) variants = Variants.merge(variants, literal_variants) return SelectNode(dependency, self.product, variants, None)
def _dep_node(self, dependency): variants = self.variants if isinstance(dependency, Address): # If a subject has literal variants for particular dependencies, they win over all else. dependency, literal_variants = parse_variants(dependency) variants = Variants.merge(variants, literal_variants) return SelectNode(dependency, self.product, variants, None)
def _dependency_nodes(self, step_context, dep_product): for dependency in getattr(dep_product, self.field or 'dependencies'): variants = self.variants if isinstance(dependency, Address): # If a subject has literal variants for particular dependencies, they win over all else. dependency, literal_variants = parse_variants(dependency) variants = Variants.merge(variants, literal_variants) yield SelectNode(dependency, self.product, variants, None)
def _dependency_nodes(self, step_context, dep_product): for dependency in getattr(dep_product, self.field or 'dependencies'): variants = self.variants if isinstance(dependency, Address): # If a subject has literal variants for particular dependencies, they win over all else. dependency, literal_variants = parse_variants(dependency) variants = Variants.merge(variants, literal_variants) yield SelectNode(dependency, self.product, variants, None)
def _create_roots(self, build_request): # Determine the root products and subjects based on the request. root_subjects = [parse_variants(a) for a in build_request.addressable_roots] root_products = OrderedSet() for goal in build_request.goals: root_products.update(self._products_by_goal[goal]) # Roots are products that might be possible to produce for these subjects. return [SelectNode(s, p, v, None) for s, v in root_subjects for p in root_products]
def _create_roots(self, build_request): # Determine the root products and subjects based on the request. root_subjects = [ parse_variants(a) for a in build_request.addressable_roots ] root_products = OrderedSet() for goal in build_request.goals: root_products.update(self._products_by_goal[goal]) # Roots are products that might be possible to produce for these subjects. return [ SelectNode(s, p, v, None) for s, v in root_subjects for p in root_products ]
def roots(self, products_by_goal): """Determine the root Nodes for the products and subjects selected by the goals and specs.""" for goal_name in self.goals: product = products_by_goal[goal_name] for subject in self._subjects: if type(subject) is SingleAddress: subject, variants = parse_variants(Address.parse(subject.to_spec_string())) yield SelectNode(subject, product, variants, None) elif type(subject) in [SiblingAddresses, DescendantAddresses]: yield DependenciesNode(subject, product, None, Addresses, None) elif type(subject) is PathGlobs: yield DependenciesNode(subject, product, None, Paths, None) else: raise ValueError('Unsupported root subject type: {}'.format(subject))