package/dhcp/S80dhcp-server: allow empty INTERFACES
[buildroot-gz.git] / package / python3 / 007-disable-extensions.patch
blobce931f7284bba07247291180c92cacaeb7594754
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
20 use it.
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
28 DISABLED_EXTENSIONS.
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>
35 ---
36 Makefile.pre.in | 4 ++++
37 configure.ac | 2 ++
38 setup.py | 5 ++++-
39 3 files changed, 10 insertions(+), 1 deletion(-)
41 Index: b/Makefile.pre.in
42 ===================================================================
43 --- a/Makefile.pre.in
44 +++ b/Makefile.pre.in
45 @@ -180,6 +180,8 @@
46 # configure script arguments
47 CONFIG_ARGS= @CONFIG_ARGS@
49 +# disabled extensions
50 +DISABLED_EXTENSIONS= @DISABLED_EXTENSIONS@
52 # Subdirectories with code
53 SRCDIRS= @SRCDIRS@
54 @@ -577,6 +579,7 @@
55 esac; \
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
62 @@ -1387,7 +1390,8 @@
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 \
69 --prefix=$(prefix) \
70 --install-scripts=$(BINDIR) \
71 --install-platlib=$(DESTSHARED) \
72 Index: b/configure.ac
73 ===================================================================
74 --- a/configure.ac
75 +++ b/configure.ac
76 @@ -2369,6 +2369,8 @@
78 PKG_PROG_PKG_CONFIG
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,
85 Index: b/setup.py
86 ===================================================================
87 --- a/setup.py
88 +++ b/setup.py
89 @@ -39,7 +39,10 @@
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 = []
94 +try:
95 + disabled_module_list = sysconfig.get_config_var("DISABLED_EXTENSIONS").split(" ")
96 +except KeyError:
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