代码拉取完成,页面将自动刷新
From 06a246f1fbd79d70951488d65d5fe6bfa4afd4ef Mon Sep 17 00:00:00 2001
From: Lumir Balhar <lbalhar@redhat.com>
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
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。