def build_mrconfig(projects): """Resolve all dependencies and build mrconfig for projects""" if not isinstance(projects,Iterable): raise TypeError("projects needs to be an Itarable of project_file.projects") # get all recursive dependencies: recursive_dependencies = build_recursive_dependency_set(projects) # arrange them in batches: batches = build_batches(recursive_dependencies) # and flatten them: batches = list(itertools.chain.from_iterable(batches)) string="" for p in batches: string += "[" + p.name + "]\n" if p.description != "": string += "# " + p.description + "\n" string += "checkout = " + p.checkout_command() + "\n\n" return string
def build_mrconfig(projects): """Resolve all dependencies and build mrconfig for projects""" if not isinstance(projects, Iterable): raise TypeError( "projects needs to be an Itarable of project_file.projects") # get all recursive dependencies: recursive_dependencies = build_recursive_dependency_set(projects) # arrange them in batches: batches = build_batches(recursive_dependencies) # and flatten them: batches = list(itertools.chain.from_iterable(batches)) string = "" for p in batches: string += "[" + p.directory + "]\n" if p.description != "": string += "# " + p.description + "\n" string += "checkout = " + p.checkout_command() + "\n\n" return string
# hence all dependencies are fulfilled __test("a.dependencies_fulfilled",a.dependencies_fulfilled(),True) __test("b.dependencies_fulfilled",b.dependencies_fulfilled(),True) __test("c.dependencies_fulfilled",c.dependencies_fulfilled(),True) # now disable b: b.disable() __test("a.dependencies_fulfilled",a.dependencies_fulfilled(),True) __test("b.dependencies_fulfilled",b.dependencies_fulfilled(),True) __test("c.dependencies_fulfilled",c.dependencies_fulfilled(),False) # now enable all guys again: c.enable_all() __test("a.dependencies_fulfilled",c.dependencies_fulfilled(),True) # test the batches builder: __test("c.build_batches())", c.build_batches(),[ {a},{b},{c}]) d = task("d",b) __test("batches for union(c.deps d.deps)", dependency_node.build_batches( c.depends_on_recursive().union(d.depends_on_recursive()).union({c,d})), [{a},{b},{c,d}]) # have an example with a cyclic dependency: e = task("e",a) a.set_dependencies(e) try: __test("a.dependencies_fulfilled",a.dependencies_fulfilled(),None) raise SystemExit("Did not detect an CyclicGraphException as required") except dependency_node.CyclicGraphException as g: pass