Skip to content

Commit 5589d75

Browse files
authored
Merge pull request #332 from pypa/debt/unify-shebang
In build_scripts, unconditionally set shebang to #!python.
2 parents 250c300 + eecd653 commit 5589d75

File tree

1 file changed

+2
-13
lines changed

1 file changed

+2
-13
lines changed

distutils/command/build_scripts.py

+2-13
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
@@ -76,7 +75,7 @@ def copy_scripts(self):
7675

7776
return outfiles, updated_files
7877

79-
def _copy_script(self, script, outfiles, updated_files): # noqa: C901
78+
def _copy_script(self, script, outfiles, updated_files):
8079
shebang_match = None
8180
script = convert_path(script)
8281
outfile = os.path.join(self.build_dir, os.path.basename(script))
@@ -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)