0001-add-executable.patch 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. From a35dffe950d7bb0f7988d78ec4a963c5ce67e3c8 Mon Sep 17 00:00:00 2001
  2. From: =?UTF-8?q?J=C3=B6rg=20Krause?= <joerg.krause@embedded.rocks>
  3. Date: Mon, 7 Dec 2015 01:14:33 +0100
  4. Subject: [PATCH] add executable
  5. MIME-Version: 1.0
  6. Content-Type: text/plain; charset=UTF-8
  7. Content-Transfer-Encoding: 8bit
  8. Add a new --executable option to distribute so that we can
  9. force the shebang line in installed python scripts.
  10. [Thomas: refresh for setuptools 5.8.]
  11. [Jörg: refresh for setuptools 18.7.1]
  12. Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
  13. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
  14. Signed-off-by: Jörg Krause <joerg.krause@embedded.rocks>
  15. Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
  16. ---
  17. setuptools/command/install.py | 2 ++
  18. setuptools/command/install_scripts.py | 9 +++++++++
  19. 2 files changed, 11 insertions(+)
  20. diff --git a/setuptools/command/install.py b/setuptools/command/install.py
  21. index c49fcda93..851950522 100644
  22. --- a/setuptools/command/install.py
  23. +++ b/setuptools/command/install.py
  24. @@ -18,6 +18,7 @@ class install(orig.install):
  25. """Use easy_install to install the package, w/dependencies"""
  26. user_options = orig.install.user_options + [
  27. + ('executable=', 'e', "specify final destination interpreter path"),
  28. ('old-and-unmanageable', None, "Try not to use this!"),
  29. (
  30. 'single-version-externally-managed',
  31. @@ -50,6 +51,7 @@ class install(orig.install):
  32. )
  33. super().initialize_options()
  34. + self.executable = None
  35. self.old_and_unmanageable = None
  36. self.single_version_externally_managed = None
  37. diff --git a/setuptools/command/install_scripts.py b/setuptools/command/install_scripts.py
  38. index f44281b49..9e91cad87 100644
  39. --- a/setuptools/command/install_scripts.py
  40. +++ b/setuptools/command/install_scripts.py
  41. @@ -14,6 +14,13 @@ class install_scripts(orig.install_scripts):
  42. def initialize_options(self):
  43. orig.install_scripts.initialize_options(self)
  44. self.no_ep = False
  45. + self.executable = None
  46. +
  47. + def finalize_options(self):
  48. + orig.install_scripts.finalize_options(self)
  49. + self.set_undefined_options('install',
  50. + ('executable','executable')
  51. + )
  52. def run(self) -> None:
  53. self.run_command("egg_info")
  54. @@ -40,6 +47,8 @@ class install_scripts(orig.install_scripts):
  55. )
  56. bs_cmd = self.get_finalized_command('build_scripts')
  57. exec_param = getattr(bs_cmd, 'executable', None)
  58. + if self.executable is not None:
  59. + exec_param = self.executable
  60. writer = ei.ScriptWriter
  61. if exec_param == sys.executable:
  62. # In case the path to the Python executable contains a space, wrap
  63. --
  64. 2.34.1