0002-Remove-support-for-special-executable-under-a-Python.patch 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. From 3b2944f3d9f83129500571f9e44fb0779bf0987b Mon Sep 17 00:00:00 2001
  2. From: "Jason R. Coombs" <jaraco@jaraco.com>
  3. Date: Fri, 2 May 2025 20:07:13 -0400
  4. Subject: [PATCH] Remove support for special executable under a Python build.
  5. As far as I can tell, no one has complained about loss of this functionality.
  6. Upstream-Status: Backport
  7. [https://github.com/pypa/setuptools/commit/575445c672d78fcce22df1e459b7baf0304a38b9]
  8. Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
  9. ---
  10. setuptools/_distutils/command/build_scripts.py | 15 ++-------------
  11. 1 file changed, 2 insertions(+), 13 deletions(-)
  12. diff --git a/setuptools/_distutils/command/build_scripts.py b/setuptools/_distutils/command/build_scripts.py
  13. index 3f7aae0..b86ee6e 100644
  14. --- a/setuptools/_distutils/command/build_scripts.py
  15. +++ b/setuptools/_distutils/command/build_scripts.py
  16. @@ -5,7 +5,6 @@ Implements the Distutils 'build_scripts' command."""
  17. import os
  18. import re
  19. import tokenize
  20. -from distutils import sysconfig
  21. from distutils._log import log
  22. from stat import ST_MODE
  23. from typing import ClassVar
  24. @@ -76,7 +75,7 @@ class build_scripts(Command):
  25. return outfiles, updated_files
  26. - def _copy_script(self, script, outfiles, updated_files): # noqa: C901
  27. + def _copy_script(self, script, outfiles, updated_files):
  28. shebang_match = None
  29. script = convert_path(script)
  30. outfile = os.path.join(self.build_dir, os.path.basename(script))
  31. @@ -106,18 +105,8 @@ class build_scripts(Command):
  32. if shebang_match:
  33. log.info("copying and adjusting %s -> %s", script, self.build_dir)
  34. if not self.dry_run:
  35. - if not sysconfig.python_build:
  36. - executable = self.executable
  37. - else:
  38. - executable = os.path.join(
  39. - sysconfig.get_config_var("BINDIR"),
  40. - "python{}{}".format(
  41. - sysconfig.get_config_var("VERSION"),
  42. - sysconfig.get_config_var("EXE"),
  43. - ),
  44. - )
  45. post_interp = shebang_match.group(1) or ''
  46. - shebang = "#!" + executable + post_interp + "\n"
  47. + shebang = "#!" + self.executable + post_interp + "\n"
  48. self._validate_shebang(shebang, f.encoding)
  49. with open(outfile, "w", encoding=f.encoding) as outf:
  50. outf.write(shebang)
  51. --
  52. 2.34.1