2017-03-08 00:00:26 +01:00
|
|
|
From 977de9474c1fb46359ab6a487e153fbd91a2b568 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
|
|
|
|
Date: Tue, 7 Mar 2017 22:21:28 +0100
|
|
|
|
Subject: [PATCH] Add minimal infrastructure to be able to disable extensions
|
|
|
|
|
|
|
|
This commit adds some logic to the Python build system to be able to
|
|
|
|
disable Python extensions. Follow-up commits actually add options to
|
|
|
|
disable specific extensions.
|
|
|
|
|
|
|
|
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
|
|
|
|
---
|
|
|
|
Makefile.pre.in | 6 +++++-
|
|
|
|
configure.ac | 2 ++
|
|
|
|
setup.py | 5 ++++-
|
|
|
|
3 files changed, 11 insertions(+), 2 deletions(-)
|
|
|
|
|
|
|
|
diff --git a/Makefile.pre.in b/Makefile.pre.in
|
|
|
|
index 96fc718..33b994d 100644
|
2014-02-13 21:48:53 +01:00
|
|
|
--- a/Makefile.pre.in
|
|
|
|
+++ b/Makefile.pre.in
|
2017-03-08 00:00:26 +01:00
|
|
|
@@ -161,6 +161,8 @@ FILEMODE= 644
|
2014-02-13 21:48:53 +01:00
|
|
|
# configure script arguments
|
|
|
|
CONFIG_ARGS= @CONFIG_ARGS@
|
|
|
|
|
|
|
|
+# disabled extensions
|
|
|
|
+DISABLED_EXTENSIONS= @DISABLED_EXTENSIONS@
|
|
|
|
|
|
|
|
# Subdirectories with code
|
|
|
|
SRCDIRS= @SRCDIRS@
|
2017-03-08 00:00:26 +01:00
|
|
|
@@ -548,6 +550,7 @@ sharedmods: $(BUILDPYTHON) pybuilddir.txt Modules/_math.o
|
2014-02-13 21:48:53 +01:00
|
|
|
esac; \
|
|
|
|
$(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \
|
|
|
|
_TCLTK_INCLUDES='$(TCLTK_INCLUDES)' _TCLTK_LIBS='$(TCLTK_LIBS)' \
|
|
|
|
+ DISABLED_EXTENSIONS="$(DISABLED_EXTENSIONS)" \
|
|
|
|
$(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build
|
|
|
|
|
|
|
|
# Build static library
|
2017-03-08 00:00:26 +01:00
|
|
|
@@ -1269,7 +1272,8 @@ libainstall: all python-config
|
2014-02-13 21:48:53 +01:00
|
|
|
# Install the dynamically loadable modules
|
|
|
|
# This goes into $(exec_prefix)
|
|
|
|
sharedinstall: sharedmods
|
|
|
|
- $(RUNSHARED) $(PYTHON_FOR_BUILD) $(srcdir)/setup.py install \
|
|
|
|
+ $(RUNSHARED) DISABLED_EXTENSIONS="$(DISABLED_EXTENSIONS)" \
|
|
|
|
+ $(PYTHON_FOR_BUILD) $(srcdir)/setup.py install \
|
|
|
|
--prefix=$(prefix) \
|
|
|
|
--install-scripts=$(BINDIR) \
|
|
|
|
--install-platlib=$(DESTSHARED) \
|
2017-03-08 00:00:26 +01:00
|
|
|
diff --git a/configure.ac b/configure.ac
|
|
|
|
index 63e6918..5d4232f 100644
|
2014-02-13 21:48:53 +01:00
|
|
|
--- a/configure.ac
|
|
|
|
+++ b/configure.ac
|
2017-03-08 00:00:26 +01:00
|
|
|
@@ -2462,6 +2462,8 @@ LIBS="$withval $LIBS"
|
2014-02-13 21:48:53 +01:00
|
|
|
|
2015-06-16 23:36:11 +02:00
|
|
|
PKG_PROG_PKG_CONFIG
|
2014-02-13 21:48:53 +01:00
|
|
|
|
|
|
|
+AC_SUBST(DISABLED_EXTENSIONS)
|
|
|
|
+
|
|
|
|
# Check for use of the system expat library
|
|
|
|
AC_MSG_CHECKING(for --with-system-expat)
|
|
|
|
AC_ARG_WITH(system_expat,
|
2017-03-08 00:00:26 +01:00
|
|
|
diff --git a/setup.py b/setup.py
|
|
|
|
index 64001e2..3b51c0a 100644
|
2014-02-13 21:48:53 +01:00
|
|
|
--- a/setup.py
|
|
|
|
+++ b/setup.py
|
2017-03-08 00:00:26 +01:00
|
|
|
@@ -33,7 +33,10 @@ host_platform = get_platform()
|
2014-02-13 21:48:53 +01:00
|
|
|
COMPILED_WITH_PYDEBUG = ('--with-pydebug' in sysconfig.get_config_var("CONFIG_ARGS"))
|
|
|
|
|
|
|
|
# This global variable is used to hold the list of modules to be disabled.
|
|
|
|
-disabled_module_list = []
|
|
|
|
+try:
|
|
|
|
+ disabled_module_list = sysconfig.get_config_var("DISABLED_EXTENSIONS").split(" ")
|
|
|
|
+except KeyError:
|
|
|
|
+ disabled_module_list = list()
|
|
|
|
|
|
|
|
def add_dir_to_list(dirlist, dir):
|
|
|
|
"""Add the directory 'dir' to the list 'dirlist' (at the front) if
|
2017-03-08 00:00:26 +01:00
|
|
|
--
|
|
|
|
2.7.4
|
|
|
|
|