summaryrefslogtreecommitdiff
path: root/numpy/f2py/setup.py
diff options
context:
space:
mode:
authorJulian Taylor <jtaylor.debian@googlemail.com>2015-02-13 01:12:52 +0100
committerJulian Taylor <jtaylor.debian@googlemail.com>2015-03-08 13:38:41 +0100
commita81e323cb29506db3305bf08c7ddb2072bec73fb (patch)
tree4baf8a52bddd1e361e506f09f4e5492ff8a8b356 /numpy/f2py/setup.py
parent8cf7c4a9534e5444f07974e019383a395a8fac9e (diff)
downloadnumpy-a81e323cb29506db3305bf08c7ddb2072bec73fb.tar.gz
ENH: make f2py an executable module
allows pep 338 execution via python -mnumpy.f2py
Diffstat (limited to 'numpy/f2py/setup.py')
-rw-r--r--numpy/f2py/setup.py30
1 files changed, 4 insertions, 26 deletions
diff --git a/numpy/f2py/setup.py b/numpy/f2py/setup.py
index a27a001a9..3e2cf6867 100644
--- a/numpy/f2py/setup.py
+++ b/numpy/f2py/setup.py
@@ -50,32 +50,10 @@ def configuration(parent_package='',top_path=None):
if newer(__file__, target):
log.info('Creating %s', target)
f = open(target, 'w')
- f.write('''\
-#!%s
-# See http://cens.ioc.ee/projects/f2py2e/
-import os, sys
-for mode in ["g3-numpy", "2e-numeric", "2e-numarray", "2e-numpy"]:
- try:
- i=sys.argv.index("--"+mode)
- del sys.argv[i]
- break
- except ValueError: pass
-os.environ["NO_SCIPY_IMPORT"]="f2py"
-if mode=="g3-numpy":
- sys.stderr.write("G3 f2py support is not implemented, yet.\\n")
- sys.exit(1)
-elif mode=="2e-numeric":
- from f2py2e import main
-elif mode=="2e-numarray":
- sys.argv.append("-DNUMARRAY")
- from f2py2e import main
-elif mode=="2e-numpy":
- from numpy.f2py import main
-else:
- sys.stderr.write("Unknown mode: " + repr(mode) + "\\n")
- sys.exit(1)
-main()
-'''%(sys.executable))
+ f.write('#!%s\n' % (sys.executable))
+ mainloc = os.path.join(os.path.dirname(__file__), "__main__.py")
+ with open(mainloc) as mf:
+ f.write(mf.read())
f.close()
return target