Skip to content

Commit 5cc9083

Browse files
authored
scriptmaker: fix regression that prevented proper shebang when building python (#189)
Fixes python/cpython#98183
1 parent c95cc8b commit 5cc9083

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

distlib/scripts.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -168,15 +168,16 @@ def _get_shebang(self, encoding, post_interp=b'', options=None):
168168
executable = os.path.join(sysconfig.get_path('scripts'),
169169
'python%s' % sysconfig.get_config_var('EXE'))
170170
else: # pragma: no cover
171-
executable = os.path.join(
172-
sysconfig.get_config_var('BINDIR'),
173-
'python%s%s' % (sysconfig.get_config_var('VERSION'),
174-
sysconfig.get_config_var('EXE')))
175-
if not os.path.isfile(executable):
171+
if os.name == 'nt':
176172
# for Python builds from source on Windows, no Python executables with
177173
# a version suffix are created, so we use python.exe
178174
executable = os.path.join(sysconfig.get_config_var('BINDIR'),
179175
'python%s' % (sysconfig.get_config_var('EXE')))
176+
else:
177+
executable = os.path.join(
178+
sysconfig.get_config_var('BINDIR'),
179+
'python%s%s' % (sysconfig.get_config_var('VERSION'),
180+
sysconfig.get_config_var('EXE')))
180181
if options:
181182
executable = self._get_alternate_executable(executable, options)
182183

0 commit comments

Comments
 (0)