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