Esempio n. 1
0
 def get_flags_fix(self):
     opt = FCompiler.get_flags_fix(self)
     opt.extend(
         ["-YCFRL=1", "-YCOM_NAMES=LCS", "-YCOM_PFX", "-YEXT_PFX", "-YCOM_SFX=_", "-YEXT_SFX=_", "-YEXT_NAMES=LCS"]
     )
     opt.extend(["-f", "fixed"])
     return opt
Esempio n. 2
0
File: pg.py Progetto: Horta/numpy
        def get_library_dirs(self):
            """List of compiler library directories."""
            opt = FCompiler.get_library_dirs(self)
            flang_dir = dirname(self.executables['compiler_f77'][0])
            opt.append(normpath(join(flang_dir, '..', 'lib')))

            return opt
Esempio n. 3
0
    def get_version(self,*args,**kwds):
        version = FCompiler.get_version(self,*args,**kwds)

        if version is None and sys.platform.startswith('aix'):
            # use lslpp to find out xlf version
            lslpp = find_executable('lslpp')
            xlf = find_executable('xlf')
            if os.path.exists(xlf) and os.path.exists(lslpp):
                s,o = exec_command(lslpp + ' -Lc xlfcmp')
                m = re.search('xlfcmp:(?P<version>\d+([.]\d+)+)', o)
                if m: version = m.group('version')

        xlf_dir = '/etc/opt/ibmcmp/xlf'
        if version is None and os.path.isdir(xlf_dir):
            # linux:
            # If the output of xlf does not contain version info
            # (that's the case with xlf 8.1, for instance) then
            # let's try another method:
            l = os.listdir(xlf_dir)
            l.sort()
            l.reverse()
            l = [d for d in l if os.path.isfile(os.path.join(xlf_dir,d,'xlf.cfg'))]
            if l:
                from distutils.version import LooseVersion
                self.version = version = LooseVersion(l[0])
        return version
Esempio n. 4
0
 def get_flags(self):
     opt = FCompiler.get_flags(self)
     if os.name != 'nt':
         opt.extend(['-s'])
         if self.get_version():
             if self.get_version()>='8.2':
                 opt.append('-fpic')
     return opt
Esempio n. 5
0
 def get_flags_f90(self):
     opt = FCompiler.get_flags_f90(self)
     opt.extend(["-YCFRL=1","-YCOM_NAMES=LCS","-YCOM_PFX","-YEXT_PFX",
                 "-YCOM_SFX=_","-YEXT_SFX=_","-YEXT_NAMES=LCS"])
     if self.get_version():
         if self.get_version()>'4.6':
             opt.extend(["-YDEALLOC=ALL"])
     return opt
Esempio n. 6
0
 def get_flags(self):
     opt = FCompiler.get_flags(self)
     if os.name != "nt":
         opt.extend(["-s"])
         if self.get_version():
             if self.get_version() >= "8.2":
                 opt.append("-fpic")
     return opt
Esempio n. 7
0
 def get_flags(self):
     opt = FCompiler.get_flags(self)
     if os.name != "nt":
         opt.extend(["-s"])
         if self.get_version():
             if self.get_version() >= "8.2":
                 opt.append("-fpic")
     return opt
Esempio n. 8
0
 def get_libraries(self):
     opt = FCompiler.get_libraries(self)
     if self.get_version() >= '10.0':
         opt.extend(['af90math', 'afio', 'af77math', 'U77'])
     elif self.get_version() >= '8.0':
         opt.extend(['f90math','fio','f77math','U77'])
     else:
         opt.extend(['fio','f90math','fmath','U77'])
     if os.name =='nt':
         opt.append('COMDLG32')
     return opt
Esempio n. 9
0
 def get_libraries(self):
     opt = FCompiler.get_libraries(self)
     if self.get_version() >= '10.0':
         opt.extend(['af90math', 'afio', 'af77math', 'U77'])
     elif self.get_version() >= '8.0':
         opt.extend(['f90math', 'fio', 'f77math', 'U77'])
     else:
         opt.extend(['fio', 'f90math', 'fmath', 'U77'])
     if os.name == 'nt':
         opt.append('COMDLG32')
     return opt
Esempio n. 10
0
 def get_libraries(self):
     opt = FCompiler.get_libraries(self)
     if self.get_version() >= "10.0":
         opt.extend(["af90math", "afio", "af77math", "U77"])
     elif self.get_version() >= "8.0":
         opt.extend(["f90math", "fio", "f77math", "U77"])
     else:
         opt.extend(["fio", "f90math", "fmath", "U77"])
     if os.name == "nt":
         opt.append("COMDLG32")
     return opt
