ed2f193f9e37fbf16c2dc65dd15df9e644c6d203
[packages/trusty/cirros-testvm.git] / cirros-testvm / src-cirros / buildroot-2015.05 / package / python3 / 015-distutils-scripts-dont-adjust-shebang.patch
1 Do not adjust the shebang of Python scripts for cross-compilation
2
3 The copy_scripts() method in distutils copies the scripts listed in
4 the setup file and adjusts the first line to refer to the current
5 Python interpreter. When cross-compiling, this means that the adjusted
6 shebang refers to the host Python interpreter.
7
8 This patch modifies copy_scripts() to preserve the shebang when
9 cross-compilation is detected.
10
11 Signed-off-by: Christophe Vu-Brugier <cvubrugier@fastmail.fm>
12
13 Index: b/Lib/distutils/command/build_scripts.py
14 ===================================================================
15 --- a/Lib/distutils/command/build_scripts.py
16 +++ b/Lib/distutils/command/build_scripts.py
17 @@ -91,7 +91,7 @@
18                      adjust = True
19                      post_interp = match.group(1) or b''
20  
21 -            if adjust:
22 +            if adjust and not '_python_sysroot' in os.environ:
23                  log.info("copying and adjusting %s -> %s", script,
24                           self.build_dir)
25                  updated_files.append(outfile)