PageRenderTime 10ms CodeModel.GetById 1ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/packages/lang/Python/patches/Python-2.7.2-010-change-pyconfig-h-location.patch

http://github.com/OpenELEC/OpenELEC.tv
Patch | 76 lines | 67 code | 9 blank | 0 comment | 0 complexity | 770da32447570c68dee7ce00f8cfdd6d MD5 | raw file
 1Change the location of pyconfig.h
 2
 3The Python interpreter has a really strange behaviour: at *runtime*,
 4it reads a Makefile and a header file named pyconfig.h to get some
 5information about the configuration.
 6
 7The Makefile is located in usr/lib/python2.7/config, which is fine
 8since this location is kept on the target.
 9
10However, by default, the pyconfig.h is installed in
11usr/include/python2.7, but we completely remove the usr/include
12directory for the target. Since making an exception just for
13pyconfig.h is annoying, this patch also installs pyconfig.h to
14usr/lib/python2.7/config, and modifies the sysconfig module so that it
15looks in this location instead of usr/include.
16
17The pyconfig.h is still kept in usr/include/python2.7, because it is
18needed in the $(STAGING_DIR) when building third-party Python
19extensions that contain C code.
20
21Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
22
23---
24 Lib/distutils/sysconfig.py |    3 ++-
25 Lib/sysconfig.py           |    2 +-
26 Makefile.pre.in            |    3 ++-
27 3 files changed, 5 insertions(+), 3 deletions(-)
28
29Index: Python-2.7.1/Lib/distutils/sysconfig.py
30===================================================================
31--- Python-2.7.1.orig/Lib/distutils/sysconfig.py
32+++ Python-2.7.1/Lib/distutils/sysconfig.py
33@@ -193,7 +193,8 @@
34         else:
35             inc_dir = project_base
36     else:
37-        inc_dir = get_python_inc(plat_specific=1)
38+        lib_dir = get_python_lib(plat_specific=1, standard_lib=1)
39+        inc_dir = os.path.join(lib_dir, "config")
40     if get_python_version() < '2.2':
41         config_h = 'config.h'
42     else:
43Index: Python-2.7.1/Lib/sysconfig.py
44===================================================================
45--- Python-2.7.1.orig/Lib/sysconfig.py
46+++ Python-2.7.1/Lib/sysconfig.py
47@@ -371,7 +371,7 @@
48         else:
49             inc_dir = _PROJECT_BASE
50     else:
51-        inc_dir = get_path('platinclude')
52+        inc_dir = os.path.join(get_path('stdlib'), "config")
53     return os.path.join(inc_dir, 'pyconfig.h')
54 
55 def get_scheme_names():
56Index: Python-2.7.1/Makefile.pre.in
57===================================================================
58--- Python-2.7.1.orig/Makefile.pre.in
59+++ Python-2.7.1/Makefile.pre.in
60@@ -967,7 +967,6 @@
61 		echo $(INSTALL_DATA) $$i $(INCLUDEPY); \
62 		$(INSTALL_DATA) $$i $(DESTDIR)$(INCLUDEPY); \
63 	done
64-	$(INSTALL_DATA) pyconfig.h $(DESTDIR)$(CONFINCLUDEPY)/pyconfig.h
65 
66 # Install the library and miscellaneous stuff needed for extending/embedding
67 # This goes into $(exec_prefix)
68@@ -1001,6 +1000,8 @@
69 	$(INSTALL_DATA) Modules/python.o $(DESTDIR)$(LIBPL)/python.o
70 	$(INSTALL_DATA) $(srcdir)/Modules/config.c.in $(DESTDIR)$(LIBPL)/config.c.in
71 	$(INSTALL_DATA) Makefile $(DESTDIR)$(LIBPL)/Makefile
72+	$(INSTALL_DATA) pyconfig.h $(DESTDIR)$(LIBPL)/pyconfig.h
73+	$(INSTALL_DATA) pyconfig.h $(DESTDIR)$(CONFINCLUDEPY)/pyconfig.h
74 	$(INSTALL_DATA) Modules/Setup $(DESTDIR)$(LIBPL)/Setup
75 	$(INSTALL_DATA) Modules/Setup.local $(DESTDIR)$(LIBPL)/Setup.local
76 	$(INSTALL_DATA) Modules/Setup.config $(DESTDIR)$(LIBPL)/Setup.config