Esempio n. 11
0
def configuration(parent_package='', top_path=None):
    """Configure all packages that need to be built."""
    config = Configuration('', parent_package, top_path)

    F95FLAGS = get_compiler_flags()

    kwargs = {}
    kwargs['extra_compile_args'] = F95FLAGS
    kwargs['f2py_options'] = ['--quiet']

    # numpy.distutils.fcompiler.FCompiler doesn't support .F95 extension
    compiler = FCompiler(get_default_fcompiler())
    compiler.src_extensions.append('.F95')
    compiler.language_map['.F95'] = 'f90'

    # collect all Fortran sources
    files = os.listdir('src')
    exclude_sources = ['PlanetsConstants.f95', 'PythonWrapper.f95']
    sources = [
        os.path.join('src', file) for file in files
        if file.lower().endswith('.f95') and file not in exclude_sources
    ]

    # (from http://stackoverflow.com/questions/14320220/
    #              testing-python-c-libraries-get-build-path)):
    build_lib_dir = "{dirname}.{platform}-{version[0]}.{version[1]}"
    dirparams = {
        'dirname': 'temp',
        'platform': sysconfig.get_platform(),
        'version': sys.version_info
    }
    libdir = os.path.join('build', build_lib_dir.format(**dirparams))
    print('searching SHTOOLS in:', libdir)

    # Fortran compilation
    config.add_library('SHTOOLS', sources=sources, **kwargs)

    # SHTOOLS
    config.add_extension(
        'pyshtools._SHTOOLS',
        include_dirs=[libdir],
        library_dirs=[libdir],
        libraries=['SHTOOLS', 'fftw3', 'm', 'lapack', 'blas'],
        sources=['src/pyshtools.pyf', 'src/PythonWrapper.f95'],
        **kwargs)

    # constants
    config.add_extension('pyshtools._constant',
                         sources=['src/PlanetsConstants.f95'],
                         **kwargs)

    return config
Esempio n. 12
0
 def get_flags_linker_so(self):
     opt = FCompiler.get_flags_linker_so(self)
     v = self.get_version()
     if v and v >= '8.0':
         opt.append('-nofor_main')
     if sys.platform == 'darwin':
         # Here, it's -dynamiclib
         try:
             idx = opt.index('-shared')
             opt.remove('-shared')
         except ValueError:
             idx = 0
         opt[idx:idx] = ['-dynamiclib', '-Wl,-undefined,dynamic_lookup', '-Wl,-framework,Python']
     return opt
Esempio n. 13
0
 def get_flags_linker_so(self):
     opt = FCompiler.get_flags_linker_so(self)
     v = self.get_version()
     if v and v >= "8.0":
         opt.append("-nofor_main")
     if sys.platform == "darwin":
         # Here, it's -dynamiclib
         try:
             idx = opt.index("-shared")
             opt.remove("-shared")
         except ValueError:
             idx = 0
         opt[idx:idx] = ["-dynamiclib", "-Wl,-undefined,dynamic_lookup", "-Wl,-framework,Python"]
     return opt
Esempio n. 14
0
 def get_library_dirs(self):
     opt = FCompiler.get_library_dirs(self)
     d = os.environ.get("ABSOFT")
     if d:
         if self.get_version() >= "10.0":
             # use shared libraries, the static libraries were not compiled -fPIC
             prefix = "sh"
         else:
             prefix = ""
         if cpu.is_64bit():
             suffix = "64"
         else:
             suffix = ""
         opt.append(os.path.join(d, "%slib%s" % (prefix, suffix)))
     return opt
Esempio n. 15
0
 def get_library_dirs(self):
     opt = FCompiler.get_library_dirs(self)
     d = os.environ.get('ABSOFT')
     if d:
         if self.get_version() >= '10.0':
             # use shared libraries, the static libraries were not compiled -fPIC
             prefix = 'sh'
         else:
             prefix = ''
         if cpu.is_64bit():
             suffix = '64'
         else:
             suffix = ''
         opt.append(os.path.join(d, '%slib%s' % (prefix, suffix)))
     return opt
Esempio n. 16
0
 def get_flags_f77(self):
     opt = FCompiler.get_flags_f77(self)
     opt.extend(['-N22','-N90','-N110'])
     v = self.get_version()
     if os.name == 'nt':
         if v and v>='8.0':
             opt.extend(['-f','-N15'])
     else:
         opt.append('-f')
         if v:
             if v<='4.6':
                 opt.append('-B108')
             else:
                 # Though -N15 is undocumented, it works with
                 # Absoft 8.0 on Linux
                 opt.append('-N15')
     return opt
Esempio n. 17
0
 def get_flags_f77(self):
     opt = FCompiler.get_flags_f77(self)
     opt.extend(["-N22", "-N90", "-N110"])
     v = self.get_version()
     if os.name == "nt":
         if v and v >= "8.0":
             opt.extend(["-f", "-N15"])
     else:
         opt.append("-f")
         if v:
             if v <= "4.6":
                 opt.append("-B108")
             else:
                 # Though -N15 is undocumented, it works with
                 # Absoft 8.0 on Linux
                 opt.append("-N15")
     return opt
Esempio n. 18
0
 def get_flags_linker_so(self):
     opt = FCompiler.get_flags_linker_so(self)
     v = self.get_version()
     if v and v >= '8.0':
         opt.append('-nofor_main')
     return opt
Esempio n. 19
0
 def get_flags_linker_so(self):
     opt = FCompiler.get_flags_linker_so(self)
     v = self.get_version()
     if v and v >= '8.0':
         opt.append('-nofor_main')
     return opt
Esempio n. 20
0
 def get_version(self, force=0, ok_status=[256,0,1]):
     # XXX status==256 may indicate 'unrecognized option' or
     #     'no input file'. So, version_cmd needs more work.
     return FCompiler.get_version(self,force,ok_status)
Esempio n. 21
0
File: pg.py Progetto: Horta/numpy
 def get_libraries(self):
     opt = FCompiler.get_libraries(self)
     opt.extend(['flang', 'flangrti', 'ompstub'])
     return opt