File: nag.py

package info (click to toggle)
python-numpy 1%3A1.12.1-3
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 23,732 kB
  • ctags: 19,262
  • sloc: ansic: 146,995; python: 98,088; cpp: 1,112; makefile: 425; f90: 307; sh: 173; fortran: 169; perl: 58
file content (45 lines) | stat: -rw-r--r-- 1,403 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
from __future__ import division, absolute_import, print_function

import sys
from numpy.distutils.fcompiler import FCompiler

compilers = ['NAGFCompiler']

class NAGFCompiler(FCompiler):

    compiler_type = 'nag'
    description = 'NAGWare Fortran 95 Compiler'
    version_pattern =  r'NAGWare Fortran 95 compiler Release (?P<version>[^\s]*)'

    executables = {
        'version_cmd'  : ["<F90>", "-V"],
        'compiler_f77' : ["f95", "-fixed"],
        'compiler_fix' : ["f95", "-fixed"],
        'compiler_f90' : ["f95"],
        'linker_so'    : ["<F90>"],
        'archiver'     : ["ar", "-cr"],
        'ranlib'       : ["ranlib"]
        }

    def get_flags_linker_so(self):
        if sys.platform=='darwin':
            return ['-unsharedf95', '-Wl,-bundle,-flat_namespace,-undefined,suppress']
        return ["-Wl,-shared"]
    def get_flags_opt(self):
        return ['-O4']
    def get_flags_arch(self):
        version = self.get_version()
        if version and version < '5.1':
            return ['-target=native']
        else:
            return ['']
    def get_flags_debug(self):
        return ['-g', '-gline', '-g90', '-nan', '-C']

if __name__ == '__main__':
    from distutils import log
    log.set_verbosity(2)
    from numpy.distutils.fcompiler import new_fcompiler
    compiler = new_fcompiler(compiler='nag')
    compiler.customize()
    print(compiler.get_version())