コード例 #1
0
 def run(self):
     self.run_command('build_pre')
     self.run_command('build_cy')
     if self._has_fortran():
         with open(os.path.join(root, '.f2py_f2cmap'), 'w') as f:
             f.write(repr(F2PY_TABLE))
     build_src.run(self)
コード例 #2
0
ファイル: hooks.py プロジェクト: pchanial/pysimulators
 def run(self):
     self.run_command("build_pre")
     self.run_command("build_cy")
     if self._has_fortran():
         with open(os.path.join(root, ".f2py_f2cmap"), "w") as f:
             f.write(repr(F2PY_TABLE))
     build_src.run(self)
コード例 #3
0
    def run(self):
        environ = self.distribution.environment

        if self.sysdevel_server:
            for target in self.sysdevel_server:
                if self.distribution.verbose:
                    print('adding sysdevel support to ' + target)
                target_dir = os.path.join(os.path.abspath(self.build_lib),
                                          *target.split('.'))
                mkdir(target_dir)
                source_dir = SERVER_SUPPORT_DIR
                for mod in SERVER_SUPPORT_MODULES:
                    src_file = os.path.join(source_dir, mod + '.py.in')
                    if not os.path.exists(src_file):
                        src_file = src_file[:-3]
                    dst_file = os.path.join(target_dir, mod + '.py')
                    configure_file(environ, src_file, dst_file)


        if self.antlr_modules:
            here = os.getcwd()
            for grammar in self.antlr_modules:
                if self.distribution.verbose:
                    print('building antlr grammar "' + \
                        grammar.name + '" sources')
                ##TODO build in build_src, add to build_lib modules
                target = os.path.join(os.path.abspath(self.build_lib),
                                      grammar.directory)
                mkdir(target)
                source_dir = os.path.abspath(grammar.directory)
                os.chdir(target)

                reprocess = True
                ref = os.path.join(target, grammar.name + '2Py.py')
                if os.path.exists(ref):
                    reprocess = False
                    for src in grammar.sources:
                        src_path = os.path.join(source_dir, src)
                        if os.path.getmtime(ref) < os.path.getmtime(src_path):
                            reprocess = True
                if reprocess:
                    for src in grammar.sources:
                        ## ANTLR cannot parse from a separate directory
                        shutil.copy(os.path.join(source_dir, src), '.')
                        cmd_line = list(environ['ANTLR'])
                        cmd_line.append(src)
                        status = subprocess.call(cmd_line)
                        if status != 0:
                            raise Exception("Command '" + str(cmd_line) +
                                            "' returned non-zero exit status "
                                            + str(status))
                    ## Cleanup so that it's only Python modules
                    for f in glob.glob('*.g'):
                        os.unlink(f)
                    for f in glob.glob('*.tokens'):
                        os.unlink(f)
                os.chdir(here)

        if self.distribution.has_ext_modules():
            _build_src.run(self)
コード例 #4
0
ファイル: hooks.py プロジェクト: pchanial/setuphooks
 def run(self):
     self.run_command('build_pre')
     self.run_command('build_cy')
     if self._has_fortran():
         with open(os.path.join(root, '.f2py_f2cmap'), 'w') as f:
             f.write(repr(F2PY_TABLE))
     build_src.run(self)
コード例 #5
0
ファイル: setup.py プロジェクト: jklenzing/pysatCDF
    def run(self):

        CDF_build(self, self.build_src)
        #print 'yo yo yo'
        #print (self.__dict__)
        lib_path = os.path.abspath(os.path.join(self.build_lib, 'pysatCDF'))
        # set directories for the CDF library installed with pysatCDF
        self.extensions[0].include_dirs = [os.path.join(lib_path, 'include')]
        self.extensions[0].f2py_options = ['--include-paths', os.path.join(lib_path, 'include')]
        self.extensions[0].extra_objects = [os.path.join(lib_path, 'lib', lib_name)]
        # add shared library, if provided
        if shared_lib_name is not None:
            self.extensions[0].extra_link_args.append(os.path.join(lib_path, 'lib', shared_lib_name))

        build_src.run(self)
        return
コード例 #6
0
ファイル: hooks.py プロジェクト: mwrightqub/qubic
 def run(self):
     has_fortran = False
     has_cython = False
     for ext in self.extensions:
         has_fortran = has_fortran or has_f_sources(ext.sources)
         for isource, source in enumerate(ext.sources):
             if source.endswith('.pyx'):
                 if not USE_CYTHON:
                     ext.sources[isource] = source[:-3] + 'c'
                 else:
                     has_cython = True
     if has_fortran:
         with open(os.path.join(root, '.f2py_f2cmap'), 'w') as f:
             f.write(repr(F2PY_TABLE))
     if has_cython:
         build_dir = None if self.inplace else self.build_src
         new_extensions = cythonize(self.extensions, force=True,
                                    build_dir=build_dir)
         for i in range(len(self.extensions)):
             self.extensions[i] = new_extensions[i]
     build_src.run(self)
コード例 #7
0
ファイル: hooks.py プロジェクト: ziotom78/qubic
 def run(self):
     has_fortran = False
     has_cython = False
     for ext in self.extensions:
         has_fortran = has_fortran or has_f_sources(ext.sources)
         for isource, source in enumerate(ext.sources):
             if source.endswith('.pyx'):
                 if not USE_CYTHON:
                     ext.sources[isource] = source[:-3] + 'c'
                 else:
                     has_cython = True
     if has_fortran:
         with open(os.path.join(root, '.f2py_f2cmap'), 'w') as f:
             f.write(repr(F2PY_TABLE))
     if has_cython:
         build_dir = None if self.inplace else self.build_src
         new_extensions = cythonize(self.extensions, force=True,
                                    build_dir=build_dir)
         for i in range(len(self.extensions)):
             self.extensions[i] = new_extensions[i]
     build_src.run(self)
コード例 #8
0
    def run(self):

        CDF_build(self, self.build_src)
        #print 'yo yo yo'
        #print (self.__dict__)
        lib_path = os.path.abspath(os.path.join(self.build_lib, 'pysatCDF'))
        # set directories for the CDF library installed with pysatCDF
        self.extensions[0].include_dirs = [os.path.join(lib_path, 'include')]
        self.extensions[0].f2py_options = [
            '--include-paths',
            os.path.join(lib_path, 'include')
        ]
        self.extensions[0].extra_objects = [
            os.path.join(lib_path, 'lib', lib_name)
        ]
        # add shared library, if provided
        if shared_lib_name is not None:
            self.extensions[0].extra_link_args.append(
                os.path.join(lib_path, 'lib', shared_lib_name))

        build_src.run(self)
        return