From dcd96ad76a3f350b8b2a05ae651e2c10261b5cc6 Mon Sep 17 00:00:00 2001 From: "Daniel A. Wozniak" Date: Sat, 4 Oct 2025 15:18:19 -0700 Subject: [PATCH 1/2] Fix scripts shebang for pip 52.2 --- relenv/common.py | 2 +- tests/test_common.py | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/relenv/common.py b/relenv/common.py index c91a509c..b044d76b 100644 --- a/relenv/common.py +++ b/relenv/common.py @@ -105,7 +105,7 @@ def format_shebang(python, tpl=SHEBANG_TPL): """ Return a formatted shebang. """ - return tpl.format(python).strip() + return tpl.format(python).strip() + "\n" def build_arch(): diff --git a/tests/test_common.py b/tests/test_common.py index df5d93b0..60be74e7 100644 --- a/tests/test_common.py +++ b/tests/test_common.py @@ -179,6 +179,10 @@ def test_shebang_tpl_macos(): assert proc.returncode == 0 +def test_format_shebang_newline(): + assert format_shebang("python3", SHEBANG_TPL_LINUX).endswith("\n") + + def test_relative_interpreter_default_location(): assert relative_interpreter( "/tmp/relenv", "/tmp/relenv/bin", "/tmp/relenv/bin/python3" From 4425d885585fb2b5b93befa8606d191ccd2b492a Mon Sep 17 00:00:00 2001 From: "Daniel A. Wozniak" Date: Sun, 5 Oct 2025 02:01:24 -0700 Subject: [PATCH 2/2] Add shebang test --- tests/test_verify_build.py | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/tests/test_verify_build.py b/tests/test_verify_build.py index ad3681b8..4995c56c 100644 --- a/tests/test_verify_build.py +++ b/tests/test_verify_build.py @@ -1224,6 +1224,40 @@ def test_install_with_target_shebang(pipexec, build, minor_version): ) +@pytest.mark.skip_unless_on_linux +def test_install_shebang_pip_24_2(pipexec, build, minor_version): + subprocess.run( + [str(pipexec), "install", "--upgrade", "pip==24.2"], + check=True, + ) + subprocess.run( + [str(pipexec), "install", "cowsay"], + check=True, + ) + ret = subprocess.run( + [str(build / "bin" / "cowsay"), "-t", "moo"], + check=False, + ) + assert ret.returncode == 0 + + +@pytest.mark.skip_unless_on_linux +def test_install_shebang_pip_25_2(pipexec, build, minor_version): + subprocess.run( + [str(pipexec), "install", "--upgrade", "pip==25.2"], + check=True, + ) + subprocess.run( + [str(pipexec), "install", "cowsay"], + check=True, + ) + ret = subprocess.run( + [str(build / "bin" / "cowsay"), "-t", "moo"], + check=False, + ) + assert ret.returncode == 0 + + @pytest.mark.skip_unless_on_linux def test_install_with_target_uninstall(pipexec, build): env = os.environ.copy()