python-setuptools-0001-add-executable.patch 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. Add a new --executable option to distribute so that we can
  2. force the shebang line in installed python scripts.
  3. [Thomas: refresh for setuptools 5.8.]
  4. Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
  5. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
  6. Index: b/setuptools/command/install.py
  7. ===================================================================
  8. --- a/setuptools/command/install.py
  9. +++ b/setuptools/command/install.py
  10. @@ -16,6 +16,7 @@
  11. """Use easy_install to install the package, w/dependencies"""
  12. user_options = orig.install.user_options + [
  13. + ('executable=', 'e', "specify final destination interpreter path"),
  14. ('old-and-unmanageable', None, "Try not to use this!"),
  15. ('single-version-externally-managed', None,
  16. "used by system package builders to create 'flat' eggs"),
  17. @@ -31,6 +32,7 @@
  18. def initialize_options(self):
  19. orig.install.initialize_options(self)
  20. + self.executable = None
  21. self.old_and_unmanageable = None
  22. self.single_version_externally_managed = None
  23. Index: b/setuptools/command/install_scripts.py
  24. ===================================================================
  25. --- a/setuptools/command/install_scripts.py
  26. +++ b/setuptools/command/install_scripts.py
  27. @@ -11,6 +11,13 @@
  28. def initialize_options(self):
  29. orig.install_scripts.initialize_options(self)
  30. self.no_ep = False
  31. + self.executable = None
  32. +
  33. + def finalize_options(self):
  34. + orig.install_scripts.finalize_options(self)
  35. + self.set_undefined_options('install',
  36. + ('executable','executable')
  37. + )
  38. def run(self):
  39. from setuptools.command.easy_install import get_script_args
  40. @@ -32,6 +39,8 @@
  41. )
  42. bs_cmd = self.get_finalized_command('build_scripts')
  43. executable = getattr(bs_cmd, 'executable', sys_executable)
  44. + if self.executable is not None:
  45. + executable = self.executable
  46. is_wininst = getattr(
  47. self.get_finalized_command("bdist_wininst"), '_is_running', False
  48. )