Example #1
0
 def native_paths(self, paths, also_with_suffix=False):
     """Convert cmake-provided paths into native paths"""
     ret = [tools.from_cmake_path(x) for x in paths]
     if self.options.suffix and also_with_suffix:
         ret += [os.path.join(tools.from_cmake_path(x),
                              self.options.suffix) for x in paths]
     return ret
Example #2
0
def run_swig(outputdir, options):
    args = [options.swig]
    args.append("-castmode")
    args.extend(["-interface", "_IMP_%s" % options.module])
    args.append("-DPySwigIterator=IMP_%s_PySwigIterator" %
                options.module.upper())
    args.append("-DSwigPyIterator=IMP_%s_SwigPyIterator" %
                options.module.upper())
    args.append("-python")
    args.append("-c++")
    args.append("-naturalvar")
    args.append("-modern")
    args.append("-fvirtual")
    args.append("-Wextra")
    args.append("-I" + os.path.join("..", "..", "include"))
    args.append("-I" + os.path.join("..", "..", "swig"))
    args.extend(["-oh", "wrap.h-in"])
    args.extend(["-o", "wrap.cpp-in"])
    if options.module == "base":
        args.append("-DIMP_SWIG_BASE")
    for p in options.swigpath:
        args.append("-I%s" % tools.from_cmake_path(p))
    for p in options.includepath:
        args.append("-I%s" % tools.from_cmake_path(p))
    args.append(os.path.abspath("./swig/IMP_%s.i" % options.module))

    ret = tools.run_subprocess(args, cwd=outputdir)
    if len(
            open("src/%s_swig/IMP.%s.py" %
                 (options.module, options.module), "r").read()) < 10:
        raise IOError("Empty swig wrapper file")
    tools.link("src/%s_swig/IMP.%s.py" % (options.module, options.module),
               "lib/IMP/%s/__init__.py" % options.module)
Example #3
0
def run_swig(outputdir, options):
    args = [options.swig]
    args.append("-castmode")
    args.extend(["-interface", "_IMP_%s" % options.module])
    args.append(
        "-DPySwigIterator=IMP_%s_PySwigIterator" %
        options.module.upper())
    args.append(
        "-DSwigPyIterator=IMP_%s_SwigPyIterator" %
        options.module.upper())
    args.append("-python")
    args.append("-c++")
    args.append("-naturalvar")
    args.append("-modern")
    args.append("-fvirtual")
    args.append("-Wextra")
    args.append("-I" + os.path.join("..", "..", "include"))
    args.append("-I" + os.path.join("..", "..", "swig"))
    args.extend(["-oh", "wrap.h-in"])
    args.extend(["-o", "wrap.cpp-in"])
    if options.module == "base":
        args.append("-DIMP_SWIG_BASE")
    for p in options.swigpath:
        args.append("-I%s" % tools.from_cmake_path(p))
    for p in options.includepath:
        args.append("-I%s" % tools.from_cmake_path(p))
    args.append(os.path.abspath("./swig/IMP_%s.i" % options.module))

    ret = tools.run_subprocess(args, cwd=outputdir)
    if len(open("src/%s_swig/IMP.%s.py" % (options.module, options.module), "r").read()) < 10:
        raise IOError("Empty swig wrapper file")
    tools.link("src/%s_swig/IMP.%s.py" % (options.module, options.module),
               "lib/IMP/%s/__init__.py" % options.module)
Example #4
0
def run_swig(outputdir, options):
    args = [options.swig]
    args.append("-castmode")
    args.extend(["-interface", "_IMP_%s" % options.module])
    args.append(
        "-DPySwigIterator=IMP_%s_PySwigIterator" %
        options.module.upper())
    args.append(
        "-DSwigPyIterator=IMP_%s_SwigPyIterator" %
        options.module.upper())
    args.append("-python")
    args.append("-c++")
    args.append("-naturalvar")
    args.append("-modern")
    args.append("-fvirtual")
    args.append("-Wextra")
    args.append("-I" + os.path.join("..", "..", "include"))
    args.append("-I" + os.path.join("..", "..", "swig"))
    args.extend(["-oh", "wrap.h-in"])
    args.extend(["-o", "wrap.cpp-in"])
    if options.module == "kernel":
        args.append("-DIMP_SWIG_KERNEL")
    for p in options.swigpath:
        args.append("-I%s" % tools.from_cmake_path(p))
    for p in options.includepath:
        args.append("-I%s" % tools.from_cmake_path(p))
    args.append(os.path.abspath("./swig/IMP_%s.i" % options.module))

    ret = tools.run_subprocess(args, cwd=outputdir)
    patch_py_wrapper("src/%s_swig/IMP.%spy"
                     % (options.module, '' if options.module == 'kernel'
                                        else options.module + '.'),
                     os.path.join("lib", "IMP",
                          "" if options.module == 'kernel' else options.module,
                          "__init__.py"))
Example #5
0
 def native_paths(self, paths, also_with_suffix=False):
     """Convert cmake-provided paths into native paths"""
     ret = [tools.from_cmake_path(x) for x in paths]
     if self.options.suffix and also_with_suffix:
         ret += [os.path.join(tools.from_cmake_path(x),
                              self.options.suffix) for x in paths]
     return ret
Example #6
0
def run_swig(outputdir, options):
    args = [options.swig]
    args.append("-castmode")
    args.extend(["-interface", "_IMP_%s" % options.module])
    args.append("-DPySwigIterator=IMP_%s_PySwigIterator" %
                options.module.upper())
    args.append("-DSwigPyIterator=IMP_%s_SwigPyIterator" %
                options.module.upper())
    args.append("-python")
    args.append("-c++")
    args.append("-naturalvar")
    args.append("-modern")
    args.append("-fvirtual")
    args.append("-Wextra")
    args.append("-I" + os.path.join("..", "..", "include"))
    args.append("-I" + os.path.join("..", "..", "swig"))
    args.extend(["-oh", "wrap.h-in"])
    args.extend(["-o", "wrap.cpp-in"])
    if options.module == "kernel":
        args.append("-DIMP_SWIG_KERNEL")
    for p in options.swigpath:
        args.append("-I%s" % tools.from_cmake_path(p))
    for p in options.includepath:
        args.append("-I%s" % tools.from_cmake_path(p))
    args.append(os.path.abspath("./swig/IMP_%s.i" % options.module))

    ret = tools.run_subprocess(args, cwd=outputdir)
    patch_py_wrapper(
        "src/%s_swig/IMP.%spy" %
        (options.module,
         '' if options.module == 'kernel' else options.module + '.'),
        os.path.join("lib", "IMP",
                     "" if options.module == 'kernel' else options.module,
                     "__init__.py"), options.module)