MCPcopy Create free account
hub / github.com/numpy/numpy / get_f77flags

Function get_f77flags

numpy/distutils/fcompiler/__init__.py:1013–1030  ·  view source on GitHub ↗

Search the first 20 lines of fortran 77 code for line pattern `CF77FLAGS( )= ` Return a dictionary { : }.

(src)

Source from the content-addressed store, hash-verified

1011
1012_f77flags_re = re.compile(r'(c|)f77flags\s*\(\s*(?P<fcname>\w+)\s*\)\s*=\s*(?P<fflags>.*)', re.I)
1013def get_f77flags(src):
1014 """
1015 Search the first 20 lines of fortran 77 code for line pattern
1016 `CF77FLAGS(<fcompiler type>)=<f77 flags>`
1017 Return a dictionary {<fcompiler type>:<f77 flags>}.
1018 """
1019 flags = {}
1020 with open(src, encoding='latin1') as f:
1021 i = 0
1022 for line in f:
1023 i += 1
1024 if i>20: break
1025 m = _f77flags_re.match(line)
1026 if not m: continue
1027 fcname = m.group('fcname').strip()
1028 fflags = m.group('fflags').strip()
1029 flags[fcname] = split_quoted(fflags)
1030 return flags
1031
1032# TODO: implement get_f90flags and use it in _compile similarly to get_f77flags
1033

Callers 1

_compileMethod · 0.85

Calls 2

openFunction · 0.85
stripMethod · 0.80

Tested by

no test coverage detected