def main(): (options, args) = parser.parse_args() sorted_order = tools.get_sorted_order() if options.module != "": if options.module == "kernel": tools.rewrite("lib/IMP/__init__.py", imp_init) build_wrapper( options.module, os.path.join( options.source, "modules", options.module), options.source, sorted_order, tools.get_module_description( options.source, options.module, options.datapath), os.path.join("swig", "IMP_" + options.module + ".i"), options.datapath) else: tools.rewrite("lib/IMP/__init__.py", imp_init) for m, path in tools.get_modules(options.source): build_wrapper(m, path, options.source, sorted_order, tools.get_module_description( options.source, m, options.datapath), os.path.join("swig", "IMP_" + m + ".i"), options.datapath)
def get_all_components(): comps = {} # If RMF is being built as part of IMP, split out its build (rather than # building it as part of IMP.rmf) special_dep_targets = {"RMF": RMFDependency} for dep, cls in special_dep_targets.items(): i = tools.get_dependency_info(dep, "") if i['ok']: comps[dep] = cls(dep) comps[dep].set_dep_modules(comps, [], [], special_dep_targets) modules = tools.get_sorted_order() for m in modules: comps[m] = Module(m) for m in modules: i = tools.get_module_info(m, "") comps[m].set_dep_modules(comps, i['modules'], i['dependencies'], special_dep_targets) source_dir = os.path.join(os.path.dirname(sys.argv[0]), '..', '..') all_modules = [x[0] for x in tools.get_modules(source_dir)] add_disabled_components(modules, all_modules, comps, "module") return comps
def link_swig(source): target = os.path.join("swig") tools.mkdir(target) for module, g in tools.get_modules(source): # they all go in the same dir, so don't remove old links tools.link_dir( os.path.join(g, "pyext"), target, match=["*.i"], clean=False) if os.path.exists(os.path.join(g, "pyext", "include")): tools.link_dir( os.path.join(g, "pyext", "include"), target, match=["*.i"], clean=False) tools.link( os.path.join( g, "pyext", "swig.i-in"), os.path.join( target, "IMP_%s.impl.i" % module))
def get_all_components(): comps = {} # If RMF is being built as part of IMP, split out its build (rather than # building it as part of IMP.rmf) special_dep_targets = {"RMF": RMFDependency} for dep, cls in special_dep_targets.items(): i = tools.get_dependency_info(dep, "") if i['ok'] and internal_dep(dep): comps[dep] = cls(dep) comps[dep].set_dep_modules(comps, [], [], special_dep_targets) modules = tools.get_sorted_order() apps = tools.get_all_configured_applications() for m in modules: comps[m] = Module(m) for a in apps: comps[a] = Application(a) for m in modules: i = tools.get_module_info(m, "") comps[m].set_dep_modules(comps, i['modules'], i['dependencies'], special_dep_targets) for a in apps: i = tools.get_application_info(a, "") comps[a].set_dep_modules(comps, i['modules'], i['dependencies'], special_dep_targets) source_dir = os.path.join(os.path.dirname(sys.argv[0]), '..', '..') all_modules= [x[0] for x in tools.get_modules(source_dir)] all_apps= [x[0] for x in tools.get_applications(source_dir)] add_disabled_components(modules, all_modules, comps, "module") add_disabled_components(apps, all_apps, comps, "application") return comps
def generate_overview_pages(source): name = os.path.join("doxygen", "generated", "cmdline_tools.dox") contents = [] contents.append("/** ") contents.append("\\page cmdline_tools All IMP command line tools") contents.append(""" IMP modules provide a number of command line tools. These are listed below under their parent module:""") for bs, g in tools.get_modules(source): if tools.get_module_info(bs, '')['ok']: p = pickle.load( open(os.path.join("data", "build_info", "IMP_%s.pck" % bs))) if len(p) > 0: contents.append("- IMP::%s" % bs) apps = sorted([[k] + list(v) for k, v in p.iteritems() if v], key=lambda x: x[3]) for app in apps: contents.append(" - [%s](\\ref %s): %s" % (app[0], app[1], app[2])) contents.append(""" See also the [command line tools provided by RMF](http://integrativemodeling.org/rmf/nightly/doc/executables.html).""" ) contents.append("*/") g = tools.DoxFileGenerator() g.write(name, "\n".join(contents))
def check_readme(): for module, g in tools.get_modules("."): if not os.path.exists(os.path.join(g, "README.md")): sys.stderr.write( "Each module must have a file 'README.md' describing what what it does and who wrote it.\n" ) sys.stderr.write(module, "does not.\n") exit(1)
def generate_all_cpp(source): target=os.path.join("src") tools.mkdir(target) for module, g in tools.get_modules(source): sources= tools.get_glob([os.path.join(g, "src", "*.cpp")])\ +tools.get_glob([os.path.join(g, "src", "internal", "*.cpp")]) targetf=os.path.join(target, module+"_all.cpp") sources.sort() tools.rewrite(targetf, "\n".join(["#include <%s>"%os.path.abspath(s) for s in sources]) + '\n')
def check_readme(): for module, g in tools.get_modules("."): if not os.path.exists(os.path.join(g, "README.md")): print >> sys.stderr, "Each module must have a file 'README.md' describing what what it does and who wrote it." print >> sys.stderr, module, "does not." exit(1) for app, g in tools.get_applications("."): if not os.path.exists(os.path.join(g, "README.md")): print >> sys.stderr, "Each application must have a file 'README.md' describing what who wrote it and what it does." print >> sys.stderr, app, "does not." exit(1)
def check_readme(): for module, g in tools.get_modules("."): if not os.path.exists(os.path.join(g, "README.md")): print >> sys.stderr, "Each module must have a file 'README.md' describing what what it does and who wrote it." print >> sys.stderr, module, "does not." exit(1) for app, g in tools.get_applications("."): if not os.path.exists(os.path.join(g, "README.md")): print >> sys.stderr, "Each application must have a file 'README.md' describing what who wrote it and what it does." print >> sys.stderr, app, "does not." exit(1)
def generate_overview_pages(source): ai= open(os.path.join("doxygen", "applications.dox"), "w") ai.write("/** \\page applications_index Application Index \n") for bs, g in tools.get_applications(source): ai.write("- \\subpage IMP_%s_overview \"%s\"\n"%(bs,bs)) ai.write("*/") ai= open(os.path.join("doxygen", "modules.dox"), "w") ai.write("/** \\page modules_index Module Index \n") for bs, g in tools.get_modules(source): ai.write("- \\subpage IMP_%s_overview \"%s\"\n"%(bs,bs)) ai.write("*/")
def check_dependencies(): for module, g in tools.get_modules("."): if not os.path.exists(os.path.join(g, "dependencies.py")): print >> sys.stderr, "Each module must have a file 'dependencies.py' describing what other modules and external dependencies it needs." print >> sys.stderr, module, "does not." exit(1) for app, g in tools.get_applications("."): if not os.path.exists(os.path.join(g, "dependencies.py")): print >> sys.stderr, "Each application must have a file 'dependencies.py' describing what other modules and external dependencies it needs." print >> sys.stderr, app, "does not." exit(1)
def check_dependencies(): for module, g in tools.get_modules("."): if not os.path.exists(os.path.join(g, "dependencies.py")): print >> sys.stderr, "Each module must have a file 'dependencies.py' describing what other modules and external dependencies it needs." print >> sys.stderr, module, "does not." exit(1) for app, g in tools.get_applications("."): if not os.path.exists(os.path.join(g, "dependencies.py")): print >> sys.stderr, "Each application must have a file 'dependencies.py' describing what other modules and external dependencies it needs." print >> sys.stderr, app, "does not." exit(1)
def link_python(source): target=os.path.join("lib") tools.mkdir(target, clean=False) for module, g in tools.get_modules(source): path= os.path.join(target, "IMP", module) tools.mkdir(path, clean=False) for old in tools.get_glob([os.path.join(path, "*.py")]): # don't unlink the generated file if os.path.split(old)[1] != "__init__.py" and os.path.split(old)[1] != "_version_check.py": os.unlink(old) #print "linking", path tools.link_dir(os.path.join(g, "pyext", "src"), path, clean=False)
def link_headers(source): target=os.path.join("include") tools.mkdir(target) root=os.path.join(target, "IMP") tools.mkdir(root) for (module, g) in tools.get_modules(source): #print g, module if module== "SConscript": continue tools.link_dir(os.path.join(g, "include"), os.path.join(root, module), match=["*.h"]) tools.link_dir(os.path.join(g, "include", "internal"), os.path.join(root, module, "internal"), match=["*.h"])
def link_dox(source): target = os.path.join("doxygen") tools.mkdir(target) for module, g in tools.get_modules(source): tools.link_dir(os.path.join(g, "doc"), os.path.join("doc", "html", module), match=["*.png", "*.pdf", "*.gif"], clean=False) tools.link_dir(os.path.join(source, "doc"), os.path.join("doc", "html"), match=["*.png", "*.pdf", "*.gif"], clean=False) tools.link_dir(os.path.join(source, "doc", "tutorial"), os.path.join("doc", "tutorial"), match=["*.png", "*.pdf", "*.gif"], clean=False)
def generate_all_cpp(source): target = os.path.join("src") tools.mkdir(target) for module, g in tools.get_modules(source): sources = tools.get_glob([os.path.join(g, "src", "*.cpp")])\ + tools.get_glob([os.path.join(g, "src", "internal", "*.cpp")]) targetf = os.path.join(target, module + "_all.cpp") sources.sort() tools.rewrite( targetf, "\n".join(["#include <%s>" % os.path.abspath(s) for s in sources]) + '\n')
def main(): parser = OptionParser() parser.add_option("-s", "--source", dest="source", help="IMP source directory.") options, args = parser.parse_args() # Top-level version make_version(options.source, '.') # Submodule versions for module, module_source in tools.get_modules(options.source): if os.path.exists(os.path.join(module_source, ".git")): make_version(module_source, os.path.join("modules", module))
def link_python(source): target = os.path.join("lib") tools.mkdir(target, clean=False) for module, g in tools.get_modules(source): path = os.path.join(target, "IMP", module) tools.mkdir(path, clean=False) for old in tools.get_glob([os.path.join(path, "*.py")]): # don't unlink the generated file if os.path.split(old)[1] != "__init__.py" and os.path.split( old)[1] != "_version_check.py": os.unlink(old) # print "linking", path tools.link_dir(os.path.join(g, "pyext", "src"), path, clean=False)
def link_dox(source): target=os.path.join("doxygen") tools.mkdir(target) for module, g in tools.get_modules(source): tools.link_dir(os.path.join(g, "doc"), os.path.join(target, module)) tools.link_dir(os.path.join(g, "doc"), os.path.join("doc", "html"), match=["*.png", "*.pdf"], clean=False) doxygenize_readme(os.path.join(g, "README.md"), "doxygen", module) for app, g in tools.get_applications(source): tools.link_dir(g, os.path.join(target, app)) tools.link_dir(g, os.path.join("doc", "html"), match=["*.png", "*.pdf"], clean=False) doxygenize_readme(os.path.join(g, "README.md"), "doxygen", app) tools.link_dir(os.path.join(source, "doc"), os.path.join(target, "IMP")) tools.link_dir(os.path.join(source, "doc"), os.path.join("doc", "html"), match=["*.png", "*.pdf"], clean=False)
def generate_overview_pages(source): name = os.path.join("doxygen", "generated", "all.dox") contents = [] contents.append("/** ") contents.append("\\page allmod All IMP Modules and Applications") contents.append("<table><tr>") contents.append("<th>Modules</th><th>Applications</th></tr><tr><td>") for bs, g in tools.get_modules(source): contents.append("- \\subpage imp%s \"IMP.%s\""%(bs,bs)) contents.append("</td><td style=\"vertical-align:top;\">") for bs, g in tools.get_applications(source): contents.append("- \subpage imp%s \"IMP.%s\""%(bs,bs)) contents.append("</td></tr></table>") contents.append("*/") tools.rewrite(name, "\n".join(contents))
def link_dox(source): target = os.path.join("doxygen") tools.mkdir(target) for module, g in tools.get_modules(source): tools.link_dir(os.path.join(g, "doc"), os.path.join("doc", "html", module), match=["*.png", "*.pdf", "*.gif"], clean=False) tools.link_dir(os.path.join(source, "doc"), os.path.join("doc", "html"), match=["*.png", "*.pdf", "*.gif"], clean=False) tools.link_dir(os.path.join(source, "doc", "tutorial"), os.path.join("doc", "tutorial"), match=["*.png", "*.pdf", "*.gif"], clean=False)
def link_dox(source): target=os.path.join("doxygen") tools.mkdir(target) for module, g in tools.get_modules(source): tools.link_dir(os.path.join(g, "doc"), os.path.join("doc", "html", module), match=["*.png", "*.pdf"], clean=False) for app, g in tools.get_applications(source): tools.link_dir(g, os.path.join("doc", "html", app), match=["*.png", "*.pdf"], exclude=["README.md"], clean=False) tools.link_dir(os.path.join(source, "doc"), os.path.join("doc", "html"), match=["*.png", "*.pdf"], clean=False) tools.link_dir(os.path.join(source, "doc", "tutorial"), os.path.join("doc", "tutorial"), match=["*.png", "*.pdf"], clean=False)
def link_swig(source): target = os.path.join("swig") tools.mkdir(target) for module, g in tools.get_modules(source): # they all go in the same dir, so don't remove old links tools.link_dir(os.path.join(g, "pyext"), target, match=["*.i"], clean=False) if os.path.exists(os.path.join(g, "pyext", "include")): tools.link_dir(os.path.join(g, "pyext", "include"), target, match=["*.i"], clean=False) tools.link(os.path.join(g, "pyext", "swig.i-in"), os.path.join(target, "IMP_%s.impl.i" % module))
def link_headers(source): target = os.path.join("include") tools.mkdir(target) root = os.path.join(target, "IMP") tools.mkdir(root) for (module, g) in tools.get_modules(source): # print g, module modroot = os.path.join(root, '' if module == 'kernel' else module) if module == "SConscript": continue tools.link_dir(os.path.join(g, "include"), modroot, match=["*.h"]) tools.link_dir(os.path.join(g, "include", "internal"), os.path.join(modroot, "internal"), match=["*.h"]) # ick if os.path.exists(os.path.join(g, "include", "eigen3")): tools.link_dir(os.path.join(g, "include", "eigen3"), os.path.join(modroot, "eigen3"), match=["*"])
def link_headers(source): target = os.path.join("include") tools.mkdir(target) root = os.path.join(target, "IMP") tools.mkdir(root) for (module, g) in tools.get_modules(source): # print g, module modroot = os.path.join(root, '' if module == 'kernel' else module) if module == "SConscript": continue tools.link_dir(os.path.join(g, "include"), modroot, match=["*.h"]) tools.link_dir(os.path.join(g, "include", "internal"), os.path.join(modroot, "internal"), match=["*.h"]) # ick if os.path.exists(os.path.join(g, "include", "eigen3")): tools.link_dir(os.path.join(g, "include", "eigen3"), os.path.join(modroot, "eigen3"), match=["*"])
def main(): (options, args) = parser.parse_args() sorted_order = tools.get_sorted_order() if options.module != "": if options.module == "kernel": tools.rewrite("lib/IMP/__init__.py", imp_init) build_wrapper( options.module, os.path.join(options.source, "modules", options.module), options.source, sorted_order, tools.get_module_description(options.source, options.module, options.datapath), os.path.join("swig", "IMP_" + options.module + ".i"), options.datapath) else: tools.rewrite("lib/IMP/__init__.py", imp_init) for m, path in tools.get_modules(options.source): build_wrapper( m, path, options.source, sorted_order, tools.get_module_description(options.source, m, options.datapath), os.path.join("swig", "IMP_" + m + ".i"), options.datapath)
def main(): source = sys.argv[1] modules = [m[0] for m in tools.get_modules(source)] docs = Docs(xml_dir='doxygen/ref/xml', html_dir='doc/ref', top_source_dir=source, source_subdirs=sys.argv[2:] + all_module_docs(modules)) for p in docs.pages: p.map_location_to_source(source) for m in modules: docs.pages.append(get_module_readme(m)) # Difficult to figure out the main/index page, so set this manually p = docs.page_by_id['indexpage'] p.out_file_name = 'index' p.source_file_name = 'doc/ref/mainpage.md' for p in docs.pages: if os.path.exists(docs.get_html_page(p)): docs.add_page_navigation(p) else: print("Not handling %s: HTML file does not exist" % p.id)
def main(): source = sys.argv[1] modules = [m[0] for m in tools.get_modules(source)] docs = Docs(xml_dir='doxygen/ref/xml', html_dir='doc/ref', top_source_dir=source, source_subdirs=sys.argv[2:] + all_module_docs(modules)) for p in docs.pages: p.map_location_to_source(source) for m in modules: docs.pages.append(get_module_readme(m)) # Difficult to figure out the main/index page, so set this manually p = docs.page_by_id['indexpage'] p.out_file_name = 'index' p.source_file_name = 'doc/ref/mainpage.md' for p in docs.pages: if docs.get_html_pages(p): docs.add_page_navigation(p) else: print("Not handling %s: HTML file does not exist" % p.id)
def generate_overview_pages(source): name = os.path.join("doxygen", "generated", "cmdline_tools.dox") contents = [] contents.append("/** ") contents.append("\\page cmdline_tools All IMP command line tools") contents.append(""" IMP modules provide a number of command line tools. These are listed below under their parent module:""") for bs, g in tools.get_modules(source): if tools.get_module_info(bs, '')['ok']: p = pickle.load(open(os.path.join("data", "build_info", "IMP_%s.pck" % bs))) if len(p) > 0: contents.append("- IMP::%s" % bs) apps = sorted([[k]+list(v) for k,v in p.iteritems() if v], key=lambda x:x[3]) for app in apps: contents.append(" - [%s](\\ref %s): %s" % (app[0], app[1], app[2])) contents.append(""" See also the [command line tools provided by RMF](http://integrativemodeling.org/rmf/nightly/doc/executables.html).""") contents.append("*/") tools.rewrite(name, "\n".join(contents))
def link_examples(source): target = os.path.join("doc", "examples") tools.mkdir(target) for module, g in tools.get_modules(source): tools.link_dir(os.path.join(g, "examples"), os.path.join(target, module))
def get_output_file_contents(self, options): template = self.template name = options.name modules = self.modules template = template.replace("@[email protected]", options.source) template = template.replace("@[email protected]", "NONE") template = template.replace("@[email protected]", name) template = template.replace("@[email protected]", '"The Integrative Modeling Platform"') template = template.replace("@[email protected]", "YES") template = template.replace("@[email protected]", "*/tutorial/*") template = template.replace("@[email protected]", "NO") template = template.replace("@[email protected]", "YES") template = template.replace("@[email protected]", "IMP." + name) template = template.replace("@[email protected]", "../../doc/html/" + name) template = template.replace("@[email protected]", "xml") template = template.replace("@[email protected]", "NO") template = template.replace("@[email protected]", "tags") template = template.replace( "@[email protected]", "%s/doc/doxygen/module_layout.xml" % options.source) template = template.replace("@[email protected]", "README.md") template = template.replace("@[email protected]", "include") template = template.replace("@[email protected]", "*.cpp *.h *.py *.md *.dox") template = template.replace("@[email protected]", "warnings.txt") # include lib and doxygen in input inputs = [] if options.name == "kernel": inputs.append("lib/IMP/") inputs.append("include/IMP/") exclude = [ "include/IMP/%s include/IMP/%s.h lib/IMP/%s" % (m, m, m) for m, g in tools.get_modules(options.source) ] exclude.append("include/IMP/base include/IMP/base.h lib/IMP/base") template = template.replace( "@[email protected]", " \\\n ".join(exclude)) else: template = template.replace("@[email protected]", "") inputs.append("include/IMP/" + options.name) inputs.append("lib/IMP/" + options.name) inputs.append("examples/" + options.name) # suppress a warning since git removes empty dirs and doxygen # gets confused if the input path doesn't exist docpath = os.path.join(options.source, "modules", options.name, "doc") if os.path.exists(docpath): inputs.append(docpath) # overview for module inputs.append("../generated/IMP_%s.dox" % options.name) template = template.replace( "@[email protected]", " \\\n ".join(inputs)) tags = [ os.path.join(options.source, 'doc', 'doxygen', 'dummy_module_tags.xml') ] for m in modules: tags.append(os.path.join("../", m, "tags") + "=" + "../" + m) template = template.replace( "@[email protected]", " \\\n ".join(tags)) if options.name == "example": template = template.replace( "@[email protected]", "examples/example %s/modules/example" % options.source) else: template = template.replace("@[email protected]", "examples/" + options.name) return template
def generate_src_dirs(source): """Make src directories for each module. This way we don't have to worry about whether it exists later.""" for module, g in tools.get_modules(source): tools.mkdir(os.path.join("src", module), clean=False)
def generate_tests(source, scons): template = """import IMP import IMP.test import %(module)s spelling_exceptions=%(spelling_exceptions)s class StandardsTest(IMP.test.TestCase): def test_value_objects(self): "Test that module classes are either values or objects" exceptions= %(value_object_exceptions)s return self.assertValueObjects(%(module)s,exceptions) def test_classes(self): "Test that module class names follow the standards" exceptions=%(value_object_exceptions)s return self.assertClassNames(%(module)s, exceptions, spelling_exceptions) def test_functions(self): "Test that module function names follow the standards" exceptions= %(function_name_exceptions)s return self.assertFunctionNames(%(module)s, exceptions, spelling_exceptions) def test_show(self): "Test all objects have show" exceptions=%(show_exceptions)s return self.assertShow(%(module)s, exceptions) if __name__ == '__main__': IMP.test.main() """ target = os.path.join("test") tools.mkdir(target) for module, g in tools.get_modules(source): targetdir = os.path.join(target, module) tools.mkdir(targetdir) exceptions = os.path.join(g, "test", "standards_exceptions") d = { 'plural_exceptions': [], 'show_exceptions': [], 'function_name_exceptions': [], 'value_object_exceptions': [], 'class_name_exceptions': [], 'spelling_exceptions': [] } try: exec(open(exceptions, "r").read(), d) except IOError: pass impmodule = "IMP" if module == 'kernel' else "IMP." + module test = template % ( { 'module': impmodule, 'plural_exceptions': str(d['plural_exceptions']), 'show_exceptions': str(d['show_exceptions']), 'function_name_exceptions': str(d['function_name_exceptions']), 'value_object_exceptions': str(d['value_object_exceptions']), 'class_name_exceptions': str(d['class_name_exceptions']), 'spelling_exceptions': str(d['spelling_exceptions']) }) gen = tools.PythonFileGenerator() gen.write(os.path.join("test", module, "medium_test_standards.py"), test, show_diff=False) cpptests = tools.get_glob([os.path.join(g, "test", "test_*.cpp")]) ecpptests = tools.get_glob( [os.path.join(g, "test", "expensive_test_*.cpp")]) cppexamples = tools.get_glob([os.path.join(g, "examples", "*.cpp")]) if len(cpptests) > 0 and scons: _make_test_driver(os.path.join(targetdir, "test_cpp_tests.py"), cpptests) if len(ecpptests) > 0 and scons: _make_test_driver( os.path.join(targetdir, "expensive_test_cpp_tests.py"), cpptests) if len(cppexamples) > 0 and scons: _make_test_driver(os.path.join(targetdir, "cpp_examples_test.py"), cppexamples)
def get_output_file_contents(self, output): is_xml = output['is_xml'] is_html = output['is_html'] manual = output['manual'] source = output['source'] version = "develop" versionpath = os.path.join("VERSION") if os.path.exists(versionpath): version = open(versionpath, "r").read().strip() if manual: version = '"for IMP version ' + version + '"' doxygen = self.template if manual: doxygen = doxygen.replace("@[email protected]", '"IMP Manual"') doxygen = doxygen.replace("@[email protected]", "") doxygen = doxygen.replace("@[email protected]", "") doxygen = doxygen.replace("@[email protected]", "YES") doxygen = doxygen.replace("@[email protected]", "doc/manual/") doxygen = doxygen.replace("@[email protected]", "%s/doc/doxygen/manual_layout.xml" % source) doxygen = doxygen.replace("@[email protected]", "NO") doxygen = doxygen.replace("@[email protected]", "doxygen/manual-tags.xml") doxygen = doxygen.replace("@[email protected]", "doxygen/manual-warnings.txt") doxygen = doxygen.replace("@[email protected]", "") doxygen = doxygen.replace("@[email protected]", ".") doxygen = doxygen.replace("@[email protected]", "doxygen/ref-tags.xml=../ref") doxygen = doxygen.replace("@[email protected]", "doxygen/manual/xml/") doxygen = doxygen.replace("@[email protected]", "") else: doxygen = doxygen.replace("@[email protected]", '"IMP Reference Guide"') doxygen = doxygen.replace("@[email protected]", '"The Integrative Modeling Platform"') doxygen = doxygen.replace("@[email protected]", "mainpage.md") doxygen = doxygen.replace("@[email protected]", "YES") doxygen = doxygen.replace("@[email protected]", "doc/ref/") doxygen = doxygen.replace("@[email protected]", "%s/doc/doxygen/main_layout.xml" % source) doxygen = doxygen.replace("@[email protected]", "NO") doxygen = doxygen.replace("@[email protected]", "doxygen/ref-tags.xml") doxygen = doxygen.replace("@[email protected]", "doxygen/ref-warnings.txt") doxygen = doxygen.replace("@[email protected]", "") doxygen = doxygen.replace("@[email protected]", "doc/examples %s/modules/example" % source) doxygen = doxygen.replace("@[email protected]", "doxygen/manual-tags.xml=../manual") doxygen = doxygen.replace("@[email protected]", "doxygen/ref/xml/") doxygen = doxygen.replace("@[email protected]", "lib/IMP/kernel lib/IMP/base") doxygen = doxygen.replace("@[email protected]", "IMP") doxygen = doxygen.replace("@[email protected]", source) \ .replace("@[email protected]", version) doxygen = doxygen.replace("@[email protected]", "include") doxygen = doxygen.replace("@[email protected]", "*.cpp *.h *.py *.md *.dox") # TAGS, INPUT_PATH if is_xml: doxygen = doxygen.replace("@[email protected]", "YES") else: doxygen = doxygen.replace("@[email protected]", "NO") if is_html: doxygen = doxygen.replace("@[email protected]", "YES") else: doxygen = doxygen.replace("@[email protected]", "NO") if manual: inputsh = [source + "/doc/manual", source + "/tools/README.md", source + "/ChangeLog.md"] else: inputsh = ["doxygen/generated", source + "/doc/ref", "include", "doc/examples", "lib/IMP"] for m, p in tools.get_modules(source): doc = os.path.join(p, "doc") if os.path.exists(doc): inputsh.append(doc + "/") doxygen = doxygen.replace("@[email protected]", " ".join(inputsh)) return doxygen
def link_data(source): target = os.path.join("data") tools.mkdir(target) for module, g in tools.get_modules(source): tools.link_dir(os.path.join(g, "data"), os.path.join(target, module))
def generate_doxyfile(source, target, is_xml=False, is_html=False, tutorial=False): doxyin = os.path.join(source, "tools", "build", "doxygen_templates", "Doxyfile.in") version = "develop" versionpath = os.path.join("VERSION") if os.path.exists(versionpath): version = open(versionpath, "r").read().strip() if tutorial: version = '"for IMP version ' + version + '"' doxygen = open(doxyin, "r").read() if tutorial: doxygen = doxygen.replace("@[email protected]", '"IMP Tutorial"') doxygen = doxygen.replace("@[email protected]", "") doxygen = doxygen.replace("@[email protected]", "") doxygen = doxygen.replace("@[email protected]", "NO") doxygen = doxygen.replace("@[email protected]", "doc/tutorial/") doxygen = doxygen.replace("@[email protected]", "") doxygen = doxygen.replace("@[email protected]", "YES") doxygen = doxygen.replace("@[email protected]", "") doxygen = doxygen.replace("@[email protected]", "doxygen/tutorial-warnings.txt") doxygen = doxygen.replace("@[email protected]", "") doxygen = doxygen.replace("@[email protected]", ".") doxygen = doxygen.replace("@[email protected]", "doxygen/tags.html=../html") else: doxygen = doxygen.replace("@[email protected]", "IMP") doxygen = doxygen.replace("@[email protected]", '"The Integrative Modeling Platform"') doxygen = doxygen.replace("@[email protected]", "mainpage.md") doxygen = doxygen.replace("@[email protected]", "YES") doxygen = doxygen.replace("@[email protected]", "doc/html/") doxygen = doxygen.replace("@[email protected]", "%s/doc/doxygen/main_layout.xml" % source) doxygen = doxygen.replace("@[email protected]", "NO") doxygen = doxygen.replace("@[email protected]", "doxygen/tags.html") doxygen = doxygen.replace("@[email protected]", "doxygen/warnings.txt") doxygen = doxygen.replace("@[email protected]", "*/tutorial/*") doxygen = doxygen.replace("@[email protected]", "doc/examples %s/modules/example" % source) doxygen = doxygen.replace("@[email protected]", "") doxygen = doxygen.replace("@[email protected]", "IMP") doxygen = doxygen.replace("@[email protected]", source).replace("@VERSION@", version) doxygen = doxygen.replace("@[email protected]", "") doxygen = doxygen.replace("@[email protected]", "include") doxygen = doxygen.replace("@[email protected]", "*.cpp *.h *.py *.md *.dox") doxygen = doxygen.replace("@[email protected]", "doxygen/xml/") # TAGS, INPUT_PATH if is_xml: doxygen = doxygen.replace("@[email protected]", "YES") else: doxygen = doxygen.replace("@[email protected]", "NO") if is_html: doxygen = doxygen.replace("@[email protected]", "YES") else: doxygen = doxygen.replace("@[email protected]", "NO") # skip linking later inputsh = [ "doxygen/generated", source + "/doc", source + "/ChangeLog.md", source + "/tools/README.md", "include", "doc/examples" ] for m, p in tools.get_modules(source): doc = os.path.join(p, "doc") inputsh.append(os.path.join("lib", "IMP", m)) if os.path.exists(doc): inputsh.append(doc + "/") if not tutorial: doxygen = doxygen.replace("@[email protected]", " ".join(inputsh)) open(target, "w").write(doxygen)
def generate_src_dirs(source): """Make src directories for each module. This way we don't have to worry about whether it exists later.""" for module, g in tools.get_modules(source): tools.mkdir(os.path.join("src", module), clean=False)
def get_output_file_contents(self, output): is_xml = output['is_xml'] is_html = output['is_html'] manual = output['manual'] source = output['source'] version = "develop" versionpath = os.path.join("VERSION") if os.path.exists(versionpath): version = open(versionpath, "r").read().strip() if manual: version = '"for IMP version ' + version + '"' doxygen = self.template if manual: doxygen = doxygen.replace("@[email protected]", '"IMP Manual"') doxygen = doxygen.replace("@[email protected]", "") doxygen = doxygen.replace("@[email protected]", "") doxygen = doxygen.replace("@[email protected]", "YES") doxygen = doxygen.replace("@[email protected]", "doc/manual/") doxygen = doxygen.replace("@[email protected]", "%s/doc/doxygen/manual_layout.xml" % source) doxygen = doxygen.replace("@[email protected]", "NO") doxygen = doxygen.replace("@[email protected]", "doxygen/manual-tags.xml") doxygen = doxygen.replace("@[email protected]", "doxygen/manual-warnings.txt") doxygen = doxygen.replace("@[email protected]", "") doxygen = doxygen.replace("@[email protected]", ".") doxygen = doxygen.replace("@[email protected]", "doxygen/ref-tags.xml=../ref") doxygen = doxygen.replace("@[email protected]", "doxygen/manual/xml/") doxygen = doxygen.replace("@[email protected]", "") else: doxygen = doxygen.replace("@[email protected]", '"IMP Reference Guide"') doxygen = doxygen.replace("@[email protected]", '"The Integrative Modeling Platform"') doxygen = doxygen.replace("@[email protected]", "mainpage.md") doxygen = doxygen.replace("@[email protected]", "YES") doxygen = doxygen.replace("@[email protected]", "doc/ref/") doxygen = doxygen.replace("@[email protected]", "%s/doc/doxygen/main_layout.xml" % source) doxygen = doxygen.replace("@[email protected]", "NO") doxygen = doxygen.replace("@[email protected]", "doxygen/ref-tags.xml") doxygen = doxygen.replace("@[email protected]", "doxygen/ref-warnings.txt") doxygen = doxygen.replace("@[email protected]", "") doxygen = doxygen.replace("@[email protected]", "doc/examples %s/modules/example" % source) doxygen = doxygen.replace("@[email protected]", "doxygen/manual-tags.xml=../manual") doxygen = doxygen.replace("@[email protected]", "doxygen/ref/xml/") doxygen = doxygen.replace("@[email protected]", "lib/IMP/kernel lib/IMP/base") doxygen = doxygen.replace("@[email protected]", "IMP") doxygen = doxygen.replace("@[email protected]", source) \ .replace("@[email protected]", version) doxygen = doxygen.replace("@[email protected]", "include") doxygen = doxygen.replace("@[email protected]", "*.cpp *.h *.py *.md *.dox") # TAGS, INPUT_PATH if is_xml: doxygen = doxygen.replace("@[email protected]", "YES") else: doxygen = doxygen.replace("@[email protected]", "NO") if is_html: doxygen = doxygen.replace("@[email protected]", "YES") else: doxygen = doxygen.replace("@[email protected]", "NO") if manual: inputsh = [source + "/doc/manual", source + "/tools/README.md", source + "/ChangeLog.md"] else: inputsh = ["doxygen/generated", source + "/doc/ref", "include", "doc/examples", "lib/IMP"] for m, p in tools.get_modules(source): doc = os.path.join(p, "doc") if os.path.exists(doc): inputsh.append(doc + "/") doxygen = doxygen.replace("@[email protected]", " ".join(inputsh)) return doxygen
def make_doxygen(options, modules): file = os.path.join("doxygen", options.name, "Doxyfile") name = options.name template_file = os.path.join( options.source, "tools", "build", "doxygen_templates", "Doxyfile.in") template = open(template_file, "r").read() template = template.replace("@[email protected]", options.source) template = template.replace("@[email protected]", "NONE") template = template.replace("@[email protected]", name) template = template.replace("@[email protected]", '"The Integrative Modeling Platform"') template = template.replace("@[email protected]", "YES") template = template.replace("@[email protected]", "*/tutorial/*") template = template.replace("@[email protected]", "NO") template = template.replace("@[email protected]", "YES") template = template.replace("@[email protected]", "IMP." + name) template = template.replace("@[email protected]", "../../doc/html/" + name) template = template.replace("@[email protected]", "xml") template = template.replace("@[email protected]", "NO") template = template.replace("@[email protected]", "tags") template = template.replace("@[email protected]", "%s/doc/doxygen/module_layout.xml" % options.source) template = template.replace("@[email protected]", "README.md") template = template.replace("@INCL[email protected]", "include") template = template.replace("@[email protected]", "*.cpp *.h *.py *.md *.dox") template = template.replace("@[email protected]", "warnings.txt") # include lib and doxygen in imput inputs = [] if options.name == "kernel": inputs.append("include/IMP/") exclude = ["include/IMP/%s include/IMP/%s.h" % (m, m) for m, g in tools.get_modules(options.source) if m != "kernel"] template = template.replace( "@[email protected]", " \\\n ".join(exclude)) else: template = template.replace("@[email protected]", "") inputs.append("include/IMP/" + options.name) inputs.append("lib/IMP/" + options.name) inputs.append("examples/" + options.name) # suppress a warning since git removes empty dirs and doxygen gets confused # if the input path doesn't exist docpath = os.path.join(options.source, "modules", options.name, "doc") if os.path.exists(docpath): inputs.append(docpath) # overview for module inputs.append("../generated/IMP_%s.dox" % options.name) template = template.replace( "@[email protected]", " \\\n ".join(inputs)) tags = [] for m in modules: tags.append(os.path.join("../", m, "tags") + "=" + "../" + m) template = template.replace( "@[email protected]", " \\\n ".join(tags)) if options.name == "example": template = template.replace("@[email protected]", "examples/example %s/modules/example" % options.source) else: template = template.replace( "@[email protected]", "examples/" + options.name) tools.rewrite(file, template)
def check_readme(): for module, g in tools.get_modules("."): if not os.path.exists(os.path.join(g, "README.md")): sys.stderr.write("Each module must have a file 'README.md' describing what what it does and who wrote it.\n") sys.stderr.write(module, "does not.\n") exit(1)
def make_doxygen(options, modules): file = os.path.join("doxygen", options.name, "Doxyfile") name = options.name template_file = os.path.join(options.source, "tools", "build", "doxygen_templates", "Doxyfile.in") template = open(template_file, "r").read() template = template.replace("@[email protected]", options.source) template = template.replace("@[email protected]", "NONE") template = template.replace("@[email protected]", name) template = template.replace("@[email protected]", '"The Integrative Modeling Platform"') template = template.replace("@[email protected]", "YES") template = template.replace("@[email protected]", "*/tutorial/*") template = template.replace("@[email protected]", "NO") template = template.replace("@[email protected]", "YES") template = template.replace("@[email protected]", "IMP." + name) template = template.replace("@[email protected]", "../../doc/html/" + name) template = template.replace("@[email protected]", "xml") template = template.replace("@[email protected]", "NO") template = template.replace("@[email protected]", "tags") template = template.replace( "@[email protected]", "%s/doc/doxygen/module_layout.xml" % options.source) template = template.replace("@[email protected]", "README.md") template = template.replace("@[email protected]", "include") template = template.replace("@[email protected]", "*.cpp *.h *.py *.md *.dox") template = template.replace("@[email protected]", "warnings.txt") # include lib and doxygen in imput inputs = [] if options.name == "kernel": inputs.append("include/IMP/") exclude = [ "include/IMP/%s include/IMP/%s.h" % (m, m) for m, g in tools.get_modules(options.source) if m != "kernel" ] template = template.replace( "@[email protected]", " \\\n ".join(exclude)) else: template = template.replace("@[email protected]", "") inputs.append("include/IMP/" + options.name) inputs.append("lib/IMP/" + options.name) inputs.append("examples/" + options.name) # suppress a warning since git removes empty dirs and doxygen gets confused # if the input path doesn't exist docpath = os.path.join(options.source, "modules", options.name, "doc") if os.path.exists(docpath): inputs.append(docpath) # overview for module inputs.append("../generated/IMP_%s.dox" % options.name) template = template.replace("@[email protected]", " \\\n ".join(inputs)) tags = [] for m in modules: tags.append(os.path.join("../", m, "tags") + "=" + "../" + m) template = template.replace("@[email protected]", " \\\n ".join(tags)) if options.name == "example": template = template.replace( "@[email protected]", "examples/example %s/modules/example" % options.source) else: template = template.replace("@[email protected]", "examples/" + options.name) tools.rewrite(file, template)
def link_data(source): target = os.path.join("data") tools.mkdir(target) for module, g in tools.get_modules(source): tools.link_dir(os.path.join(g, "data"), os.path.join(target, module))
def link_examples(source): target = os.path.join("doc", "examples") tools.mkdir(target) for module, g in tools.get_modules(source): tools.link_dir( os.path.join(g, "examples"), os.path.join(target, module))
def get_output_file_contents(self, options): template = self.template name = options.name modules = self.modules template = template.replace("@[email protected]", options.source) template = template.replace("@[email protected]", "NONE") template = template.replace("@[email protected]", name) template = template.replace("@[email protected]", '"The Integrative Modeling Platform"') template = template.replace("@[email protected]", "YES") template = template.replace("@[email protected]", "*/tutorial/*") template = template.replace("@[email protected]", "NO") template = template.replace("@[email protected]", "YES") template = template.replace("@[email protected]", "IMP." + name) template = template.replace("@[email protected]", "../../doc/html/" + name) template = template.replace("@[email protected]", "xml") template = template.replace("@[email protected]", "NO") template = template.replace("@[email protected]", "tags") template = template.replace("@[email protected]", "%s/doc/doxygen/module_layout.xml" % options.source) template = template.replace("@[email protected]", "README.md") template = template.replace("@[email protected]", "include") template = template.replace("@[email protected]", "*.cpp *.h *.py *.md *.dox") template = template.replace("@[email protected]", "warnings.txt") # include lib and doxygen in input inputs = [] if options.name == "kernel": inputs.append("lib/IMP/") inputs.append("include/IMP/") exclude = ["include/IMP/%s include/IMP/%s.h lib/IMP/%s" % (m, m, m) for m, g in tools.get_modules(options.source)] exclude.append("include/IMP/base include/IMP/base.h lib/IMP/base") template = template.replace("@[email protected]", " \\\n ".join(exclude)) else: template = template.replace("@[email protected]", "") inputs.append("include/IMP/" + options.name) inputs.append("lib/IMP/" + options.name) inputs.append("examples/" + options.name) # suppress a warning since git removes empty dirs and doxygen # gets confused if the input path doesn't exist docpath = os.path.join(options.source, "modules", options.name, "doc") if os.path.exists(docpath): inputs.append(docpath) # overview for module inputs.append("../generated/IMP_%s.dox" % options.name) template = template.replace("@[email protected]", " \\\n ".join(inputs)) tags = [os.path.join(options.source, 'doc', 'doxygen', 'dummy_module_tags.xml')] for m in modules: tags.append(os.path.join("../", m, "tags") + "=" + "../" + m) template = template.replace("@[email protected]", " \\\n ".join(tags)) if options.name == "example": template = template.replace("@[email protected]", "examples/example %s/modules/example" % options.source) else: template = template.replace("@[email protected]", "examples/" + options.name) return template
def generate_tests(source, scons): template = """import IMP import IMP.test import %(module)s spelling_exceptions=%(spelling_exceptions)s class StandardsTest(IMP.test.TestCase): def test_value_objects(self): "Test that module classes are either values or objects" exceptions= %(value_object_exceptions)s return self.assertValueObjects(%(module)s,exceptions) def test_classes(self): "Test that module class names follow the standards" exceptions=%(value_object_exceptions)s return self.assertClassNames(%(module)s, exceptions, spelling_exceptions) def test_functions(self): "Test that module function names follow the standards" exceptions= %(function_name_exceptions)s return self.assertFunctionNames(%(module)s, exceptions, spelling_exceptions) def test_show(self): "Test all objects have show" exceptions=%(show_exceptions)s return self.assertShow(%(module)s, exceptions) if __name__ == '__main__': IMP.test.main() """ target = os.path.join("test") tools.mkdir(target) for module, g in tools.get_modules(source): targetdir = os.path.join(target, module) tools.mkdir(targetdir) exceptions = os.path.join(g, "test", "standards_exceptions") plural_exceptions = [] show_exceptions = [] function_name_exceptions = [] value_object_exceptions = [] class_name_exceptions = [] spelling_exceptions = [] try: exec open(exceptions, "r").read() except: pass impmodule = "IMP." + module test = template % ( { 'module': impmodule, 'plural_exceptions': str(plural_exceptions), 'show_exceptions': str(show_exceptions), 'function_name_exceptions': str(function_name_exceptions), 'value_object_exceptions': str(value_object_exceptions), 'class_name_exceptions': str(class_name_exceptions), 'spelling_exceptions': str(spelling_exceptions) }) open(os.path.join("test", module, "medium_test_standards.py"), "w").write(test) cpptests = tools.get_glob([os.path.join(g, "test", "test_*.cpp")]) ecpptests = tools.get_glob( [os.path.join(g, "test", "expensive_test_*.cpp")]) cppexamples = tools.get_glob([os.path.join(g, "examples", "*.cpp")]) if len(cpptests) > 0 and scons: _make_test_driver(os.path.join(targetdir, "test_cpp_tests.py"), cpptests) if len(ecpptests) > 0 and scons: _make_test_driver( os.path.join(targetdir, "expensive_test_cpp_tests.py"), cpptests) if len(cppexamples) > 0 and scons: _make_test_driver(os.path.join(targetdir, "cpp_examples_test.py"), cppexamples) for app, g in tools.get_applications(source): tools.mkdir(os.path.join(target, app))
def generate_tests(source, scons): template = """import IMP import IMP.test import %(module)s spelling_exceptions=%(spelling_exceptions)s class StandardsTest(IMP.test.TestCase): def test_value_objects(self): "Test that module classes are either values or objects" exceptions= %(value_object_exceptions)s return self.assertValueObjects(%(module)s,exceptions) def test_classes(self): "Test that module class names follow the standards" exceptions=%(value_object_exceptions)s return self.assertClassNames(%(module)s, exceptions, spelling_exceptions) def test_functions(self): "Test that module function names follow the standards" exceptions= %(function_name_exceptions)s return self.assertFunctionNames(%(module)s, exceptions, spelling_exceptions) def test_show(self): "Test all objects have show" exceptions=%(show_exceptions)s return self.assertShow(%(module)s, exceptions) if __name__ == '__main__': IMP.test.main() """ target = os.path.join("test") tools.mkdir(target) for module, g in tools.get_modules(source): targetdir = os.path.join(target, module) tools.mkdir(targetdir) exceptions = os.path.join(g, "test", "standards_exceptions") d = {'plural_exceptions': [], 'show_exceptions': [], 'function_name_exceptions': [], 'value_object_exceptions': [], 'class_name_exceptions': [], 'spelling_exceptions': []} try: exec(open(exceptions, "r").read(), d) except IOError: pass impmodule = "IMP." + module test = template % ({'module': impmodule, 'plural_exceptions': str(d['plural_exceptions']), 'show_exceptions': str(d['show_exceptions']), 'function_name_exceptions': str(d['function_name_exceptions']), 'value_object_exceptions': str(d['value_object_exceptions']), 'class_name_exceptions': str(d['class_name_exceptions']), 'spelling_exceptions': str(d['spelling_exceptions'])}) open( os.path.join("test", module, "medium_test_standards.py"), "w").write(test) cpptests = tools.get_glob([os.path.join(g, "test", "test_*.cpp")]) ecpptests = tools.get_glob( [os.path.join(g, "test", "expensive_test_*.cpp")]) cppexamples = tools.get_glob([os.path.join(g, "examples", "*.cpp")]) if len(cpptests) > 0 and scons: _make_test_driver( os.path.join( targetdir, "test_cpp_tests.py"), cpptests) if len(ecpptests) > 0 and scons: _make_test_driver( os.path.join(targetdir, "expensive_test_cpp_tests.py"), cpptests) if len(cppexamples) > 0 and scons: _make_test_driver( os.path.join(targetdir, "cpp_examples_test.py"), cppexamples)
def generate_doxyfile(source, target, is_xml = False, is_html = False, tutorial=False): doxyin=os.path.join(source, "tools", "build", "doxygen_templates", "Doxyfile.in") version="develop" versionpath=os.path.join("VERSION") if os.path.exists(versionpath): version= open(versionpath, "r").read().strip() if tutorial: version = '"for IMP version ' + version + '"' doxygen = open(doxyin, "r").read() if tutorial: doxygen = doxygen.replace("@[email protected]", '"IMP Tutorial"') doxygen = doxygen.replace("@[email protected]", "") doxygen = doxygen.replace("@[email protected]", "") doxygen = doxygen.replace("@[email protected]", "NO") doxygen = doxygen.replace("@[email protected]", "doc/tutorial/") doxygen = doxygen.replace("@[email protected]", "") doxygen = doxygen.replace("@[email protected]", "") doxygen = doxygen.replace("@[email protected]", "doxygen/tutorial-warnings.txt") doxygen = doxygen.replace("@[email protected]", "") doxygen = doxygen.replace("@[email protected]", ".") doxygen = doxygen.replace("@[email protected]", "doxygen/tags.html=../html") else: doxygen = doxygen.replace("@[email protected]", "IMP") doxygen = doxygen.replace("@[email protected]", '"The Integrative Modeling Platform"') doxygen = doxygen.replace("@[email protected]", "mainpage.md") doxygen = doxygen.replace("@[email protected]", "YES") doxygen = doxygen.replace("@[email protected]", "doc/html/") doxygen = doxygen.replace("@[email protected]", "%s/doc/doxygen/main_layout.xml" % source) doxygen = doxygen.replace("@[email protected]", "doxygen/tags.html") doxygen = doxygen.replace("@[email protected]", "doxygen/warnings.txt") doxygen = doxygen.replace("@[email protected]", "*/tutorial/*") doxygen = doxygen.replace("@[email protected]", "doc/examples %s/modules/example"%source) doxygen = doxygen.replace("@[email protected]", "") doxygen = doxygen.replace( "@[email protected]", "IMP") doxygen = doxygen.replace( "@[email protected]", source).replace("@[email protected]", version) doxygen = doxygen.replace("@[email protected]", "") doxygen = doxygen.replace("@[email protected]", "include") doxygen = doxygen.replace("@[email protected]", "*.cpp *.h *.py *.md *.dox") doxygen = doxygen.replace("@[email protected]", "doxygen/xml/") # TAGS, INPUT_PATH if is_xml: doxygen = doxygen.replace("@[email protected]", "YES") else: doxygen = doxygen.replace("@[email protected]", "NO") if is_html: doxygen = doxygen.replace( "@[email protected]", "YES") else: doxygen = doxygen.replace( "@[email protected]", "NO") # skip linking later inputsh = ["doxygen/generated", source + "/doc", source + "/ChangeLog.md", source + "/tools/README.md", "include", "doc/examples"] for m, p in tools.get_modules(source): doc = os.path.join(p, "doc") inputsh.append(os.path.join("lib", "IMP", m)) if os.path.exists(doc): inputsh.append(doc + "/") for m, p in tools.get_applications(source): doc = os.path.join(p, "doc") if os.path.exists(doc): inputsh.append(doc + "/") if not tutorial: doxygen = doxygen.replace("@[email protected]", " ".join(inputsh)) open(target, "w").write(doxygen)