summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRohit Goswami <rog32@hi.is>2022-03-21 03:05:26 +0000
committerRohit Goswami <rog32@hi.is>2022-03-21 03:05:26 +0000
commit7158f090a6d4ba90a9bd5506d42f5864a3e5da30 (patch)
tree060527d3ef9b379d68a48f34af61de1af64b4780
parent61690c8ccf05b7e910c3287910525d8d6ee176a1 (diff)
downloadnumpy-7158f090a6d4ba90a9bd5506d42f5864a3e5da30.tar.gz
ENH: Do not generate F90 wrappers for F77 inputs
-rwxr-xr-xnumpy/f2py/f2py2e.py12
-rwxr-xr-xnumpy/f2py/rules.py17
2 files changed, 19 insertions, 10 deletions
diff --git a/numpy/f2py/f2py2e.py b/numpy/f2py/f2py2e.py
index 86c5649a8..ed5d529cf 100755
--- a/numpy/f2py/f2py2e.py
+++ b/numpy/f2py/f2py2e.py
@@ -122,7 +122,8 @@ Options:
--quiet Run quietly.
--verbose Run with extra verbosity.
- --empty-gen Ensure all possible output files are created
+ --empty-gen Ensure all possible output files are created for a language
+ standard.
-v Print f2py version ID and exit.
@@ -360,15 +361,6 @@ def callcrackfortran(files, options):
else:
for mod in postlist:
mod["f2py_wrapper_output"] = options["f2py_wrapper_output"]
- if options["emptygen"]:
- # Generate all possible outputs
- for mod in postlist:
- m_name = mod["name"]
- b_path = options["buildpath"]
- Path(f'{b_path}/{m_name}module.c').touch()
- Path(f'{b_path}/{m_name}-f2pywrappers.f').touch()
- Path(f'{b_path}/{m_name}-f2pywrappers2.f90').touch()
- outmess(f' Generating possibly empty wrappers "{m_name}-f2pywrappers.f" and "{m_name}-f2pywrappers2.f90"\n')
return postlist
diff --git a/numpy/f2py/rules.py b/numpy/f2py/rules.py
index 78810a0a7..1bb6656db 100755
--- a/numpy/f2py/rules.py
+++ b/numpy/f2py/rules.py
@@ -53,6 +53,7 @@ Pearu Peterson
import os
import time
import copy
+from pathlib import Path
# __version__.version is now the same as the NumPy version
from . import __version__
@@ -1213,6 +1214,22 @@ def buildmodule(m, um):
# requiresf90wrapper must be called before buildapi as it
# rewrites assumed shape arrays as automatic arrays.
isf90 = requiresf90wrapper(nb)
+ # options is in scope here
+ if options['emptygen']:
+ b_path = options['buildpath']
+ m_name = vrd['modulename']
+ outmess(' Generating possibly empty wrappers"\n')
+ Path(f"{b_path}/{vrd['coutput']}").touch()
+ if isf90:
+ # f77 + f90 wrappers
+ outmess(f' Maybe empty "{m_name}-f2pywrappers2.f90"\n')
+ Path(f'{b_path}/{m_name}-f2pywrappers2.f90').touch()
+ outmess(f' Maybe empty "{m_name}-f2pywrappers.f"\n')
+ Path(f'{b_path}/{m_name}-f2pywrappers.f').touch()
+ else:
+ # only f77 wrappers
+ outmess(f' Maybe empty "{m_name}-f2pywrappers.f"\n')
+ Path(f'{b_path}/{m_name}-f2pywrappers.f').touch()
api, wrap = buildapi(nb)
if wrap:
if isf90: