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

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. From 548413a659cc5320560d6b794fe8edd06dd1d22e 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. [Peter: update for 2.7.16]
  13. Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
  14. ---
  15. Makefile.pre.in | 6 +++++-
  16. configure.ac | 18 +++++++++++++-----
  17. setup.py | 2 +-
  18. 3 files changed, 19 insertions(+), 7 deletions(-)
  19. diff --git a/Makefile.pre.in b/Makefile.pre.in
  20. index 458f4ad55b..8dee345539 100644
  21. --- a/Makefile.pre.in
  22. +++ b/Makefile.pre.in
  23. @@ -1056,7 +1056,7 @@ LIBSUBDIRS= site-packages \
  24. logging bsddb csv importlib wsgiref \
  25. ctypes ctypes/macholib \
  26. idlelib idlelib/Icons \
  27. - distutils distutils/command $(XMLLIBSUBDIRS) \
  28. + distutils distutils/command \
  29. multiprocessing multiprocessing/dummy \
  30. unittest \
  31. lib-old \
  32. @@ -1107,6 +1107,10 @@ ifeq (@CURSES@,yes)
  33. LIBSUBDIRS += curses
  34. endif
  35. +ifeq (@EXPAT@,yes)
  36. +LIBSUBDIRS += $(XMLLIBSUBDIRS)
  37. +endif
  38. +
  39. libinstall: build_all $(srcdir)/Lib/$(PLATDIR) $(srcdir)/Modules/xxmodule.c
  40. @for i in $(SCRIPTDIR) $(LIBDEST); \
  41. do \
  42. diff --git a/configure.ac b/configure.ac
  43. index a7ebcd091e..2f5759a890 100644
  44. --- a/configure.ac
  45. +++ b/configure.ac
  46. @@ -2499,13 +2499,21 @@ PKG_PROG_PKG_CONFIG
  47. AC_SUBST(DISABLED_EXTENSIONS)
  48. # Check for use of the system expat library
  49. -AC_MSG_CHECKING(for --with-system-expat)
  50. -AC_ARG_WITH(system_expat,
  51. - AS_HELP_STRING([--with-system-expat], [build pyexpat module using an installed expat library]),
  52. +AC_MSG_CHECKING(for --with-expat)
  53. +AC_ARG_WITH(expat,
  54. + AS_HELP_STRING([--with-expat], [select which expat version to use: system, builtin, none]),
  55. [],
  56. - [with_system_expat="no"])
  57. + [with_expat="builtin"])
  58. -AC_MSG_RESULT($with_system_expat)
  59. +AC_MSG_RESULT($with_expat)
  60. +
  61. +if test "$with_expat" != "none"; then
  62. + EXPAT=yes
  63. +else
  64. + DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} pyexpat"
  65. + EXPAT=no
  66. +fi
  67. +AC_SUBST(EXPAT)
  68. # Check for use of the system libffi library
  69. AC_MSG_CHECKING(for --with-system-ffi)
  70. diff --git a/setup.py b/setup.py
  71. index 9130819454..f439cbadc2 100644
  72. --- a/setup.py
  73. +++ b/setup.py
  74. @@ -1475,7 +1475,7 @@ class PyBuildExt(build_ext):
  75. #
  76. # More information on Expat can be found at www.libexpat.org.
  77. #
  78. - if '--with-system-expat' in sysconfig.get_config_var("CONFIG_ARGS"):
  79. + if '--with-expat=system' in sysconfig.get_config_var("CONFIG_ARGS"):
  80. expat_inc = []
  81. define_macros = []
  82. expat_lib = ['expat']
  83. --
  84. 2.11.0