buildroot/package/python/0006-Add-minimal-infrastructure-to-be-able-to-disable-ext.patch
Peter Korsgaard c970d7d640 package/python: security bump to version 2.7.16
Fixes the following security issues:

- CVE-2013-1752: Change use of readline() in :class:`imaplib.IMAP4_SSL` to limit line length

- CVE-2018-14647: The C accelerated _elementtree module now initializes hash
  randomization salt from _Py_HashSecret instead of libexpat's default
  CSPRNG.

For more details, see the NEWS file:
https://github.com/python/cpython/blob/v2.7.16/Misc/NEWS.d/2.7.16rc1.rst

Refresh patches, drop now upstream
package/python/0035-bpo-35746-Fix-segfault-in-ssl-s-cert-parser-GH-11569.patch
and adjust hash of LICENSE file for a change of copyright years.

run-tests results:
16:05:41 TestPython2                              Starting
16:05:42 TestPython2                              Building
16:11:26 TestPython2                              Building done
16:11:32 TestPython2                              Cleaning up
.
----------------------------------------------------------------------
Ran 1 test in 351.905s

OK

Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2019-05-17 10:36:34 +02:00

82 lines
2.7 KiB
Diff

From 94ec96dd8827adfb5e272d28a4d76510e28657b3 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>
[Peter: update for 2.7.16]
Signed-off-by: Peter Korsgaard <peter@korsgaard.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 247d3c2902..c1c98ecc5a 100644
--- a/Makefile.pre.in
+++ b/Makefile.pre.in
@@ -160,6 +160,8 @@ FILEMODE= 644
# configure script arguments
CONFIG_ARGS= @CONFIG_ARGS@
+# disabled extensions
+DISABLED_EXTENSIONS= @DISABLED_EXTENSIONS@
# Subdirectories with code
SRCDIRS= @SRCDIRS@
@@ -528,6 +530,7 @@ sharedmods: $(BUILDPYTHON) pybuilddir.txt Modules/_math.o
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
@@ -1280,7 +1283,8 @@ libainstall: @DEF_MAKE_RULE@ python-config
# 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) \
diff --git a/configure.ac b/configure.ac
index 77ca6d86ca..13f90b3ddd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2491,6 +2491,8 @@ LIBS="$withval $LIBS"
PKG_PROG_PKG_CONFIG
+AC_SUBST(DISABLED_EXTENSIONS)
+
# Check for use of the system expat library
AC_MSG_CHECKING(for --with-system-expat)
AC_ARG_WITH(system_expat,
diff --git a/setup.py b/setup.py
index 812d53d560..d426dd02ea 100644
--- a/setup.py
+++ b/setup.py
@@ -33,7 +33,10 @@ host_platform = get_platform()
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
--
2.11.0