/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

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