def build(mod, *args, **dict_p): """ Compile a module, recursively compile all other modules this module depends on first in the correct order """ dep_relations, all_mods, dummy = modules.collect_dependencies(mod) all_mods.add(mod) if not options.disable_transitive_dependencies: sorted_mods = topo_sort.topological_sort(all_mods, dep_relations) if isinstance(sorted_mods, tuple): loop = sorted_mods[1] raise Exception('Sorry a circular dependency is found in modules, the loop : %s ' % "->".join(loop)) sorted_mods.reverse() if options.verbose: print '+----------------------- Building %s ----------------------------------------------------- ' % mod print '| all modules related to %s : %s' % (mod, ", ".join(sorted_mods)) print '| pairwise dependencies : %s' % ", ".join( map(lambda (x,y) : x +" -> " + y, dep_relations) ) else: sorted_mods = [mod] if options.verbose: print '| compiling all modules in this order: ', sorted_mods print '+---------------------------------------------------------------------------------------------' # See which moduls can be built in parallel, map(_src_compile, sorted_mods) map(_test_src_compile, sorted_mods)
def gen_eclipse_prjs(dry_run, verbose): # do all libraries for lib in pdlibs.lib_jars_short: eclipse.gen_lib(lib, dry_run, verbose) # generate the bulk import plugin file, see http://code.nomad-labs.com/eclipse-bulk-import/ bulkprj = open('./projectList.txt', 'w') lib_top = os.getcwd() + os.sep + settings.lib_path for lib in sorted(pdlibs.lib_jars_short): bulkprj.write(lib_top + os.sep + lib + '\n') # do all modules for mod in sorted(find_all_mods()): if verbose: print mod dummy, dep_mods, libs = collect_dependencies(mod) eclipse.gen_module(mod, dep_mods, libs, dry_run, verbose) bulkprj.write(os.getcwd() + os.sep + mod + '\n') bulkprj.close()
if options.eclipse_gen: gen_eclipse_prjs(options.dry_run, options.verbose) sys.exit(0) elif not mod: print 'You must use the --module option to specify the module' all_mods = find_all_mods() if len(all_mods) > 0: print 'These are the modules found in the current directory: %s.' % ",".join(all_mods) p.print_help() sys.exit(1) if mod[-1] == os.path.sep: mod = mod[:-1] if options.show_dependencies: dummy, deps, libs = collect_dependencies(mod) print 'Listing dependencies of module %s: ' % mod print 'Modules it depends on (including indirect ones): %s.' % ','.join(deps) print 'Libraries it depends on (including indirect ones): %s.' % ','.join(libs) elif not options.run_task is None: tasks.options = options args = dict() named_args = {} pos_args = [] if not options.task_args is None: argclauses = options.task_args.split(',') for clause in argclauses: if clause.find('=') != -1: (key, val) = clause.split('=') named_args[key] = val else: