コード例 #1
0
ファイル: setup_application.py プロジェクト: drussel/imp
def setup_application(application, source, datapath, scons):
    print "Configuring application", application, "...",
    data= tools.get_application_description(source, application, datapath)
    for d in data["required_dependencies"]:
        if not tools.get_dependency_info(d, datapath)["ok"]:
            write_no_ok(application, scons)
            #exits
    dependencies = data["required_dependencies"]
    unfound_dependencies = []
    for d in data["optional_dependencies"]:
        if tools.get_dependency_info(d, datapath)["ok"]:
            dependencies.append(d)
        else:
            unfound_dependencies.append(d)
    for d in data["required_modules"]:
        if not tools.get_module_info(d, datapath)["ok"]:
            write_no_ok(application, scons)
            # exits
    modules= data["required_modules"]
    unfound_modules = []
    for d in data["optional_modules"]:
        if tools.get_module_info(d, datapath)["ok"]:
            modules.append(d)
        else:
            unfound_modules.append(d)
    all_modules=tools.get_dependent_modules(modules, datapath)
    link_py(os.path.join(source, "applications", application))
    write_ok(application, all_modules,
             unfound_modules,
        tools.get_dependent_dependencies(all_modules, dependencies, datapath),
        unfound_dependencies)
コード例 #2
0
def setup_application(application, source, datapath, apps):
    print "Configuring application", application, "...",
    data = tools.get_application_description(source, application, datapath)
    for d in data["required_dependencies"]:
        if not tools.get_dependency_info(d, datapath)["ok"]:
            write_no_ok(application)
            # exits
    dependencies = data["required_dependencies"]
    unfound_dependencies = []
    for d in data["optional_dependencies"]:
        if tools.get_dependency_info(d, datapath)["ok"]:
            dependencies.append(d)
        else:
            unfound_dependencies.append(d)
    for d in data["required_modules"]:
        if not tools.get_module_info(d, datapath)["ok"]:
            write_no_ok(application)
            # exits
    modules = data["required_modules"]
    unfound_modules = []
    for d in data["optional_modules"]:
        if tools.get_module_info(d, datapath)["ok"]:
            modules.append(d)
        else:
            unfound_modules.append(d)
    all_modules = tools.get_dependent_modules(modules, datapath)
    link_py_apps(os.path.join(source, "applications", application))
    make_doxygen(application, source, all_modules)
    make_overview(application, source, apps)
    write_ok(
        application, all_modules, unfound_modules,
        tools.get_dependent_dependencies(all_modules, dependencies, datapath),
        unfound_dependencies)
コード例 #3
0
def setup_module(module, source, datapath):
    sys.stdout.write("Configuring module %s ..." % module)
    data = tools.get_module_description(source, module, datapath)
    for d in data["required_dependencies"]:
        if not tools.get_dependency_info(d, datapath)["ok"]:
            print("Required dependency %s not found" % d)
            write_no_ok(module)
            return False, []
    dependencies = data["required_dependencies"]
    unfound_dependencies = []
    for d in data["optional_dependencies"]:
        if tools.get_dependency_info(d, datapath)["ok"]:
            dependencies.append(d)
        else:
            unfound_dependencies.append(d)
    for d in data["required_modules"]:
        if not tools.get_module_info(d, datapath)["ok"]:
            print("Required module IMP.%s not available" % d)
            write_no_ok(module)
            return False, []
    modules = data["required_modules"]
    unfound_modules = []
    for d in data["optional_modules"]:
        if tools.get_module_info(d, datapath)["ok"]:
            modules.append(d)
        else:
            unfound_modules.append(d)
    all_modules = tools.get_dependent_modules(modules, datapath)
    moddir = os.path.join('IMP', '' if module == 'kernel' else module)
    swig_includes = [os.path.split(x)[1]
                     for x in tools.get_glob(
                         [os.path.join(source, "modules", module, "pyext",
                                       "include", "*.i")])] \
                    + [os.path.join(moddir, os.path.split(x)[1])
                       for x in tools.get_glob(
                           [os.path.join("include", moddir, "*_macros.h")])]
    swig_wrapper_includes = [os.path.join(moddir, "internal",
                                          os.path.split(x)[1])
                             for x in tools.get_glob(
                                 [os.path.join(source, "modules", module,
                                               "include", "internal",
                                               "swig*.h")])]
    tools.mkdir(os.path.join("src", module))
    tools.mkdir(os.path.join("src", module + "_swig"))
    write_ok(module, all_modules, unfound_modules,
             tools.get_dependent_dependencies(all_modules, dependencies,
                                              datapath),
             unfound_dependencies, swig_includes, swig_wrapper_includes)
    return True, all_modules
コード例 #4
0
ファイル: setup_module.py プロジェクト: j-ma-bu-l-l-ock/imp
def setup_module(module, source, datapath):
    sys.stdout.write("Configuring module %s ..." % module)
    data = tools.get_module_description(source, module, datapath)
    for d in data["required_dependencies"]:
        if not tools.get_dependency_info(d, datapath)["ok"]:
            print("Required dependency %s not found" % d)
            write_no_ok(module)
            return False, []
    dependencies = data["required_dependencies"]
    unfound_dependencies = []
    for d in data["optional_dependencies"]:
        if tools.get_dependency_info(d, datapath)["ok"]:
            dependencies.append(d)
        else:
            unfound_dependencies.append(d)
    for d in data["required_modules"]:
        if not tools.get_module_info(d, datapath)["ok"]:
            print("Required module IMP.%s not available" % d)
            write_no_ok(module)
            return False, []
    modules = data["required_modules"]
    unfound_modules = []
    for d in data["optional_modules"]:
        if tools.get_module_info(d, datapath)["ok"]:
            modules.append(d)
        else:
            unfound_modules.append(d)
    all_modules = tools.get_dependent_modules(modules, datapath)
    moddir = os.path.join('IMP', '' if module == 'kernel' else module)
    swig_includes = [os.path.split(x)[1] for x
                     in tools.get_glob([os.path.join(source, "modules", module,
                                                     "pyext", "include", "*.i")])]\
        + [os.path.join(moddir, os.path.split(x)[1]) for x
           in tools.get_glob([os.path.join("include", moddir, "*_macros.h")])]
    swig_wrapper_includes = [os.path.join(moddir, "internal", os.path.split(x)[1]) for x
                             in tools.get_glob([os.path.join(source, "modules", module, "include", "internal", "swig*.h")])]
    tools.mkdir(os.path.join("src", module))
    tools.mkdir(os.path.join("src", module + "_swig"))
    write_ok(module, all_modules,
             unfound_modules, tools.get_dependent_dependencies(
                 all_modules, dependencies, datapath),
             unfound_dependencies, swig_includes, swig_wrapper_includes)
    return True, all_modules
コード例 #5
0
ファイル: setup_module.py プロジェクト: sirusb/imp
def setup_module(module, source, datapath):
    print "Configuring module", module, "...",
    data = tools.get_module_description(source, module, datapath)
    for d in data["required_dependencies"]:
        if not tools.get_dependency_info(d, datapath)["ok"]:
            print d, "not found"
            write_no_ok(module)
            return False, []
    dependencies = data["required_dependencies"]
    unfound_dependencies = []
    for d in data["optional_dependencies"]:
        if tools.get_dependency_info(d, datapath)["ok"]:
            dependencies.append(d)
        else:
            unfound_dependencies.append(d)
    for d in data["required_modules"]:
        if not tools.get_module_info(d, datapath)["ok"]:
            print "IMP." + d, "not found"
            write_no_ok(module)
            return False, []
    modules = data["required_modules"]
    unfound_modules = []
    for d in data["optional_modules"]:
        if tools.get_module_info(d, datapath)["ok"]:
            modules.append(d)
        else:
            unfound_modules.append(d)
    all_modules = tools.get_dependent_modules(modules, datapath)
    swig_includes = [os.path.split(x)[1] for x
                     in tools.get_glob([os.path.join(source, "modules", module,
                                                     "pyext", "include", "*.i")])]\
        + ["IMP/" + module + "/" + os.path.split(x)[1] for x
           in tools.get_glob([os.path.join("include", "IMP", module, "*_macros.h")])]
    swig_wrapper_includes = ["IMP/" + module + "/internal/" + os.path.split(x)[1] for x
                             in tools.get_glob([os.path.join(source, "modules", module, "include", "internal", "swig*.h")])]
    tools.mkdir(os.path.join("src", module))
    tools.mkdir(os.path.join("src", module + "_swig"))
    write_ok(module, all_modules,
             unfound_modules, tools.get_dependent_dependencies(
                 all_modules, dependencies, datapath),
             unfound_dependencies, swig_includes, swig_wrapper_includes)
    return True, all_modules
