def test_flattened_tree_of_eggs(): """A Reahl application consists of a root egg and all its egg dependencies - with all such components often regarded in flattened order of dependence.""" easter_egg.clear() easter_egg.add_dependency('reahl-component') # All eggs for a root egg can be found in dependency order components_in_order = ReahlEgg.compute_ordered_dependent_distributions( easter_egg.as_requirement_string()) component_names_in_order = [i.project_name for i in components_in_order] # (many valid topological sorts are possible and the algorithm is nondeterministic in some aspects that # do not matter, hence many possible valid orderings are possible for this dependency tree) # We assert here only what matters, else this test becomes a flipper: def is_ordered_before(higher, lower): return component_names_in_order.index( higher) < component_names_in_order.index(lower) assert component_names_in_order[:2] == [ easter_egg.project_name, 'reahl-component' ] for package_name in component_names_in_order: dependencies = [ i.project_name for i in pkg_resources.require(package_name) if i.project_name != package_name ] assert all([is_ordered_before(package_name, i) for i in dependencies])
def execute(self, args): super().execute(args) self.context.install() distributions = ReahlEgg.compute_ordered_dependent_distributions(self.config.reahlsystem.root_egg) for distribution in distributions: deps = '' if args.verbose: deps = '[%s]' % (' | '.join([str(i) for i in distribution.requires()])) print('%s %s' % (distribution, deps)) return 0
def execute(self, options, args): super(ListDependencies, self).execute(options, args) with self.context: distributions = ReahlEgg.compute_ordered_dependent_distributions( self.config.reahlsystem.root_egg) for distribution in distributions: deps = '' if options.verbose: deps = '[%s]' % (' | '.join( [six.text_type(i) for i in distribution.requires()])) print('%s %s' % (distribution, deps)) return 0
def flattened_tree_of_eggs(self, fixture): """A Reahl application consists of a root egg and all its egg dependencies - with all such components often regarded in flattened order of dependence.""" easter_egg.clear() easter_egg.add_dependency('reahl-component') # All eggs for a root egg can be found in dependency order components_in_order = ReahlEgg.compute_ordered_dependent_distributions( easter_egg.as_requirement_string()) component_names_in_order = [ i.project_name for i in components_in_order ] # (many valid topological sorts are possible and the algorithm is nondeterministic in some aspects that # do not matter, hence many possible valid orderings are possible for this dependency tree) # We assert here only what matters, else this test becomes a flipper: def is_ordered_before(higher, lower): return component_names_in_order.index( higher) < component_names_in_order.index(lower) vassert(component_names_in_order[:2] == [easter_egg.project_name, 'reahl-component']) vassert(is_ordered_before('Babel', 'pytz')) vassert(is_ordered_before('python-dateutil', 'six'))