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)
def setup_one(module, ordered, build_system, swig): info = tools.get_module_info(module, "/") if not info["ok"]: tools.rewrite("src/%s_swig.deps" % module, "", False) return includepath = get_dep_merged([module], "includepath", ordered) swigpath = get_dep_merged([module], "swigpath", ordered) depf = open("src/%s_swig.deps.in" % module, "w") cmd = [swig, "-MM", "-Iinclude", "-Iswig", "-ignoremissing"]\ + ["-I" + x for x in swigpath] + ["-I" + x for x in includepath]\ + ["swig/IMP_%s.i" % module] lines = tools.run_subprocess(cmd).split("\n") names = [] for x in lines: if x.endswith("\\"): x = x[:-1] x = x.strip() if not x.endswith(".h") and not x.endswith(".i") and not x.endswith(".i-in"): continue names.append(x) final_names = [_fix(x, build_system) for x in names] final_list = "\n".join(final_names) tools.rewrite("src/%s_swig.deps" % module, final_list)
def setup_one(module, ordered, build_system, swig): info = tools.get_module_info(module, "/") if not info["ok"]: tools.rewrite("src/%s_swig.deps" % module, "", False) return includepath = get_dep_merged([module], "includepath", ordered) swigpath = get_dep_merged([module], "swigpath", ordered) depf = open("src/%s_swig.deps.in" % module, "w") cmd = [swig, "-MM", "-Iinclude", "-Iswig", "-ignoremissing"]\ + ["-I" + x for x in swigpath] + ["-I" + x for x in includepath]\ + ["swig/IMP_%s.i" % module] lines = tools.run_subprocess(cmd).split("\n") names = [] for x in lines: if x.endswith("\\"): x = x[:-1] x = x.strip() if not x.endswith(".h") and not x.endswith(".i") and not x.endswith( ".i-in"): continue names.append(x) final_names = [_fix(x, build_system) for x in names] final_list = "\n".join(final_names) tools.rewrite("src/%s_swig.deps" % module, final_list)
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)
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"))
def setup_one(finder, module, build_system, swig, extra_data_path, include): includepath = get_dep_merged(finder, [module], "includepath", extra_data_path) swigpath = get_dep_merged(finder, [module], "swigpath", extra_data_path) depf = open("src/%s_swig.deps.in" % module.name, "w") baseincludes = [] if include: baseincludes.append(include) baseincludes.extend(('include', 'swig')) cmd = [swig, "-python", "-MM"] + ["-I" + x for x in baseincludes] \ + ["-ignoremissing"] \ + ["-I" + x for x in swigpath] + ["-I" + x for x in includepath] \ + ["swig/IMP_%s.i" % module.name] lines = tools.run_subprocess(cmd).split("\n") names = [] for x in lines: if x.endswith("\\"): x = x[:-1] x = x.strip() if not x.endswith(".h") and not x.endswith(".i") and not x.endswith( ".i-in"): continue names.append(x) final_names = [_fix(x, build_system) for x in names] final_list = "\n".join(final_names) tools.rewrite("src/%s_swig.deps" % module.name, final_list)
def reboot(message): try: user = get_user_info_and_check_timestamp(message) if not user: return False bot_send_message(message.chat.id, 'Запуск \'system_reboot\'-скрипта...') run_subprocess( settings['system_reboot']) # todo reboot by miners option except Exception as e: log.error('! {} exception in row #{} ({}, {}): {}'.format( sys.exc_info()[0].__name__, sys.exc_info()[2].tb_lineno, os.path.basename(sys.exc_info()[2].tb_frame.f_code.co_filename), sys._getframe().f_code.co_name, e))
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)