コード例 #6
0
ファイル: setup_module.py プロジェクト: drussel/imp
def setup_module(module, source, datapath):
    print "Configuring module", module, "...",
    data= tools.get_module_description(source, module, datapath)
    for d in data["required_dependencies"]:
        if not tools.get_dependency_info(d, datapath)["ok"]:
            print d, "not found"
            write_no_ok(module)
            return False
    dependencies = data["required_dependencies"]
    unfound_dependencies = []
    for d in data["optional_dependencies"]:
        if tools.get_dependency_info(d, datapath)["ok"]:
            dependencies.append(d)
        else:
            unfound_dependencies.append(d)
    for d in data["required_modules"]:
        if not tools.get_module_info(d, datapath)["ok"]:
            print "IMP."+d, "not found"
            write_no_ok(module)
            return False
    modules= data["required_modules"]
    unfound_modules = []
    for d in data["optional_modules"]:
        if tools.get_module_info(d, datapath)["ok"]:
            modules.append(d)
        else:
            unfound_modules.append(d)
    all_modules=tools.get_dependent_modules(modules, datapath)
    swig_includes=[os.path.split(x)[1] for x
                   in tools.get_glob([os.path.join(source, "modules", module,
                                                   "pyext", "include", "*.i")])]\
                 + ["IMP/"+module+"/"+os.path.split(x)[1] for x
                            in tools.get_glob([os.path.join("include", "IMP", module, "*_macros.h")])]
    swig_wrapper_includes= ["IMP/"+module+"/internal/"+os.path.split(x)[1] for x
                   in tools.get_glob([os.path.join(source, "modules", module, "include", "internal", "swig*.h")])]
    tools.mkdir(os.path.join("src", module))
    tools.mkdir(os.path.join("src", module+"_swig"))
    write_ok(module, all_modules,
             unfound_modules, tools.get_dependent_dependencies(all_modules, dependencies,datapath),
             unfound_dependencies, swig_includes, swig_wrapper_includes)
    return True
コード例 #7
0
ファイル: setup_swig_wrappers.py プロジェクト: sirusb/imp
def build_wrapper(module, module_path, source, sorted, info, target, datapath):
    info = tools.get_module_info(module, datapath)
    if not info["ok"]:
        return
    contents = []
    swig_module_name = "IMP." + module

    contents.append("""%%module(directors="1", allprotected="1") "%s"
%%feature("autodoc", 1);
// Warning 314: 'lambda' is a python keyword, renaming to '_lambda'
%%warnfilter(321,302,314);

%%inline %%{
namespace IMP {
namespace kernel {
}
using namespace kernel;
}
%%}

%%{
#include <boost/version.hpp>
#if BOOST_VERSION > 103600
#if BOOST_VERSION > 103800
#include <boost/exception/all.hpp>
#else
#include <boost/exception.hpp>
#endif
#endif

#include <boost/type_traits/is_convertible.hpp>
#include <boost/utility/enable_if.hpp>
#include <exception>

#ifdef __cplusplus
extern "C"
#endif

// suppress warning
SWIGEXPORT
#if PY_VERSION_HEX >= 0x03000000
PyObject*
#else
void
#endif
SWIG_init();
%%}
""" % swig_module_name)
    # some of the typemap code ends up before this is swig sees the
    # typemaps first
    all_deps = [
        x for x in tools.get_dependent_modules([module], datapath)
        if x != module
    ]
    for m in reversed(all_deps):
        write_module_cpp(m, contents, datapath)

    write_module_cpp(module, contents, datapath)
    contents.append("""
%implicitconv;
%include "std_vector.i"
%include "std_string.i"
%include "std_pair.i"


%pythoncode %{
_value_types=[]
_object_types=[]
_raii_types=[]
_plural_types=[]
%}

%include "typemaps.i"

#ifdef NDEBUG
#error "The python wrappers must not be built with NDEBUG"
#endif

""")

    for m in reversed(all_deps):
        write_module_swig(m, source, contents, datapath)

    write_module_swig(module, source, contents, datapath, True)

    contents.append("%%include \"IMP_%s.impl.i\"" % module)
    #contents.append(open(os.path.join(module_path, "pyext", "swig.i-in"), "r").read())

    contents.append("""
namespace IMP {
namespace %s {
const std::string get_module_version();
std::string get_example_path(std::string fname);
std::string get_data_path(std::string fname);
}
}
""" % module)
    contents.append("""%pythoncode %{
import _version_check
_version_check.check_version(get_module_version())
%}
""")
    tools.rewrite(target, "\n".join(contents))
