summaryrefslogtreecommitdiff
path: root/numpy/f2py/f2py2e.py
diff options
context:
space:
mode:
Diffstat (limited to 'numpy/f2py/f2py2e.py')
-rwxr-xr-xnumpy/f2py/f2py2e.py21
1 files changed, 15 insertions, 6 deletions
diff --git a/numpy/f2py/f2py2e.py b/numpy/f2py/f2py2e.py
index 110337f92..71a049e41 100755
--- a/numpy/f2py/f2py2e.py
+++ b/numpy/f2py/f2py2e.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
"""
f2py2e - Fortran to Python C/API generator. 2nd Edition.
@@ -14,8 +14,6 @@ $Date: 2005/05/06 08:31:19 $
Pearu Peterson
"""
-from __future__ import division, absolute_import, print_function
-
import sys
import os
import pprint
@@ -28,6 +26,7 @@ from . import auxfuncs
from . import cfuncs
from . import f90mod_rules
from . import __version__
+from . import capi_maps
f2py_version = __version__.version
errmess = sys.stderr.write
@@ -118,6 +117,9 @@ Options:
--link-<resource> switch below. [..] is optional list
of resources names. E.g. try 'f2py --help-link lapack_opt'.
+ --f2cmap <filename> Load Fortran-to-Python KIND specification from the given
+ file. Default: .f2py_f2cmap in current directory.
+
--quiet Run quietly.
--verbose Run with extra verbosity.
-v Print f2py version ID and exit.
@@ -167,7 +169,7 @@ Extra options (only effective with -c):
Version: %s
numpy Version: %s
-Requires: Python 2.3 or higher.
+Requires: Python 3.5 or higher.
License: NumPy license (see LICENSE.txt in the NumPy source code)
Copyright 1999 - 2011 Pearu Peterson all rights reserved.
http://cens.ioc.ee/projects/f2py2e/""" % (f2py_version, numpy_version)
@@ -175,7 +177,7 @@ http://cens.ioc.ee/projects/f2py2e/""" % (f2py_version, numpy_version)
def scaninputline(inputline):
files, skipfuncs, onlyfuncs, debug = [], [], [], []
- f, f2, f3, f5, f6, f7, f8, f9 = 1, 0, 0, 0, 0, 0, 0, 0
+ f, f2, f3, f5, f6, f7, f8, f9, f10 = 1, 0, 0, 0, 0, 0, 0, 0, 0
verbose = 1
dolc = -1
dolatexdoc = 0
@@ -226,6 +228,8 @@ def scaninputline(inputline):
f8 = 1
elif l == '--f2py-wrapper-output':
f9 = 1
+ elif l == '--f2cmap':
+ f10 = 1
elif l == '--overwrite-signature':
options['h-overwrite'] = 1
elif l == '-h':
@@ -267,6 +271,9 @@ def scaninputline(inputline):
elif f9:
f9 = 0
options["f2py_wrapper_output"] = l
+ elif f10:
+ f10 = 0
+ options["f2cmap_file"] = l
elif f == 1:
try:
with open(l):
@@ -312,6 +319,7 @@ def scaninputline(inputline):
options['wrapfuncs'] = wrapfuncs
options['buildpath'] = buildpath
options['include_paths'] = include_paths
+ options.setdefault('f2cmap_file', None)
return files, options
@@ -422,6 +430,7 @@ def run_main(comline_list):
fobjcsrc = os.path.join(f2pydir, 'src', 'fortranobject.c')
files, options = scaninputline(comline_list)
auxfuncs.options = options
+ capi_maps.load_f2cmap_file(options['f2cmap_file'])
postlist = callcrackfortran(files, options)
isusedby = {}
for i in range(len(postlist)):
@@ -574,7 +583,7 @@ def run_compile():
modulename = 'untitled'
sources = sys.argv[1:]
- for optname in ['--include_paths', '--include-paths']:
+ for optname in ['--include_paths', '--include-paths', '--f2cmap']:
if optname in sys.argv:
i = sys.argv.index(optname)
f2py_flags.extend(sys.argv[i:i + 2])