From 2052c1b19ee54076b58575fea6c99f2a88b447fb Mon Sep 17 00:00:00 2001 From: desert-sailor Date: Thu, 3 Jul 2025 17:38:43 +0800 Subject: [PATCH] Revert Always rewrite a Python shebang to python --- ...s-rewrite-a-Python-shebang-to-python.patch | 45 +++++++++++++++++++ python-setuptools.spec | 6 ++- 2 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 Revert-Always-rewrite-a-Python-shebang-to-python.patch diff --git a/Revert-Always-rewrite-a-Python-shebang-to-python.patch b/Revert-Always-rewrite-a-Python-shebang-to-python.patch new file mode 100644 index 0000000..608098d --- /dev/null +++ b/Revert-Always-rewrite-a-Python-shebang-to-python.patch @@ -0,0 +1,45 @@ +From 06a246f1fbd79d70951488d65d5fe6bfa4afd4ef Mon Sep 17 00:00:00 2001 +From: Lumir Balhar +Date: Thu, 13 Mar 2025 11:52:42 +0100 +Subject: [PATCH] Revert "Always rewrite a Python shebang to #!python." + +This reverts commit c71266345c64fd662b5f95bbbc6e4536172f496d. +--- + setuptools/_distutils/command/build_scripts.py | 13 ++++++++++++- + 1 file changed, 12 insertions(+), 1 deletion(-) + +diff --git a/setuptools/_distutils/command/build_scripts.py b/setuptools/_distutils/command/build_scripts.py +index 127c51d8d..05ba2c93c 100644 +--- a/setuptools/_distutils/command/build_scripts.py ++++ b/setuptools/_distutils/command/build_scripts.py +@@ -5,6 +5,7 @@ Implements the Distutils 'build_scripts' command.""" + import os + import re + import tokenize ++from distutils import sysconfig + from distutils._log import log + from stat import ST_MODE + from typing import ClassVar +@@ -105,8 +106,18 @@ class build_scripts(Command): + if shebang_match: + log.info("copying and adjusting %s -> %s", script, self.build_dir) + if not self.dry_run: ++ if not sysconfig.python_build: ++ executable = self.executable ++ else: ++ executable = os.path.join( ++ sysconfig.get_config_var("BINDIR"), ++ "python{}{}".format( ++ sysconfig.get_config_var("VERSION"), ++ sysconfig.get_config_var("EXE"), ++ ), ++ ) + post_interp = shebang_match.group(1) or '' +- shebang = f"#!python{post_interp}\n" ++ shebang = "#!" + executable + post_interp + "\n" + self._validate_shebang(shebang, f.encoding) + with open(outfile, "w", encoding=f.encoding) as outf: + outf.write(shebang) +-- +2.48.1 + diff --git a/python-setuptools.spec b/python-setuptools.spec index cd111a2..28b7f6f 100644 --- a/python-setuptools.spec +++ b/python-setuptools.spec @@ -8,12 +8,13 @@ Name: python-setuptools Version: 78.1.1 -Release: 2 +Release: 3 Summary: Easily build and distribute Python packages License: MIT AND Apache-2.0 AND (BSD-2-Clause OR Apache-2.0) AND Python-2.0.1 AND LGPL-3.0-only URL: https://pypi.python.org/pypi/setuptools Source0: %{pypi_source setuptools %{version}} +Patch1: Revert-Always-rewrite-a-Python-shebang-to-python.patch BuildArch: noarch @@ -107,6 +108,9 @@ PYTHONDONTWRITEBYTECODE=1 PYTHONPATH=$(pwd) py.test-%{python3_version} --ignore= %changelog +* Thu Jul 03 2025 Dongxing Wang - 78.1.1-3 +- Revert Always rewrite a Python shebang to python + * Tue Jun 10 2025 Funda Wang - 78.1.1-2 - force gobject-introspection version for upgrade -- Gitee