1 From 977de9474c1fb46359ab6a487e153fbd91a2b568 Mon Sep 17 00:00:00 2001
2 From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
3 Date: Tue, 7 Mar 2017 22:21:28 +0100
4 Subject: [PATCH] Add minimal infrastructure to be able to disable extensions
6 This commit adds some logic to the Python build system to be able to
7 disable Python extensions. Follow-up commits actually add options to
8 disable specific extensions.
10 Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
12 Makefile.pre.in | 6 +++++-
15 3 files changed, 11 insertions(+), 2 deletions(-)
17 diff --git a/Makefile.pre.in b/Makefile.pre.in
18 index 96fc718..33b994d 100644
21 @@ -161,6 +161,8 @@ FILEMODE= 644
22 # configure script arguments
23 CONFIG_ARGS= @CONFIG_ARGS@
25 +# disabled extensions
26 +DISABLED_EXTENSIONS= @DISABLED_EXTENSIONS@
28 # Subdirectories with code
30 @@ -548,6 +550,7 @@ sharedmods: $(BUILDPYTHON) pybuilddir.txt Modules/_math.o
32 $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \
33 _TCLTK_INCLUDES='$(TCLTK_INCLUDES)' _TCLTK_LIBS='$(TCLTK_LIBS)' \
34 + DISABLED_EXTENSIONS="$(DISABLED_EXTENSIONS)" \
35 $(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build
37 # Build static library
38 @@ -1269,7 +1272,8 @@ libainstall: all python-config
39 # Install the dynamically loadable modules
40 # This goes into $(exec_prefix)
41 sharedinstall: sharedmods
42 - $(RUNSHARED) $(PYTHON_FOR_BUILD) $(srcdir)/setup.py install \
43 + $(RUNSHARED) DISABLED_EXTENSIONS="$(DISABLED_EXTENSIONS)" \
44 + $(PYTHON_FOR_BUILD) $(srcdir)/setup.py install \
46 --install-scripts=$(BINDIR) \
47 --install-platlib=$(DESTSHARED) \
48 diff --git a/configure.ac b/configure.ac
49 index 63e6918..5d4232f 100644
52 @@ -2462,6 +2462,8 @@ LIBS="$withval $LIBS"
56 +AC_SUBST(DISABLED_EXTENSIONS)
58 # Check for use of the system expat library
59 AC_MSG_CHECKING(for --with-system-expat)
60 AC_ARG_WITH(system_expat,
61 diff --git a/setup.py b/setup.py
62 index 64001e2..3b51c0a 100644
65 @@ -33,7 +33,10 @@ host_platform = get_platform()
66 COMPILED_WITH_PYDEBUG = ('--with-pydebug' in sysconfig.get_config_var("CONFIG_ARGS"))
68 # This global variable is used to hold the list of modules to be disabled.
69 -disabled_module_list = []
71 + disabled_module_list = sysconfig.get_config_var("DISABLED_EXTENSIONS").split(" ")
73 + disabled_module_list = list()
75 def add_dir_to_list(dirlist, dir):
76 """Add the directory 'dir' to the list 'dirlist' (at the front) if