Skip to content

Commit 87633dd

Browse files
authored
Merge pull request #4974 from pypa/feature/build-editable-static-executable
Override the executable in the editable_wheel command.
2 parents 6f7b6dd + 21e3805 commit 87633dd

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

newsfragments/4934.feature.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Restored support for install_scripts --executable (and classic behavior for the executable for those invocations). Instead, build_editable provides the portable form of the executables for downstream installers to rewrite.

setuptools/_distutils/command/build_scripts.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ def _copy_script(self, script, outfiles, updated_files):
106106
log.info("copying and adjusting %s -> %s", script, self.build_dir)
107107
if not self.dry_run:
108108
post_interp = shebang_match.group(1) or ''
109-
shebang = f"#!python{post_interp}\n"
109+
shebang = "#!" + self.executable + post_interp + "\n"
110110
self._validate_shebang(shebang, f.encoding)
111111
with open(outfile, "w", encoding=f.encoding) as outf:
112112
outf.write(shebang)

setuptools/command/editable_wheel.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,11 @@ def _configure_build(
211211
install.install_headers = headers
212212
install.install_data = data
213213

214+
# For portability, ensure scripts are built with #!python shebang
215+
# pypa/setuptools#4863
216+
build_scripts = dist.get_command_obj("build_scripts")
217+
build_scripts.executable = 'python'
218+
214219
install_scripts = cast(
215220
install_scripts_cls, dist.get_command_obj("install_scripts")
216221
)

0 commit comments

Comments
 (0)