017-distutils-scripts-dont-adjust-shebang.patch 1.0 KB

12345678910111213141516171819202122232425
  1. Do not adjust the shebang of Python scripts for cross-compilation
  2. The copy_scripts() method in distutils copies the scripts listed in
  3. the setup file and adjusts the first line to refer to the current
  4. Python interpreter. When cross-compiling, this means that the adjusted
  5. shebang refers to the host Python interpreter.
  6. This patch modifies copy_scripts() to preserve the shebang when
  7. cross-compilation is detected.
  8. Signed-off-by: Christophe Vu-Brugier <cvubrugier@fastmail.fm>
  9. Index: b/Lib/distutils/command/build_scripts.py
  10. ===================================================================
  11. --- a/Lib/distutils/command/build_scripts.py
  12. +++ b/Lib/distutils/command/build_scripts.py
  13. @@ -89,7 +89,7 @@
  14. adjust = 1
  15. post_interp = match.group(1) or ''
  16. - if adjust:
  17. + if adjust and not '_python_sysroot' in os.environ:
  18. log.info("copying and adjusting %s -> %s", script,
  19. self.build_dir)
  20. if not self.dry_run: