1From cb595a591c71e0bf7c63a3706b0be45ac6a642e3 Mon Sep 17 00:00:00 2001 2From: Christophe Vu-Brugier <cvubrugier@fastmail.fm> 3Date: Wed, 23 Dec 2015 11:44:30 +0100 4Subject: [PATCH] Do not adjust the shebang of Python scripts for 5 cross-compilation 6 7The copy_scripts() method in distutils copies the scripts listed in 8the setup file and adjusts the first line to refer to the current 9Python interpreter. When cross-compiling, this means that the adjusted 10shebang refers to the host Python interpreter. 11 12This patch modifies copy_scripts() to preserve the shebang when 13cross-compilation is detected. 14 15Signed-off-by: Christophe Vu-Brugier <cvubrugier@fastmail.fm> 16--- 17 Lib/distutils/command/build_scripts.py | 2 +- 18 1 file changed, 1 insertion(+), 1 deletion(-) 19 20diff --git a/Lib/distutils/command/build_scripts.py b/Lib/distutils/command/build_scripts.py 21index ccc70e6465..d6d54195c1 100644 22--- a/Lib/distutils/command/build_scripts.py 23+++ b/Lib/distutils/command/build_scripts.py 24@@ -91,7 +91,7 @@ class build_scripts(Command): 25 adjust = True 26 post_interp = match.group(1) or b'' 27 28- if adjust: 29+ if adjust and not '_python_sysroot' in os.environ: 30 log.info("copying and adjusting %s -> %s", script, 31 self.build_dir) 32 updated_files.append(outfile) 33-- 342.25.1 35 36