def run(self): import os for extension in self.extensions: source = extension.sources[0] out = extension.name + '.so' if not path.isfile( out) or path.getmtime(source) > path.getmtime(out): print 'building pythran extension', extension.name content = file(source).read() module = pythran.cxx_generator(extension.name, content, pythran.spec_parser(content), []) pythran.compile(os.environ.get('CXX', 'c++'), module, out, cxxflags=['-O2', '-g'] + extension.extra_compile_args + extension.extra_link_args)
def run(self): import os for extension in self.extensions: source = extension.sources[0] out = extension.name + '.so' if not path.isfile(out) or path.getmtime(source) > path.getmtime(out): print 'building pythran extension', extension.name content = file(source).read() module = pythran.cxx_generator( extension.name, content, pythran.spec_parser(content), [] ) pythran.compile( os.environ.get('CXX','c++'), module, out, cxxflags = ['-O2', '-g'] + extension.extra_compile_args + extension.extra_link_args )
def __call__(self, check_output=False): module_path = os.path.join(os.path.dirname(__file__), "openmp", self.module_name + ".py") print self.module_name specs = {self.module_name: []} module_code = file(module_path).read() if "unittest.skip" in module_code: return self.skipTest("Marked as skipable") mod = pythran.cxx_generator(self.module_name, module_code, specs) pymod = load_dynamic(self.module_name, pythran.compile(os.environ.get("CXX", "c++"), mod, check=False, cxxflags=['-O0', '-fopenmp'])) res = getattr(pymod, self.module_name)() assert res, 'Test Failed'
def __call__(self, check_output=False): module_path=os.path.join(os.path.dirname(__file__),"rosetta",self.module_name+".py") print self.module_name specs = { "test": [] } module_code = file(module_path).read() if "unittest.skip" in module_code: return self.skipTest("Marked as skipable") mod = pythran.cxx_generator(self.module_name, module_code, specs) pymod=load_dynamic(self.module_name, pythran.compile(os.environ.get("CXX","c++"), mod, check=False)) if check_output: res = getattr(pymod,"test")() compiled_code=compile(file(module_path).read(),"","exec") env={} eval(compiled_code, env) ref=eval("test()",env) if ref != res: print ref, res
def __call__(self): module_path=os.path.join(os.path.dirname(__file__),"cases",self.module_name+".py") specs = pythran.spec_parser(module_path) print self.module_name module= pythran.cxx_generator(self.module_name, file(module_path).read(), specs) pythran.compile(os.environ.get("CXX","c++"), module, check=False)