annotate DEPENDENCIES/mingw32/Python27/Lib/site-packages/numpy/distutils/fcompiler/compaq.py @ 133:4acb5d8d80b6 tip

Don't fail environmental check if README.md exists (but .txt and no-suffix don't)
author Chris Cannam
date Tue, 30 Jul 2019 12:25:44 +0100
parents 2a2c65a20a8b
children
rev   line source
Chris@87 1
Chris@87 2 #http://www.compaq.com/fortran/docs/
Chris@87 3 from __future__ import division, absolute_import, print_function
Chris@87 4
Chris@87 5 import os
Chris@87 6 import sys
Chris@87 7
Chris@87 8 from numpy.distutils.fcompiler import FCompiler
Chris@87 9 from numpy.distutils.compat import get_exception
Chris@87 10 from distutils.errors import DistutilsPlatformError
Chris@87 11
Chris@87 12 compilers = ['CompaqFCompiler']
Chris@87 13 if os.name != 'posix' or sys.platform[:6] == 'cygwin' :
Chris@87 14 # Otherwise we'd get a false positive on posix systems with
Chris@87 15 # case-insensitive filesystems (like darwin), because we'll pick
Chris@87 16 # up /bin/df
Chris@87 17 compilers.append('CompaqVisualFCompiler')
Chris@87 18
Chris@87 19 class CompaqFCompiler(FCompiler):
Chris@87 20
Chris@87 21 compiler_type = 'compaq'
Chris@87 22 description = 'Compaq Fortran Compiler'
Chris@87 23 version_pattern = r'Compaq Fortran (?P<version>[^\s]*).*'
Chris@87 24
Chris@87 25 if sys.platform[:5]=='linux':
Chris@87 26 fc_exe = 'fort'
Chris@87 27 else:
Chris@87 28 fc_exe = 'f90'
Chris@87 29
Chris@87 30 executables = {
Chris@87 31 'version_cmd' : ['<F90>', "-version"],
Chris@87 32 'compiler_f77' : [fc_exe, "-f77rtl", "-fixed"],
Chris@87 33 'compiler_fix' : [fc_exe, "-fixed"],
Chris@87 34 'compiler_f90' : [fc_exe],
Chris@87 35 'linker_so' : ['<F90>'],
Chris@87 36 'archiver' : ["ar", "-cr"],
Chris@87 37 'ranlib' : ["ranlib"]
Chris@87 38 }
Chris@87 39
Chris@87 40 module_dir_switch = '-module ' # not tested
Chris@87 41 module_include_switch = '-I'
Chris@87 42
Chris@87 43 def get_flags(self):
Chris@87 44 return ['-assume no2underscore', '-nomixed_str_len_arg']
Chris@87 45 def get_flags_debug(self):
Chris@87 46 return ['-g', '-check bounds']
Chris@87 47 def get_flags_opt(self):
Chris@87 48 return ['-O4', '-align dcommons', '-assume bigarrays',
Chris@87 49 '-assume nozsize', '-math_library fast']
Chris@87 50 def get_flags_arch(self):
Chris@87 51 return ['-arch host', '-tune host']
Chris@87 52 def get_flags_linker_so(self):
Chris@87 53 if sys.platform[:5]=='linux':
Chris@87 54 return ['-shared']
Chris@87 55 return ['-shared', '-Wl,-expect_unresolved,*']
Chris@87 56
Chris@87 57 class CompaqVisualFCompiler(FCompiler):
Chris@87 58
Chris@87 59 compiler_type = 'compaqv'
Chris@87 60 description = 'DIGITAL or Compaq Visual Fortran Compiler'
Chris@87 61 version_pattern = r'(DIGITAL|Compaq) Visual Fortran Optimizing Compiler'\
Chris@87 62 ' Version (?P<version>[^\s]*).*'
Chris@87 63
Chris@87 64 compile_switch = '/compile_only'
Chris@87 65 object_switch = '/object:'
Chris@87 66 library_switch = '/OUT:' #No space after /OUT:!
Chris@87 67
Chris@87 68 static_lib_extension = ".lib"
Chris@87 69 static_lib_format = "%s%s"
Chris@87 70 module_dir_switch = '/module:'
Chris@87 71 module_include_switch = '/I'
Chris@87 72
Chris@87 73 ar_exe = 'lib.exe'
Chris@87 74 fc_exe = 'DF'
Chris@87 75
Chris@87 76 if sys.platform=='win32':
Chris@87 77 from distutils.msvccompiler import MSVCCompiler
Chris@87 78
Chris@87 79 try:
Chris@87 80 m = MSVCCompiler()
Chris@87 81 m.initialize()
Chris@87 82 ar_exe = m.lib
Chris@87 83 except DistutilsPlatformError:
Chris@87 84 pass
Chris@87 85 except AttributeError:
Chris@87 86 msg = get_exception()
Chris@87 87 if '_MSVCCompiler__root' in str(msg):
Chris@87 88 print('Ignoring "%s" (I think it is msvccompiler.py bug)' % (msg))
Chris@87 89 else:
Chris@87 90 raise
Chris@87 91 except IOError:
Chris@87 92 e = get_exception()
Chris@87 93 if not "vcvarsall.bat" in str(e):
Chris@87 94 print("Unexpected IOError in", __file__)
Chris@87 95 raise e
Chris@87 96 except ValueError:
Chris@87 97 e = get_exception()
Chris@87 98 if not "path']" in str(e):
Chris@87 99 print("Unexpected ValueError in", __file__)
Chris@87 100 raise e
Chris@87 101
Chris@87 102 executables = {
Chris@87 103 'version_cmd' : ['<F90>', "/what"],
Chris@87 104 'compiler_f77' : [fc_exe, "/f77rtl", "/fixed"],
Chris@87 105 'compiler_fix' : [fc_exe, "/fixed"],
Chris@87 106 'compiler_f90' : [fc_exe],
Chris@87 107 'linker_so' : ['<F90>'],
Chris@87 108 'archiver' : [ar_exe, "/OUT:"],
Chris@87 109 'ranlib' : None
Chris@87 110 }
Chris@87 111
Chris@87 112 def get_flags(self):
Chris@87 113 return ['/nologo', '/MD', '/WX', '/iface=(cref,nomixed_str_len_arg)',
Chris@87 114 '/names:lowercase', '/assume:underscore']
Chris@87 115 def get_flags_opt(self):
Chris@87 116 return ['/Ox', '/fast', '/optimize:5', '/unroll:0', '/math_library:fast']
Chris@87 117 def get_flags_arch(self):
Chris@87 118 return ['/threads']
Chris@87 119 def get_flags_debug(self):
Chris@87 120 return ['/debug']
Chris@87 121
Chris@87 122 if __name__ == '__main__':
Chris@87 123 from distutils import log
Chris@87 124 log.set_verbosity(2)
Chris@87 125 from numpy.distutils.fcompiler import new_fcompiler
Chris@87 126 compiler = new_fcompiler(compiler='compaq')
Chris@87 127 compiler.customize()
Chris@87 128 print(compiler.get_version())