8000 BUG: fix f2py shebang line for bdist wheel, egg by matthew-brett · Pull Request #5815 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

BUG: fix f2py shebang line for bdist wheel, egg #5815

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 30, 2015
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
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.
  • Loading branch information
matthew-brett committed Apr 29, 2015
commit fee5ec41de8ebb1b0be0b97aab27d8c672d8ea44
15 changes: 14 additions & 1 deletion numpy/f2py/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,19 @@

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)

Expand All @@ -50,7 +63,7 @@ def generate_f2py_py(build_dir):
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())
Expand Down
0