0022-Add-an-option-to-disable-expat.patch 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. From 5f0f30bf342cd2b13f98513c39fd8f17351b1a2f Mon Sep 17 00:00:00 2001
  2. From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
  3. Date: Tue, 7 Mar 2017 22:29:20 +0100
  4. Subject: [PATCH] Add an option to disable expat
  5. This patch replaces the existing --with-system-expat option with a
  6. --with-expat={system,builtin,none} option, which allows to tell Python
  7. whether we want to use the system expat (already installed), the expat
  8. builtin the Python sources, or no expat at all (which disables the
  9. installation of XML modules).
  10. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
  11. Signed-off-by: Samuel Martin <s.martin49@gmail.com>
  12. ---
  13. Makefile.pre.in | 6 +++++-
  14. configure.ac | 18 +++++++++++++-----
  15. setup.py | 2 +-
  16. 3 files changed, 19 insertions(+), 7 deletions(-)
  17. diff --git a/Makefile.pre.in b/Makefile.pre.in
  18. index bd537d9..e5d0dd7 100644
  19. --- a/Makefile.pre.in
  20. +++ b/Makefile.pre.in
  21. @@ -1046,7 +1046,7 @@ LIBSUBDIRS= site-packages \
  22. logging bsddb csv importlib wsgiref \
  23. ctypes ctypes/macholib \
  24. idlelib idlelib/Icons \
  25. - distutils distutils/command $(XMLLIBSUBDIRS) \
  26. + distutils distutils/command \
  27. multiprocessing multiprocessing/dummy \
  28. unittest \
  29. lib-old \
  30. @@ -1096,6 +1096,10 @@ ifeq (@CURSES@,yes)
  31. LIBSUBDIRS += curses
  32. endif
  33. +ifeq (@EXPAT@,yes)
  34. +LIBSUBDIRS += $(XMLLIBSUBDIRS)
  35. +endif
  36. +
  37. libinstall: build_all $(srcdir)/Lib/$(PLATDIR) $(srcdir)/Modules/xxmodule.c
  38. @for i in $(SCRIPTDIR) $(LIBDEST); \
  39. do \
  40. diff --git a/configure.ac b/configure.ac
  41. index ab081bc..63ee545 100644
  42. --- a/configure.ac
  43. +++ b/configure.ac
  44. @@ -2470,13 +2470,21 @@ PKG_PROG_PKG_CONFIG
  45. AC_SUBST(DISABLED_EXTENSIONS)
  46. # Check for use of the system expat library
  47. -AC_MSG_CHECKING(for --with-system-expat)
  48. -AC_ARG_WITH(system_expat,
  49. - AS_HELP_STRING([--with-system-expat], [build pyexpat module using an installed expat library]),
  50. +AC_MSG_CHECKING(for --with-expat)
  51. +AC_ARG_WITH(expat,
  52. + AS_HELP_STRING([--with-expat], [select which expat version to use: system, builtin, none]),
  53. [],
  54. - [with_system_expat="no"])
  55. + [with_expat="builtin"])
  56. -AC_MSG_RESULT($with_system_expat)
  57. +AC_MSG_RESULT($with_expat)
  58. +
  59. +if test "$with_expat" != "none"; then
  60. + EXPAT=yes
  61. +else
  62. + DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} pyexpat"
  63. + EXPAT=no
  64. +fi
  65. +AC_SUBST(EXPAT)
  66. # Check for use of the system libffi library
  67. AC_MSG_CHECKING(for --with-system-ffi)
  68. diff --git a/setup.py b/setup.py
  69. index f51ef8c..c68f6b4 100644
  70. --- a/setup.py
  71. +++ b/setup.py
  72. @@ -1483,7 +1483,7 @@ class PyBuildExt(build_ext):
  73. #
  74. # More information on Expat can be found at www.libexpat.org.
  75. #
  76. - if '--with-system-expat' in sysconfig.get_config_var("CONFIG_ARGS"):
  77. + if '--with-expat=system' in sysconfig.get_config_var("CONFIG_ARGS"):
  78. expat_inc = []
  79. define_macros = []
  80. expat_lib = ['expat']
  81. --
  82. 2.7.4