bfee03aaacc56402a2756f2562ab044d90144d95
[packages/trusty/cirros-testvm.git] / cirros-testvm / src-cirros / buildroot-2015.05 / package / python / 002-fix-get-python-inc.patch
1 Fix get_python_inc() for cross-compilation
2
3 When we are cross compiling, doing os.path.dirname(sys.executable) to
4 get the build directory is incorrect, because we're executing the host
5 Python to build things for the target. Instead, we should use the
6 project_base variable.
7
8 This fixes cross-compilation, which was adding incorrect header paths
9 pointing to the location where the host Python was built:
10
11 /home/thomas/projets/buildroot/output/host/usr/bin/arm-none-linux-gnueabi-gcc -fPIC -fno-strict-aliasing \
12   -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -pipe -Os -DNDEBUG -g -O3 -Wall -Wstrict-prototypes \
13   -I/usr/include -I. -IInclude -I./Include -I/home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-gnueabi/sysroot/usr/include \
14   -I/home/thomas/projets/buildroot/output/host/usr/bin/Include -I/home/thomas/projets/buildroot/output/host/usr/bin \
15   -c /home/thomas/projets/buildroot/output/build/python-2.7.6/Modules/_struct.c \
16   -o build/temp.linux2-arm-2.7/home/thomas/projets/buildroot/output/build/python-2.7.6/Modules/_struct.o
17
18 This patch allows to fix the
19 /home/thomas/projets/buildroot/output/host/usr/bin/Include and
20 /home/thomas/projets/buildroot/output/host/usr/bin paths that are
21 incorrectly added to the header paths.
22
23 Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
24 Index: b/Lib/distutils/sysconfig.py
25 ===================================================================
26 --- a/Lib/distutils/sysconfig.py
27 +++ b/Lib/distutils/sysconfig.py
28 @@ -79,7 +79,7 @@
29  
30      if os.name == "posix":
31          if python_build:
32 -            buildir = os.path.dirname(sys.executable)
33 +            buildir = project_base
34              if plat_specific:
35                  # python.h is located in the buildir
36                  inc_dir = buildir