From 7c324bedadf2863e16197d3111d451924e4d23f1 Mon Sep 17 00:00:00 2001 From: A2uria <83493416+A2uria@users.noreply.github.com> Date: Sat, 24 Aug 2024 11:34:12 +0800 Subject: [PATCH 1/2] Ensure result of _build_shebang ends with \n --- distlib/scripts.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/distlib/scripts.py b/distlib/scripts.py index 0cf6640..840db3b 100644 --- a/distlib/scripts.py +++ b/distlib/scripts.py @@ -171,7 +171,7 @@ def _build_shebang(self, executable, post_interp): else: result = b'#!/bin/sh\n' result += b"'''exec' " + executable + post_interp + b' "$0" "$@"\n' - result += b"' '''" + result += b"' '''\n" return result def _get_shebang(self, encoding, post_interp=b'', options=None): From 425770de91ac41a8477293770e43f56a7eeb8e90 Mon Sep 17 00:00:00 2001 From: A2uria <83493416+A2uria@users.noreply.github.com> Date: Sat, 24 Aug 2024 11:37:39 +0800 Subject: [PATCH 2/2] Remove shebang checks from _write_script --- distlib/scripts.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/distlib/scripts.py b/distlib/scripts.py index 840db3b..fee019c 100644 --- a/distlib/scripts.py +++ b/distlib/scripts.py @@ -252,9 +252,6 @@ def get_manifest(self, exename): def _write_script(self, names, shebang, script_bytes, filenames, ext): use_launcher = self.add_launchers and self._is_nt - linesep = os.linesep.encode('utf-8') - if not shebang.endswith(linesep): - shebang += linesep if not use_launcher: script_bytes = shebang + script_bytes else: # pragma: no cover