Esempio n. 1
0
File: setup.py Progetto: yws/pythran
    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)
Esempio n. 2
0
    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
                        )
Esempio n. 3
0
    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'
Esempio n. 4
0
    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
Esempio n. 5
0
 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)