Skip to content

Commit

Permalink
scriptmaker: fix regression that prevented proper shebang when buildi…
Browse files Browse the repository at this point in the history
…ng python (#189)

Fixes python/cpython#98183
  • Loading branch information
eli-schwartz committed Nov 7, 2022
1 parent c95cc8b commit 5cc9083
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions distlib/scripts.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,15 +168,16 @@ def _get_shebang(self, encoding, post_interp=b'', options=None):
executable = os.path.join(sysconfig.get_path('scripts'),
'python%s' % sysconfig.get_config_var('EXE'))
else: # pragma: no cover
executable = os.path.join(
sysconfig.get_config_var('BINDIR'),
'python%s%s' % (sysconfig.get_config_var('VERSION'),
sysconfig.get_config_var('EXE')))
if not os.path.isfile(executable):
if os.name == 'nt':
# for Python builds from source on Windows, no Python executables with
# a version suffix are created, so we use python.exe
executable = os.path.join(sysconfig.get_config_var('BINDIR'),
'python%s' % (sysconfig.get_config_var('EXE')))
else:
executable = os.path.join(
sysconfig.get_config_var('BINDIR'),
'python%s%s' % (sysconfig.get_config_var('VERSION'),
sysconfig.get_config_var('EXE')))
if options:
executable = self._get_alternate_executable(executable, options)

Expand Down

0 comments on commit 5cc9083

Please sign in to comment.