1 Add infrastructure to disable the build of certain extensions
3 Some of the extensions part of the Python core have dependencies on
4 external libraries (sqlite, tk, etc.) or are relatively big and not
5 necessarly always useful (CJK codecs for example). By extensions, we
6 mean part of Python modules that are written in C and therefore
7 compiled to binary code.
9 Therefore, we introduce a small infrastructure that allows to disable
10 some of those extensions. This can be done inside the configure.ac by
11 adding values to the DISABLED_EXTENSIONS variable (which is a
12 word-separated list of extensions).
14 The implementation works as follow :
16 * configure.ac defines a DISABLED_EXTENSIONS variable, which is
17 substituted (so that when Makefile.pre is generated from
18 Makefile.pre.in, the value of the variable is substituted). For
19 now, this DISABLED_EXTENSIONS variable is empty, later patches will
22 * Makefile.pre.in passes the DISABLED_EXTENSIONS value down to the
23 variables passed in the environment when calling the setup.py
24 script that actually builds and installs those extensions.
26 * setup.py is modified so that the existing "disabled_module_list" is
27 filled with those pre-disabled extensions listed in
30 Patch ported to python2.7 by Maxime Ripard <ripard@archos.com>, and
31 then extended by Thomas Petazzoni
32 <thomas.petazzoni@free-electrons.com>.
34 Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
36 Makefile.pre.in | 4 ++++
39 3 files changed, 10 insertions(+), 1 deletion(-)
41 Index: b/Makefile.pre.in
42 ===================================================================
46 # configure script arguments
47 CONFIG_ARGS= @CONFIG_ARGS@
49 +# disabled extensions
50 +DISABLED_EXTENSIONS= @DISABLED_EXTENSIONS@
52 # Subdirectories with code
56 $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \
57 _TCLTK_INCLUDES='$(TCLTK_INCLUDES)' _TCLTK_LIBS='$(TCLTK_LIBS)' \
58 + DISABLED_EXTENSIONS="$(DISABLED_EXTENSIONS)" \
59 $(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build
61 # Build static library
63 # Install the dynamically loadable modules
64 # This goes into $(exec_prefix)
65 sharedinstall: sharedmods
66 - $(RUNSHARED) $(PYTHON_FOR_BUILD) $(srcdir)/setup.py install \
67 + $(RUNSHARED) DISABLED_EXTENSIONS="$(DISABLED_EXTENSIONS)" \
68 + $(PYTHON_FOR_BUILD) $(srcdir)/setup.py install \
70 --install-scripts=$(BINDIR) \
71 --install-platlib=$(DESTSHARED) \
73 ===================================================================
80 +AC_SUBST(DISABLED_EXTENSIONS)
82 # Check for use of the system expat library
83 AC_MSG_CHECKING(for --with-system-expat)
84 AC_ARG_WITH(system_expat,
86 ===================================================================
90 COMPILED_WITH_PYDEBUG = ('--with-pydebug' in sysconfig.get_config_var("CONFIG_ARGS"))
92 # This global variable is used to hold the list of modules to be disabled.
93 -disabled_module_list = []
95 + disabled_module_list = sysconfig.get_config_var("DISABLED_EXTENSIONS").split(" ")
97 + disabled_module_list = list()
99 def add_dir_to_list(dirlist, dir):
100 """Add the directory 'dir' to the list 'dirlist' (after any relative