diff options
author | Matthew Brett <matthew.brett@gmail.com> | 2015-04-29 13:00:15 -0700 |
---|---|---|
committer | Matthew Brett <matthew.brett@gmail.com> | 2015-04-29 13:11:38 -0700 |
commit | fee5ec41de8ebb1b0be0b97aab27d8c672d8ea44 (patch) | |
tree | 0c4eb404716b73698c0dee27574fea954046ace4 /numpy/f2py | |
parent | b282d2abf8850f4e47eec73e44d250ac0b091284 (diff) | |
download | numpy-fee5ec41de8ebb1b0be0b97aab27d8c672d8ea44.tar.gz |
BUG: fix f2py shebang line for bdist wheel, egg
Command `bdist_wheel` was generating a shebang line for f2py that uses
the Python path for the building Python. If we are building a wheel or
an egg, use the generic `#!python` shebang line for the f2py script
instead, which setuptools will modify at install time.
Closes gh-5812.
Diffstat (limited to 'numpy/f2py')
-rw-r--r-- | numpy/f2py/setup.py | 15 |
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()) |