1From 7e0e7dc25f50acd6922493ae620ee5cbf107a79a Mon Sep 17 00:00:00 2001 2From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> 3Date: Wed, 22 Feb 2017 17:40:45 -0800 4Subject: [PATCH] Add an option to disable expat 5 6This patch replaces the existing --with-system-expat option with a 7--with-expat={system,builtin,none} option, which allows to tell Python 8whether we want to use the system expat (already installed), the expat 9builtin the Python sources, or no expat at all (which disables the 10installation of XML modules). 11 12Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> 13Signed-off-by: Samuel Martin <s.martin49@gmail.com> 14[ Andrey Smirnov: ported to Python 3.6 ] 15Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> 16[ Adam Duskett: ported to Python 3.10.0 ] 17Signed-off-by: Adam Duskett <aduskett@gmail.com> 18--- 19 Makefile.pre.in | 5 ++++- 20 configure.ac | 18 +++++++++++++----- 21 setup.py | 2 +- 22 3 files changed, 18 insertions(+), 7 deletions(-) 23 24diff --git a/Makefile.pre.in b/Makefile.pre.in 25index f89f155..08c5e8a 100644 26--- a/Makefile.pre.in 27+++ b/Makefile.pre.in 28@@ -1450,7 +1450,6 @@ LIBSUBDIRS= asyncio \ 29 urllib \ 30 venv venv/scripts venv/scripts/common venv/scripts/posix \ 31 wsgiref \ 32- $(XMLLIBSUBDIRS) \ 33 xmlrpc \ 34 zoneinfo 35 TESTSUBDIRS= ctypes/test \ 36@@ -1549,6 +1548,10 @@ ifeq (@CURSES@,yes) 37 LIBSUBDIRS += curses 38 endif 39 40+ifeq (@EXPAT@,yes) 41+LIBSUBDIRS += $(XMLLIBSUBDIRS) 42+endif 43+ 44 TEST_MODULES=@TEST_MODULES@ 45 libinstall: build_all $(srcdir)/Modules/xxmodule.c 46 @for i in $(SCRIPTDIR) $(LIBDEST); \ 47diff --git a/configure.ac b/configure.ac 48index 4f1cda5..e99a174 100644 49--- a/configure.ac 50+++ b/configure.ac 51@@ -3094,13 +3094,21 @@ PKG_PROG_PKG_CONFIG 52 AC_SUBST(DISABLED_EXTENSIONS) 53 54 # Check for use of the system expat library 55-AC_MSG_CHECKING(for --with-system-expat) 56-AC_ARG_WITH(system_expat, 57- AS_HELP_STRING([--with-system-expat], [build pyexpat module using an installed expat library, see Doc/library/pyexpat.rst (default is no)]), 58+AC_MSG_CHECKING(for --with-expat) 59+AC_ARG_WITH(expat, 60+ AS_HELP_STRING([--with-expat], [select which expat version to use: system, builtin, none]), 61 [], 62- [with_system_expat="no"]) 63+ [with_expat="builtin"]) 64 65-AC_MSG_RESULT($with_system_expat) 66+AC_MSG_RESULT($with_expat) 67+ 68+if test "$with_expat" != "none"; then 69+ EXPAT=yes 70+else 71+ DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} pyexpat" 72+ EXPAT=no 73+fi 74+AC_SUBST(EXPAT) 75 76 # Check for use of the system libffi library 77 AC_MSG_CHECKING(for --with-system-ffi) 78diff --git a/setup.py b/setup.py 79index 663fd44..e30ed52 100644 80--- a/setup.py 81+++ b/setup.py 82@@ -1764,7 +1764,7 @@ class PyBuildExt(build_ext): 83 # 84 # More information on Expat can be found at www.libexpat.org. 85 # 86- if '--with-system-expat' in sysconfig.get_config_var("CONFIG_ARGS"): 87+ if '--with-expat=system' in sysconfig.get_config_var("CONFIG_ARGS"): 88 expat_inc = [] 89 define_macros = [] 90 extra_compile_args = [] 91-- 922.30.2 93 94