コード例 #8
0
ファイル: setup_swig_wrappers.py プロジェクト: AljGaber/imp
def build_wrapper(module, module_path, source, sorted, info, target, datapath):
    info = tools.get_module_info(module, datapath)
    if not info["ok"]:
        return
    contents = []
    swig_module_name = "IMP" if module == 'kernel' else "IMP." + module

    contents.append("""%%module(directors="1", allprotected="1") "%s"
%%feature("autodoc", 1);
// Warning 314: 'lambda' is a python keyword, renaming to '_lambda'
%%warnfilter(321,302,314);

%%{
#include <boost/version.hpp>
#if BOOST_VERSION > 103600
#if BOOST_VERSION > 103800
#include <boost/exception/all.hpp>
#else
#include <boost/exception.hpp>
#endif
#endif

#include <boost/type_traits/is_convertible.hpp>
#include <boost/utility/enable_if.hpp>
#include <exception>

#ifdef __cplusplus
extern "C"
#endif

// suppress warning
SWIGEXPORT
#if PY_VERSION_HEX >= 0x03000000
PyObject*
#else
void
#endif
SWIG_init();
%%}
""" % swig_module_name)
        # some of the typemap code ends up before this is swig sees the
        # typemaps first
    all_deps = [x for x in tools.get_dependent_modules(
        [module], datapath) if x != module]
    for m in reversed(all_deps):
        write_module_cpp(m, contents, datapath)

    write_module_cpp(module, contents, datapath)
    contents.append("""
%implicitconv;
%include "std_vector.i"
%include "std_string.i"
%include "std_pair.i"


%pythoncode %{
_value_types=[]
_object_types=[]
_raii_types=[]
_plural_types=[]
%}

%include "typemaps.i"

#ifdef NDEBUG
#error "The python wrappers must not be built with NDEBUG"
#endif

""")

    for m in reversed(all_deps):
        write_module_swig(m, source, contents, datapath)

    write_module_swig(module, source, contents, datapath, True)

    contents.append("%%include \"IMP_%s.impl.i\"" % module)
    #contents.append(open(os.path.join(module_path, "pyext", "swig.i-in"), "r").read())

    contents.append("""
namespace IMP { %s
const std::string get_module_version();
std::string get_example_path(std::string fname);
std::string get_data_path(std::string fname);
%s }
""" % ('' if module == 'kernel' else 'namespace %s {' % module,
       '' if module == 'kernel' else '}'))
    contents.append("""%pythoncode %{
from . import _version_check
_version_check.check_version(get_module_version())
__version__ = get_module_version()
%}
""")
    g = tools.SWIGFileGenerator()
    g.write(target, "\n".join(contents))
コード例 #9
0
ファイル: setup_swig_wrappers.py プロジェクト: drussel/imp
def build_wrapper(module, module_path, source, sorted, info, target, datapath):
    info = tools.get_module_info(module, datapath)
    if not info["ok"]:
        return
    contents=[]
    swig_module_name="IMP."+module

    contents.append("""%%module(directors="1", allprotected="1") "%s"
%%feature("autodoc", 1);
// turn off the warning as it mostly triggers on methods (and lots of them)
%%warnfilter(321);

%%inline %%{
namespace IMP {
namespace kernel {
}
using namespace kernel;
}
%%}

%%{
#include <boost/version.hpp>
#if BOOST_VERSION > 103600
#if BOOST_VERSION > 103800
#include <boost/exception/all.hpp>
#else
#include <boost/exception.hpp>
#endif
#endif

#include <boost/type_traits/is_convertible.hpp>
#include <boost/utility/enable_if.hpp>
#include <exception>

%%}
"""%swig_module_name)
        # some of the typemap code ends up before this is swig sees the typemaps first
    all_deps = [x for x in tools.get_dependent_modules([module], datapath) if x != module]
    for m in reversed(all_deps):
        write_module_cpp(m, contents, datapath)

    write_module_cpp(module, contents, datapath)
    contents.append("""
%implicitconv;
%include "std_vector.i"
%include "std_string.i"
%include "std_pair.i"


%pythoncode %{
_value_types=[]
_object_types=[]
_raii_types=[]
_plural_types=[]
%}

%include "typemaps.i"

#ifdef NDEBUG
#error "The python wrappers must not be built with NDEBUG"
#endif

""")

    for m in reversed(all_deps):
        write_module_swig(m, source, contents, datapath)

    write_module_swig(module, source, contents, datapath, True)

    contents.append("%%include \"IMP_%s.impl.i\""%module)
    #contents.append(open(os.path.join(module_path, "pyext", "swig.i-in"), "r").read())

    contents.append("""
namespace IMP {
namespace %s {
const std::string get_module_version();
std::string get_example_path(std::string fname);
std::string get_data_path(std::string fname);
}
}
"""%module)
    contents.append("""%pythoncode %{
import _version_check
_version_check.check_version(get_module_version())
%}
""")
    tools.rewrite(target, "\n".join(contents))