Files
MINGW-packages/mingw-w64-python-installer/001-launcher-relative.patch
Christoph Reiter 4d3783d0d9 python-installer: don't use "<launcher_dir>" with normal scripts (#26601)
installer not only generates launcher scripts, it also rewrites shebangs
for old-style setuptools scripts. In that case we need to write a real
shebang and not just one which simple_launcher understands.

Instead of patching the source interpreter path, derive the relocatable
shebang from it in both places.

This came up in
https://github.com/msys2/MINGW-packages/issues/24738#issuecomment-3579042058
2025-11-28 21:31:53 +01:00

21 lines
1.0 KiB
Diff

--- installer-0.7.0/src/installer/destinations.py.orig 2025-11-28 19:46:57.490807700 +0100
+++ installer-0.7.0/src/installer/destinations.py 2025-11-28 19:48:13.717915600 +0100
@@ -199,7 +199,7 @@
path_ = os.fspath(path)
if scheme == "scripts":
- with fix_shebang(stream, self.interpreter) as stream_with_different_shebang:
+ with fix_shebang(stream, '/usr/bin/env ' + os.path.splitext(os.path.basename(self.interpreter))[0]) as stream_with_different_shebang:
return self.write_to_fs(
scheme, path_, stream_with_different_shebang, is_executable
)
@@ -224,7 +224,7 @@
filesystem interaction.
"""
script = Script(name, module, attr, section)
- script_name, data = script.generate(self.interpreter, self.script_kind)
+ script_name, data = script.generate("<launcher_dir>\\" + os.path.basename(self.interpreter), self.script_kind)
with io.BytesIO(data) as stream:
entry = self.write_to_fs(