예제 #1
0
파일: build_all.py 프로젝트: apolitis/imp
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
예제 #2
0
파일: setup.py 프로젝트: drussel/imp
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("*/")
예제 #3
0
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)
예제 #4
0
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)
예제 #5
0
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)
예제 #6
0
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)
예제 #7
0
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))
예제 #8
0
파일: setup.py 프로젝트: drussel/imp
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)
예제 #9
0
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)
예제 #10
0
def generate_overview_pages(source):
    name = os.path.join("doxygen", "generated", "applications.dox")
    contents = []
    contents.append("/** ")
    contents.append("\\page applications All IMP Applications")
    contents.append("""
IMP provides a number of applications (command line tools).
These are listed below:""")
    for bs, g in tools.get_applications(source):
        contents.append("- \subpage imp%s \"IMP.%s\"" % (bs, bs))
        p = pickle.load(
            open(os.path.join("data", "build_info", "IMP_%s.pck" % 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))
예제 #11
0
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))
예제 #12
0
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("@PROJECT_NAME@", '"IMP Tutorial"')
        doxygen = doxygen.replace("@PROJECT_BRIEF@", "")
        doxygen = doxygen.replace("@MAINPAGE@", "")
        doxygen = doxygen.replace("@RECURSIVE@", "NO")
        doxygen = doxygen.replace("@HTML_OUTPUT@", "doc/tutorial/")
        doxygen = doxygen.replace("@LAYOUT_FILE@", "")
        doxygen = doxygen.replace("@GENERATE_TAGFILE@", "")
        doxygen = doxygen.replace("@WARNINGS@", "doxygen/tutorial-warnings.txt")
        doxygen = doxygen.replace("@EXCLUDE_PATTERNS@", "")
        doxygen = doxygen.replace("@EXAMPLE_PATH@", ".")
        doxygen = doxygen.replace("@TAGS@", "doxygen/tags.html=../html")
    else:
        doxygen = doxygen.replace("@PROJECT_NAME@", "IMP")
        doxygen = doxygen.replace("@PROJECT_BRIEF@",
                                  '"The Integrative Modeling Platform"')
        doxygen = doxygen.replace("@MAINPAGE@", "mainpage.md")
        doxygen = doxygen.replace("@RECURSIVE@", "YES")
        doxygen = doxygen.replace("@HTML_OUTPUT@", "doc/html/")
        doxygen = doxygen.replace("@LAYOUT_FILE@",
                                  "%s/doc/doxygen/main_layout.xml" % source)
        doxygen = doxygen.replace("@GENERATE_TAGFILE@", "doxygen/tags.html")
        doxygen = doxygen.replace("@WARNINGS@", "doxygen/warnings.txt")
        doxygen = doxygen.replace("@EXCLUDE_PATTERNS@", "*/tutorial/*")
        doxygen = doxygen.replace("@EXAMPLE_PATH@", "doc/examples %s/modules/example"%source)
        doxygen = doxygen.replace("@TAGS@", "")
    doxygen = doxygen.replace( "@NAME@", "IMP")
    doxygen = doxygen.replace( "@IMP_SOURCE_PATH@", source).replace("@VERSION@", version)
    doxygen = doxygen.replace("@EXCLUDE@", "")
    doxygen = doxygen.replace("@INCLUDE_PATH@", "include")
    doxygen = doxygen.replace("@FILE_PATTERNS@", "*.cpp *.h *.py *.md *.dox")
    doxygen = doxygen.replace("@XML_OUTPUT@", "doxygen/xml/")
    # TAGS, INPUT_PATH
    if is_xml:
        doxygen = doxygen.replace("@IS_XML@", "YES")
    else:
        doxygen = doxygen.replace("@IS_XML@", "NO")
    if is_html:
        doxygen = doxygen.replace( "@IS_HTML@", "YES")
    else:
        doxygen = doxygen.replace( "@IS_HTML@", "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("@INPUT_PATH@", " ".join(inputsh))
    open(target, "w").write(doxygen)
예제 #13
0
파일: setup.py 프로젝트: drussel/imp
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, "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))
예제 #14
0
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("@PROJECT_NAME@", '"IMP Tutorial"')
        doxygen = doxygen.replace("@PROJECT_BRIEF@", "")
        doxygen = doxygen.replace("@MAINPAGE@", "")
        doxygen = doxygen.replace("@RECURSIVE@", "NO")
        doxygen = doxygen.replace("@HTML_OUTPUT@", "doc/tutorial/")
        doxygen = doxygen.replace("@LAYOUT_FILE@", "")
        doxygen = doxygen.replace("@GENERATE_TAGFILE@", "")
        doxygen = doxygen.replace("@WARNINGS@",
                                  "doxygen/tutorial-warnings.txt")
        doxygen = doxygen.replace("@EXCLUDE_PATTERNS@", "")
        doxygen = doxygen.replace("@EXAMPLE_PATH@", ".")
        doxygen = doxygen.replace("@TAGS@", "doxygen/tags.html=../html")
    else:
        doxygen = doxygen.replace("@PROJECT_NAME@", "IMP")
        doxygen = doxygen.replace("@PROJECT_BRIEF@",
                                  '"The Integrative Modeling Platform"')
        doxygen = doxygen.replace("@MAINPAGE@", "mainpage.md")
        doxygen = doxygen.replace("@RECURSIVE@", "YES")
        doxygen = doxygen.replace("@HTML_OUTPUT@", "doc/html/")
        doxygen = doxygen.replace("@LAYOUT_FILE@",
                                  "%s/doc/doxygen/main_layout.xml" % source)
        doxygen = doxygen.replace("@GENERATE_TAGFILE@", "doxygen/tags.html")
        doxygen = doxygen.replace("@WARNINGS@", "doxygen/warnings.txt")
        doxygen = doxygen.replace("@EXCLUDE_PATTERNS@", "*/tutorial/*")
        doxygen = doxygen.replace("@EXAMPLE_PATH@",
                                  "doc/examples %s/modules/example" % source)
        doxygen = doxygen.replace("@TAGS@", "")
    doxygen = doxygen.replace("@NAME@", "IMP")
    doxygen = doxygen.replace("@IMP_SOURCE_PATH@",
                              source).replace("@VERSION@", version)
    doxygen = doxygen.replace("@EXCLUDE@", "")
    doxygen = doxygen.replace("@INCLUDE_PATH@", "include")
    doxygen = doxygen.replace("@FILE_PATTERNS@", "*.cpp *.h *.py *.md *.dox")
    doxygen = doxygen.replace("@XML_OUTPUT@", "doxygen/xml/")
    # TAGS, INPUT_PATH
    if is_xml:
        doxygen = doxygen.replace("@IS_XML@", "YES")
    else:
        doxygen = doxygen.replace("@IS_XML@", "NO")
    if is_html:
        doxygen = doxygen.replace("@IS_HTML@", "YES")
    else:
        doxygen = doxygen.replace("@IS_HTML@", "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("@INPUT_PATH@", " ".join(inputsh))
    open(target, "w").write(doxygen)