summaryrefslogtreecommitdiff
path: root/numpy/f2py
diff options
context:
space:
mode:
Diffstat (limited to 'numpy/f2py')
-rw-r--r--numpy/f2py/setup.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/numpy/f2py/setup.py b/numpy/f2py/setup.py
index 3e2cf6867..87fec9049 100644
--- a/numpy/f2py/setup.py
+++ b/numpy/f2py/setup.py
@@ -29,6 +29,19 @@ from numpy.distutils.misc_util import Configuration
from __version__ import version
+
+def _get_f2py_shebang():
+ """ Return shebang line for f2py script
+
+ If we are building an egg or a wheel binary package, then the shebang line
+ should be ``#!python`` rather than ``#!`` followed by the contents of
+ ``sys.executable``.
+ """
+ if set(('bdist_wheel', 'bdist_egg')).intersection(sys.argv):
+ return '#!python'
+ return '#!' + sys.executable
+
+
def configuration(parent_package='',top_path=None):
config = Configuration('f2py', parent_package, top_path)
@@ -50,7 +63,7 @@ def configuration(parent_package='',top_path=None):
if newer(__file__, target):
log.info('Creating %s', target)
f = open(target, 'w')
- f.write('#!%s\n' % (sys.executable))
+ f.write(_get_f2py_shebang() + '\n')
mainloc = os.path.join(os.path.dirname(__file__), "__main__.py")
with open(mainloc) as mf:
f.write(mf.read())