Skip to content

Commit 52b73f4

Browse files
committed
Always rewrite a Python shebang to #!python.
Closes pypa/setuptools#4863
1 parent 91f75bb commit 52b73f4

File tree

1 file changed

+1
-12
lines changed

1 file changed

+1
-12
lines changed

distutils/command/build_scripts.py

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import os
66
import re
77
import tokenize
8-
from distutils import sysconfig
98
from distutils._log import log
109
from stat import ST_MODE
1110
from typing import ClassVar
@@ -106,18 +105,8 @@ def _copy_script(self, script, outfiles, updated_files): # noqa: C901
106105
if shebang_match:
107106
log.info("copying and adjusting %s -> %s", script, self.build_dir)
108107
if not self.dry_run:
109-
if not sysconfig.python_build:
110-
executable = self.executable
111-
else:
112-
executable = os.path.join(
113-
sysconfig.get_config_var("BINDIR"),
114-
"python{}{}".format(
115-
sysconfig.get_config_var("VERSION"),
116-
sysconfig.get_config_var("EXE"),
117-
),
118-
)
119108
post_interp = shebang_match.group(1) or ''
120-
shebang = "#!" + executable + post_interp + "\n"
109+
shebang = f"#!python{post_interp}\n"
121110
self._validate_shebang(shebang, f.encoding)
122111
with open(outfile, "w", encoding=f.encoding) as outf:
123112
outf.write(shebang)

0 commit comments

Comments
 (0)