#
################################################################################
+define PKG_PYTHON_SYSCONFIGDATA_NAME
+$(basename $(notdir $(wildcard $(STAGING_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR)/_sysconfigdata_m_linux_*.py)))
+endef
+
# Target distutils-based packages
PKG_PYTHON_DISTUTILS_ENV = \
PATH=$(BR_PATH) \
LDFLAGS="$(TARGET_LDFLAGS)" \
LDSHARED="$(TARGET_CROSS)gcc -shared" \
PYTHONPATH="$(if $(BR2_PACKAGE_PYTHON3),$(PYTHON3_PATH),$(PYTHON_PATH))" \
+ _PYTHON_SYSCONFIGDATA_NAME="$(PKG_PYTHON_SYSCONFIGDATA_NAME)" \
_python_sysroot=$(STAGING_DIR) \
_python_prefix=/usr \
_python_exec_prefix=/usr
# Target setuptools-based packages
PKG_PYTHON_SETUPTOOLS_ENV = \
+ _PYTHON_SYSCONFIGDATA_NAME="$(PKG_PYTHON_SYSCONFIGDATA_NAME)" \
PATH=$(BR_PATH) \
PYTHONPATH="$(if $(BR2_PACKAGE_PYTHON3),$(PYTHON3_PATH),$(PYTHON_PATH))" \
_python_sysroot=$(STAGING_DIR) \
--- /dev/null
+From 1c2d155d1ef3da49b5ed970ab8d63958c516e9b9 Mon Sep 17 00:00:00 2001
+From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+Date: Wed, 22 Feb 2017 16:21:31 -0800
+Subject: [PATCH] Make the build of pyc files conditional
+
+This commit adds a new configure option --disable-pyc-build to disable
+the compilation of pyc.
+
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+[ Andrey Smrinov: ported to Python 3.6 ]
+Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
+---
+ Makefile.pre.in | 2 ++
+ configure.ac | 6 ++++++
+ 2 files changed, 8 insertions(+)
+
+diff --git a/Makefile.pre.in b/Makefile.pre.in
+index 8f27d73..b78a765 100644
+--- a/Makefile.pre.in
++++ b/Makefile.pre.in
+@@ -1308,6 +1308,7 @@ libinstall: build_all $(srcdir)/Modules/xxmodule.c
+ $(INSTALL_DATA) $(srcdir)/Modules/xxmodule.c \
+ $(DESTDIR)$(LIBDEST)/distutils/tests ; \
+ fi
++ifeq (@PYC_BUILD@,yes)
+ -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
+ $(PYTHON_FOR_BUILD) -Wi $(DESTDIR)$(LIBDEST)/compileall.py \
+ -d $(LIBDEST) -f \
+@@ -1335,6 +1336,7 @@ libinstall: build_all $(srcdir)/Modules/xxmodule.c
+ $(PYTHON_FOR_BUILD) -Wi -OO $(DESTDIR)$(LIBDEST)/compileall.py \
+ -d $(LIBDEST)/site-packages -f \
+ -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
++endif
+ -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
+ $(PYTHON_FOR_BUILD) -m lib2to3.pgen2.driver $(DESTDIR)$(LIBDEST)/lib2to3/Grammar.txt
+ -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
+diff --git a/configure.ac b/configure.ac
+index 9eacf52..8e7b2ad 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -1122,6 +1122,12 @@ fi
+
+ AC_MSG_CHECKING(LDLIBRARY)
+
++AC_SUBST(PYC_BUILD)
++
++AC_ARG_ENABLE(pyc-build,
++ AS_HELP_STRING([--disable-pyc-build], [disable build of pyc files]),
++ [ PYC_BUILD="${enableval}" ], [ PYC_BUILD=yes ])
++
+ # MacOSX framework builds need more magic. LDLIBRARY is the dynamic
+ # library that we build, but we do not want to link against it (we
+ # will find it with a -framework option). For this reason there is an
+--
+2.9.3
+
+++ /dev/null
-From 093733d806e32ef47db5c6d2379d7c93ae71524b Mon Sep 17 00:00:00 2001
-From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
-Date: Wed, 23 Dec 2015 11:28:34 +0100
-Subject: [PATCH] setup.py: do not add invalid header locations
-
-This piece of code incorrectly adds /usr/include to
-self.compiler.include_dirs, and results in the following invalid
-compilation line:
-
-/home/thomas/projets/buildroot/output/host/usr/bin/arm-none-linux-gnueabi-gcc
- -fPIC -Wno-unused-result -Werror=declaration-after-statement -DNDEBUG -g
- -O3 -Wall -Wstrict-prototypes -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
- -D_FILE_OFFSET_BITS=64 -pipe -Os
- -I./Include -I/usr/include -I. -IInclude
- -I/home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-gnueabi/sysroot/usr/include
- -I/home/thomas/projets/buildroot/output/build/python3-3.4.0b1/Include
- -I/home/thomas/projets/buildroot/output/build/python3-3.4.0b1
- -c /home/thomas/projets/buildroot/output/build/python3-3.4.0b1/Modules/_struct.c
- -o build/temp.linux-arm-3.4/home/thomas/projets/buildroot/output/build/python3-3.4.0b1/Modules/_struct.o
-cc1: warning: include location "/usr/include" is unsafe for cross-compilation [-Wpoison-system-directories]
-
-The -I/usr/include is wrong when cross compiling, so we disable adding
-INCLUDEDIR and LIBDIR from the host when cross compiling.
-
-Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
----
- setup.py | 3 ++-
- 1 file changed, 2 insertions(+), 1 deletion(-)
-
-diff --git a/setup.py b/setup.py
-index 174ce72..b67d913 100644
---- a/setup.py
-+++ b/setup.py
-@@ -534,7 +534,8 @@ class PyBuildExt(build_ext):
- add_dir_to_list(dir_list, directory)
-
- if os.path.normpath(sys.base_prefix) != '/usr' \
-- and not sysconfig.get_config_var('PYTHONFRAMEWORK'):
-+ and not sysconfig.get_config_var('PYTHONFRAMEWORK') \
-+ and not cross_compiling:
- # OSX note: Don't add LIBDIR and INCLUDEDIR to building a framework
- # (PYTHONFRAMEWORK is set) to avoid # linking problems when
- # building a framework with different architectures than
---
-2.7.4
-
+++ /dev/null
-From 1fca2c29a600b1eaa28da19e8c258fa0300c4eaf Mon Sep 17 00:00:00 2001
-From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
-Date: Wed, 23 Dec 2015 11:29:04 +0100
-Subject: [PATCH] Change the install location of _sysconfigdata.py
-
-The _sysconfigdata.py module contains definitions that are needed when
-building Python modules. In cross-compilation mode, when building
-Python extensions for the target, we need to use the _sysconfigdata.py
-of the target Python while executing the host Python.
-
-However until now, the _sysconfigdata.py module was installed in
-build/lib.<arch>-<version> directory, together with a number of
-architecture-specific shared objects, which cannot be used with the
-host Python.
-
-To solve this problem, this patch moves _sysconfigdata.py to a
-separate location, build/sysconfigdata.<arch>-<version>/, and only
-this directory gets added to the PYTHONPATH of the host Python
-interpreter when building Python modules for the target.
-
-Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
----
- Makefile.pre.in | 12 ++++++++++--
- configure.ac | 2 +-
- 2 files changed, 11 insertions(+), 3 deletions(-)
-
-diff --git a/Makefile.pre.in b/Makefile.pre.in
-index 87528a0..5a258e0 100644
---- a/Makefile.pre.in
-+++ b/Makefile.pre.in
-@@ -588,6 +588,9 @@ pybuilddir.txt: $(BUILDPYTHON)
- rm -f ./pybuilddir.txt ; \
- exit 1 ; \
- fi
-+ echo `cat pybuilddir.txt`/sysconfigdata > pysysconfigdatadir.txt
-+ mkdir -p `cat pysysconfigdatadir.txt`
-+ cp `cat pybuilddir.txt`/_sysconfigdata.py `cat pysysconfigdatadir.txt`
-
- # This is shared by the math and cmath modules
- Modules/_math.o: Modules/_math.c Modules/_math.h
-@@ -1261,7 +1264,7 @@ libinstall: build_all $(srcdir)/Lib/$(PLATDIR) $(srcdir)/Modules/xxmodule.c
- else true; \
- fi; \
- done
-- @for i in $(srcdir)/Lib/*.py `cat pybuilddir.txt`/_sysconfigdata.py; \
-+ @for i in $(srcdir)/Lib/*.py ; \
- do \
- if test -x $$i; then \
- $(INSTALL_SCRIPT) $$i $(DESTDIR)$(LIBDEST); \
-@@ -1271,6 +1274,11 @@ libinstall: build_all $(srcdir)/Lib/$(PLATDIR) $(srcdir)/Modules/xxmodule.c
- echo $(INSTALL_DATA) $$i $(LIBDEST); \
- fi; \
- done
-+ $(INSTALL_DATA) `cat pysysconfigdatadir.txt`/_sysconfigdata.py \
-+ $(DESTDIR)$(LIBDEST)
-+ mkdir -p $(DESTDIR)$(LIBDEST)/sysconfigdata
-+ $(INSTALL_DATA) `cat pysysconfigdatadir.txt`/_sysconfigdata.py \
-+ $(DESTDIR)$(LIBDEST)/sysconfigdata
- @for d in $(LIBSUBDIRS); \
- do \
- a=$(srcdir)/Lib/$$d; \
-@@ -1606,7 +1614,7 @@ clean: pycremoval
- find build -name 'fficonfig.h' -exec rm -f {} ';' || true
- find build -name '*.py' -exec rm -f {} ';' || true
- find build -name '*.py[co]' -exec rm -f {} ';' || true
-- -rm -f pybuilddir.txt
-+ -rm -f pybuilddir.txt pysysconfigdatadir.txt
- -rm -f Lib/lib2to3/*Grammar*.pickle
- -rm -f Programs/_testembed Programs/_freeze_importlib
- -rm -rf build
-diff --git a/configure.ac b/configure.ac
-index 1c07c05..8d0a43b 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -71,7 +71,7 @@ if test "$cross_compiling" = yes; then
- AC_MSG_ERROR([python$PACKAGE_VERSION interpreter not found])
- fi
- AC_MSG_RESULT($interp)
-- PYTHON_FOR_BUILD='_PYTHON_PROJECT_BASE=$(abs_builddir) _PYTHON_HOST_PLATFORM=$(_PYTHON_HOST_PLATFORM) PYTHONPATH=$(shell test -f pybuilddir.txt && echo $(abs_builddir)/`cat pybuilddir.txt`:)$(srcdir)/Lib:$(srcdir)/Lib/$(PLATDIR) '$interp
-+ PYTHON_FOR_BUILD='_PYTHON_PROJECT_BASE=$(abs_builddir) _PYTHON_HOST_PLATFORM=$(_PYTHON_HOST_PLATFORM) PYTHONPATH=$(shell test -f pysysconfigdatadir.txt && echo $(abs_builddir)/`cat pysysconfigdatadir.txt`:)$(srcdir)/Lib:$(srcdir)/Lib/$(PLATDIR) '$interp
- fi
- elif test "$cross_compiling" = maybe; then
- AC_MSG_ERROR([Cross compiling required --host=HOST-TUPLE and --build=ARCH])
---
-2.7.4
-
--- /dev/null
+From cc5adc98d981cff5acf0f1c52bf7ae4709a35fc3 Mon Sep 17 00:00:00 2001
+From: Vanya Sergeev <vsergeev@gmail.com>
+Date: Wed, 23 Dec 2015 11:30:33 +0100
+Subject: [PATCH] Disable buggy_getaddrinfo configure test when cross-compiling
+ with IPv6 support
+
+Signed-off-by: Vanya Sergeev <vsergeev@gmail.com>
+---
+ configure.ac | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/configure.ac b/configure.ac
+index 8e7b2ad..250b23b 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -3908,7 +3908,7 @@ fi
+
+ AC_MSG_RESULT($ac_cv_buggy_getaddrinfo)
+
+-if test $have_getaddrinfo = no || test "$ac_cv_buggy_getaddrinfo" = yes
++if test $have_getaddrinfo = no || test "$cross_compiling" != "yes" -a "$ac_cv_buggy_getaddrinfo" = yes
+ then
+ if test $ipv6 = yes
+ then
+--
+2.9.3
+
--- /dev/null
+From 300143451b42717eb05fc8b876f25ff4b202d8c4 Mon Sep 17 00:00:00 2001
+From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+Date: Wed, 22 Feb 2017 16:33:22 -0800
+Subject: [PATCH] Add infrastructure to disable the build of certain extensions
+
+Some of the extensions part of the Python core have dependencies on
+external libraries (sqlite, tk, etc.) or are relatively big and not
+necessarly always useful (CJK codecs for example). By extensions, we
+mean part of Python modules that are written in C and therefore
+compiled to binary code.
+
+Therefore, we introduce a small infrastructure that allows to disable
+some of those extensions. This can be done inside the configure.ac by
+adding values to the DISABLED_EXTENSIONS variable (which is a
+word-separated list of extensions).
+
+The implementation works as follow :
+
+ * configure.ac defines a DISABLED_EXTENSIONS variable, which is
+ substituted (so that when Makefile.pre is generated from
+ Makefile.pre.in, the value of the variable is substituted). For
+ now, this DISABLED_EXTENSIONS variable is empty, later patches will
+ use it.
+
+ * Makefile.pre.in passes the DISABLED_EXTENSIONS value down to the
+ variables passed in the environment when calling the setup.py
+ script that actually builds and installs those extensions.
+
+ * setup.py is modified so that the existing "disabled_module_list" is
+ filled with those pre-disabled extensions listed in
+ DISABLED_EXTENSIONS.
+
+Patch ported to python2.7 by Maxime Ripard <ripard@archos.com>, and
+then extended by Thomas Petazzoni
+<thomas.petazzoni@free-electrons.com>.
+
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+[ Andrey Smirnov: ported to Python 3.6 ]
+Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
+---
+ Makefile.pre.in | 6 +++++-
+ configure.ac | 2 ++
+ setup.py | 6 +++++-
+ 3 files changed, 12 insertions(+), 2 deletions(-)
+
+diff --git a/Makefile.pre.in b/Makefile.pre.in
+index b78a765..0e06ddb 100644
+--- a/Makefile.pre.in
++++ b/Makefile.pre.in
+@@ -188,6 +188,8 @@ FILEMODE= 644
+ # configure script arguments
+ CONFIG_ARGS= @CONFIG_ARGS@
+
++# disabled extensions
++DISABLED_EXTENSIONS= @DISABLED_EXTENSIONS@
+
+ # Subdirectories with code
+ SRCDIRS= @SRCDIRS@
+@@ -606,6 +608,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
+
+
+@@ -1433,7 +1436,8 @@ libainstall: all 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 250b23b..fc4e71a 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -2779,6 +2779,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 f04bf22..c5bce21 100644
+--- a/setup.py
++++ b/setup.py
+@@ -43,7 +43,11 @@ 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' (after any relative
+--
+2.9.3
+
+++ /dev/null
-From 5df8e9556e8026dd19cf932fa8f2b726f56182d1 Mon Sep 17 00:00:00 2001
-From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
-Date: Wed, 23 Dec 2015 11:29:35 +0100
-Subject: [PATCH] Make the build of pyc files conditional
-
-This commit adds a new configure option --disable-pyc-build to disable
-the compilation of pyc.
-
-Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
----
- Makefile.pre.in | 2 ++
- configure.ac | 6 ++++++
- 2 files changed, 8 insertions(+)
-
-diff --git a/Makefile.pre.in b/Makefile.pre.in
-index 5a258e0..6a7d974 100644
---- a/Makefile.pre.in
-+++ b/Makefile.pre.in
-@@ -1309,6 +1309,7 @@ libinstall: build_all $(srcdir)/Lib/$(PLATDIR) $(srcdir)/Modules/xxmodule.c
- $(INSTALL_DATA) $(srcdir)/Modules/xxmodule.c \
- $(DESTDIR)$(LIBDEST)/distutils/tests ; \
- fi
-+ifeq (@PYC_BUILD@,yes)
- -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
- $(PYTHON_FOR_BUILD) -Wi $(DESTDIR)$(LIBDEST)/compileall.py \
- -d $(LIBDEST) -f \
-@@ -1336,6 +1337,7 @@ libinstall: build_all $(srcdir)/Lib/$(PLATDIR) $(srcdir)/Modules/xxmodule.c
- $(PYTHON_FOR_BUILD) -Wi -OO $(DESTDIR)$(LIBDEST)/compileall.py \
- -d $(LIBDEST)/site-packages -f \
- -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
-+endif
- -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
- $(PYTHON_FOR_BUILD) -m lib2to3.pgen2.driver $(DESTDIR)$(LIBDEST)/lib2to3/Grammar.txt
- -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
-diff --git a/configure.ac b/configure.ac
-index 8d0a43b..db0e336 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -1074,6 +1074,12 @@ fi
-
- AC_MSG_CHECKING(LDLIBRARY)
-
-+AC_SUBST(PYC_BUILD)
-+
-+AC_ARG_ENABLE(pyc-build,
-+ AS_HELP_STRING([--disable-pyc-build], [disable build of pyc files]),
-+ [ PYC_BUILD="${enableval}" ], [ PYC_BUILD=yes ])
-+
- # MacOSX framework builds need more magic. LDLIBRARY is the dynamic
- # library that we build, but we do not want to link against it (we
- # will find it with a -framework option). For this reason there is an
---
-2.7.4
-
--- /dev/null
+From 7c21396776e10346dccd805d4250e26e8172a812 Mon Sep 17 00:00:00 2001
+From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+Date: Wed, 23 Dec 2015 11:33:14 +0100
+Subject: [PATCH] Adjust library/header paths for cross-compilation
+
+When cross-compiling third-party extensions, the get_python_inc() or
+get_python_lib() can be called, to return the path to headers or
+libraries. However, they use the sys.prefix of the host Python, which
+returns incorrect paths when cross-compiling (paths pointing to host
+headers and libraries).
+
+In order to fix this, we introduce the _python_sysroot, _python_prefix
+and _python_exec_prefix variables, that allow to override these
+values, and get correct header/library paths when cross-compiling
+third-party Python modules.
+
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+---
+ Lib/distutils/command/build_ext.py | 5 ++++-
+ Lib/distutils/sysconfig.py | 15 +++++++++++----
+ 2 files changed, 15 insertions(+), 5 deletions(-)
+
+diff --git a/Lib/distutils/command/build_ext.py b/Lib/distutils/command/build_ext.py
+index 74de782..d0c847b 100644
+--- a/Lib/distutils/command/build_ext.py
++++ b/Lib/distutils/command/build_ext.py
+@@ -233,7 +233,10 @@ class build_ext(Command):
+ if (sysconfig.get_config_var('Py_ENABLE_SHARED')):
+ if not sysconfig.python_build:
+ # building third party extensions
+- self.library_dirs.append(sysconfig.get_config_var('LIBDIR'))
++ libdir = sysconfig.get_config_var('LIBDIR')
++ if "_python_sysroot" in os.environ:
++ libdir = os.environ.get("_python_sysroot") + libdir
++ self.library_dirs.append(libdir)
+ else:
+ # building python standard extensions
+ self.library_dirs.append('.')
+diff --git a/Lib/distutils/sysconfig.py b/Lib/distutils/sysconfig.py
+index 8bf1a70..5a02145 100644
+--- a/Lib/distutils/sysconfig.py
++++ b/Lib/distutils/sysconfig.py
+@@ -17,10 +17,17 @@ import sys
+ from .errors import DistutilsPlatformError
+
+ # These are needed in a couple of spots, so just compute them once.
+-PREFIX = os.path.normpath(sys.prefix)
+-EXEC_PREFIX = os.path.normpath(sys.exec_prefix)
+-BASE_PREFIX = os.path.normpath(sys.base_prefix)
+-BASE_EXEC_PREFIX = os.path.normpath(sys.base_exec_prefix)
++if "_python_sysroot" in os.environ:
++ _sysroot=os.environ.get('_python_sysroot')
++ PREFIX = os.path.normpath(_sysroot + os.environ.get('_python_prefix'))
++ EXEC_PREFIX = os.path.normpath(_sysroot + os.environ.get('_python_exec_prefix'))
++ BASE_PREFIX = PREFIX
++ BASE_EXEC_PREFIX = EXEC_PREFIX
++else:
++ PREFIX = os.path.normpath(sys.prefix)
++ EXEC_PREFIX = os.path.normpath(sys.exec_prefix)
++ BASE_PREFIX = os.path.normpath(sys.base_prefix)
++ BASE_EXEC_PREFIX = os.path.normpath(sys.base_exec_prefix)
+
+ # Path to the base directory of the project. On Windows the binary may
+ # live in project/PCBuild/win32 or project/PCBuild/amd64.
+--
+2.9.3
+
+++ /dev/null
-From 449ac686b4c0f73bbbf0202c4a5689b5ddb37d53 Mon Sep 17 00:00:00 2001
-From: Vanya Sergeev <vsergeev@gmail.com>
-Date: Wed, 23 Dec 2015 11:30:33 +0100
-Subject: [PATCH] Disable buggy_getaddrinfo configure test when cross-compiling
- with IPv6 support
-
-Signed-off-by: Vanya Sergeev <vsergeev@gmail.com>
----
- configure.ac | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/configure.ac b/configure.ac
-index db0e336..f57f2eb 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -3744,7 +3744,7 @@ fi
-
- AC_MSG_RESULT($ac_cv_buggy_getaddrinfo)
-
--if test $have_getaddrinfo = no || test "$ac_cv_buggy_getaddrinfo" = yes
-+if test $have_getaddrinfo = no || test "$cross_compiling" != "yes" -a "$ac_cv_buggy_getaddrinfo" = yes
- then
- if test $ipv6 = yes
- then
---
-2.7.4
-
+++ /dev/null
-From cbf8556ad057a402629a5be93dc77c906f3a86ab Mon Sep 17 00:00:00 2001
-From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
-Date: Wed, 23 Dec 2015 11:31:08 +0100
-Subject: [PATCH] Add infrastructure to disable the build of certain extensions
-
-Some of the extensions part of the Python core have dependencies on
-external libraries (sqlite, tk, etc.) or are relatively big and not
-necessarly always useful (CJK codecs for example). By extensions, we
-mean part of Python modules that are written in C and therefore
-compiled to binary code.
-
-Therefore, we introduce a small infrastructure that allows to disable
-some of those extensions. This can be done inside the configure.ac by
-adding values to the DISABLED_EXTENSIONS variable (which is a
-word-separated list of extensions).
-
-The implementation works as follow :
-
- * configure.ac defines a DISABLED_EXTENSIONS variable, which is
- substituted (so that when Makefile.pre is generated from
- Makefile.pre.in, the value of the variable is substituted). For
- now, this DISABLED_EXTENSIONS variable is empty, later patches will
- use it.
-
- * Makefile.pre.in passes the DISABLED_EXTENSIONS value down to the
- variables passed in the environment when calling the setup.py
- script that actually builds and installs those extensions.
-
- * setup.py is modified so that the existing "disabled_module_list" is
- filled with those pre-disabled extensions listed in
- DISABLED_EXTENSIONS.
-
-Patch ported to python2.7 by Maxime Ripard <ripard@archos.com>, and
-then extended by Thomas Petazzoni
-<thomas.petazzoni@free-electrons.com>.
-
-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 6a7d974..d70375a 100644
---- a/Makefile.pre.in
-+++ b/Makefile.pre.in
-@@ -182,6 +182,8 @@ FILEMODE= 644
- # configure script arguments
- CONFIG_ARGS= @CONFIG_ARGS@
-
-+# disabled extensions
-+DISABLED_EXTENSIONS= @DISABLED_EXTENSIONS@
-
- # Subdirectories with code
- SRCDIRS= @SRCDIRS@
-@@ -607,6 +609,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
-@@ -1451,7 +1454,8 @@ libainstall: all 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 f57f2eb..c43ff9f 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -2670,6 +2670,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 b67d913..149911c 100644
---- a/setup.py
-+++ b/setup.py
-@@ -44,7 +44,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' (after any relative
---
-2.7.4
-
--- /dev/null
+From 0458813245e8ba3d5b567cd53303cbe975144e95 Mon Sep 17 00:00:00 2001
+From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+Date: Wed, 23 Dec 2015 11:36:00 +0100
+Subject: [PATCH] Don't look in /usr/lib/termcap for libraries
+
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+---
+ setup.py | 5 +----
+ 1 file changed, 1 insertion(+), 4 deletions(-)
+
+diff --git a/setup.py b/setup.py
+index c5bce21..c5eb97d 100644
+--- a/setup.py
++++ b/setup.py
+@@ -786,12 +786,9 @@ class PyBuildExt(build_ext):
+ pass # Issue 7384: Already linked against curses or tinfo.
+ elif curses_library:
+ readline_libs.append(curses_library)
+- elif self.compiler.find_library_file(lib_dirs +
+- ['/usr/lib/termcap'],
+- 'termcap'):
++ elif self.compiler.find_library_file(lib_dirs, 'termcap'):
+ readline_libs.append('termcap')
+ exts.append( Extension('readline', ['readline.c'],
+- library_dirs=['/usr/lib/termcap'],
+ extra_link_args=readline_extra_link_args,
+ libraries=readline_libs) )
+ else:
+--
+2.9.3
+
--- /dev/null
+From 0d6f96e2fcc7d07000e9077622cd411e3b4a4569 Mon Sep 17 00:00:00 2001
+From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+Date: Wed, 23 Dec 2015 11:36:27 +0100
+Subject: [PATCH] Don't add multiarch paths
+
+The add_multiarch_paths() function leads, in certain build
+environments, to the addition of host header paths to the CFLAGS,
+which is not appropriate for cross-compilation. This patch fixes that
+by simply removing the call to add_multiarch_paths() when we're
+cross-compiling.
+
+Investigation done by David <buildroot-2014@inbox.com>.
+
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+---
+ setup.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/setup.py b/setup.py
+index c5eb97d..09fc3ee 100644
+--- a/setup.py
++++ b/setup.py
+@@ -497,10 +497,10 @@ class PyBuildExt(build_ext):
+ if not cross_compiling:
+ add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')
+ add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
++ self.add_multiarch_paths()
+ # only change this for cross builds for 3.3, issues on Mageia
+ if cross_compiling:
+ self.add_gcc_paths()
+- self.add_multiarch_paths()
+
+ # Add paths specified in the environment variables LDFLAGS and
+ # CPPFLAGS for header and library files.
+--
+2.9.3
+
+++ /dev/null
-From 5855e029370e5636e3eb2283eaa8d11248744eac Mon Sep 17 00:00:00 2001
-From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
-Date: Wed, 23 Dec 2015 11:32:23 +0100
-Subject: [PATCH] distutils/sysconfig: use sysconfigdata
-
-In order to make the use of sysconfig cross-compilation compatible,
-use _sysconfigdata.
-
-Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
----
- Lib/distutils/sysconfig.py | 37 ++++---------------------------------
- 1 file changed, 4 insertions(+), 33 deletions(-)
-
-diff --git a/Lib/distutils/sysconfig.py b/Lib/distutils/sysconfig.py
-index 573724d..721edec 100644
---- a/Lib/distutils/sysconfig.py
-+++ b/Lib/distutils/sysconfig.py
-@@ -414,40 +414,11 @@ def expand_makefile_vars(s, vars):
- _config_vars = None
-
- def _init_posix():
-- """Initialize the module as appropriate for POSIX systems."""
-- g = {}
-- # load the installed Makefile:
-- try:
-- filename = get_makefile_filename()
-- parse_makefile(filename, g)
-- except OSError as msg:
-- my_msg = "invalid Python installation: unable to open %s" % filename
-- if hasattr(msg, "strerror"):
-- my_msg = my_msg + " (%s)" % msg.strerror
--
-- raise DistutilsPlatformError(my_msg)
--
-- # load the installed pyconfig.h:
-- try:
-- filename = get_config_h_filename()
-- with open(filename) as file:
-- parse_config_h(file, g)
-- except OSError as msg:
-- my_msg = "invalid Python installation: unable to open %s" % filename
-- if hasattr(msg, "strerror"):
-- my_msg = my_msg + " (%s)" % msg.strerror
--
-- raise DistutilsPlatformError(my_msg)
--
-- # On AIX, there are wrong paths to the linker scripts in the Makefile
-- # -- these paths are relative to the Python source, but when installed
-- # the scripts are in another directory.
-- if python_build:
-- g['LDSHARED'] = g['BLDSHARED']
--
-+ # _sysconfigdata is generated at build time, see the sysconfig module
-+ from _sysconfigdata import build_time_vars
- global _config_vars
-- _config_vars = g
--
-+ _config_vars = {}
-+ _config_vars.update(build_time_vars)
-
- def _init_nt():
- """Initialize the module as appropriate for NT"""
---
-2.7.4
-
--- /dev/null
+From 03936d5f998e60f234617b41f85053ea10b7a3d8 Mon Sep 17 00:00:00 2001
+From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+Date: Wed, 23 Dec 2015 11:43:24 +0100
+Subject: [PATCH] Abort on failed module build
+
+When building a Python module fails, the setup.py script currently
+doesn't exit with an error, and simply continues. This is not a really
+nice behavior, so this patch changes setup.py to abort with an error,
+so that the build issue is clearly noticeable.
+
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+---
+ setup.py | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/setup.py b/setup.py
+index 09fc3ee..0be015e 100644
+--- a/setup.py
++++ b/setup.py
+@@ -312,6 +312,7 @@ class PyBuildExt(build_ext):
+ print("Failed to build these modules:")
+ print_three_column(failed)
+ print()
++ sys.exit(1)
+
+ if self.failed_on_import:
+ failed = self.failed_on_import[:]
+--
+2.9.3
+
+++ /dev/null
-From f24bff04a609d30ead9776ae3b27aa579135c8bf Mon Sep 17 00:00:00 2001
-From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
-Date: Wed, 23 Dec 2015 11:33:14 +0100
-Subject: [PATCH] Adjust library/header paths for cross-compilation
-
-When cross-compiling third-party extensions, the get_python_inc() or
-get_python_lib() can be called, to return the path to headers or
-libraries. However, they use the sys.prefix of the host Python, which
-returns incorrect paths when cross-compiling (paths pointing to host
-headers and libraries).
-
-In order to fix this, we introduce the _python_sysroot, _python_prefix
-and _python_exec_prefix variables, that allow to override these
-values, and get correct header/library paths when cross-compiling
-third-party Python modules.
-
-Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
----
- Lib/distutils/command/build_ext.py | 5 ++++-
- Lib/distutils/sysconfig.py | 15 +++++++++++----
- 2 files changed, 15 insertions(+), 5 deletions(-)
-
-diff --git a/Lib/distutils/command/build_ext.py b/Lib/distutils/command/build_ext.py
-index f03a4e3..0355963 100644
---- a/Lib/distutils/command/build_ext.py
-+++ b/Lib/distutils/command/build_ext.py
-@@ -232,7 +232,10 @@ class build_ext(Command):
- if (sysconfig.get_config_var('Py_ENABLE_SHARED')):
- if not sysconfig.python_build:
- # building third party extensions
-- self.library_dirs.append(sysconfig.get_config_var('LIBDIR'))
-+ libdir = sysconfig.get_config_var('LIBDIR')
-+ if "_python_sysroot" in os.environ:
-+ libdir = os.environ.get("_python_sysroot") + libdir
-+ self.library_dirs.append(libdir)
- else:
- # building python standard extensions
- self.library_dirs.append('.')
-diff --git a/Lib/distutils/sysconfig.py b/Lib/distutils/sysconfig.py
-index 721edec..d20e2d8 100644
---- a/Lib/distutils/sysconfig.py
-+++ b/Lib/distutils/sysconfig.py
-@@ -17,10 +17,17 @@ import sys
- from .errors import DistutilsPlatformError
-
- # These are needed in a couple of spots, so just compute them once.
--PREFIX = os.path.normpath(sys.prefix)
--EXEC_PREFIX = os.path.normpath(sys.exec_prefix)
--BASE_PREFIX = os.path.normpath(sys.base_prefix)
--BASE_EXEC_PREFIX = os.path.normpath(sys.base_exec_prefix)
-+if "_python_sysroot" in os.environ:
-+ _sysroot=os.environ.get('_python_sysroot')
-+ PREFIX = os.path.normpath(_sysroot + os.environ.get('_python_prefix'))
-+ EXEC_PREFIX = os.path.normpath(_sysroot + os.environ.get('_python_exec_prefix'))
-+ BASE_PREFIX = PREFIX
-+ BASE_EXEC_PREFIX = EXEC_PREFIX
-+else:
-+ PREFIX = os.path.normpath(sys.prefix)
-+ EXEC_PREFIX = os.path.normpath(sys.exec_prefix)
-+ BASE_PREFIX = os.path.normpath(sys.base_prefix)
-+ BASE_EXEC_PREFIX = os.path.normpath(sys.base_exec_prefix)
-
- # Path to the base directory of the project. On Windows the binary may
- # live in project/PCBuild/win32 or project/PCBuild/amd64.
---
-2.7.4
-
+++ /dev/null
-From f59154777625b039d8f76aa787817b108867ee04 Mon Sep 17 00:00:00 2001
-From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
-Date: Wed, 23 Dec 2015 11:36:00 +0100
-Subject: [PATCH] Don't look in /usr/lib/termcap for libraries
-
-Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
----
- setup.py | 5 +----
- 1 file changed, 1 insertion(+), 4 deletions(-)
-
-diff --git a/setup.py b/setup.py
-index 149911c..1b4b981 100644
---- a/setup.py
-+++ b/setup.py
-@@ -783,12 +783,9 @@ class PyBuildExt(build_ext):
- pass # Issue 7384: Already linked against curses or tinfo.
- elif curses_library:
- readline_libs.append(curses_library)
-- elif self.compiler.find_library_file(lib_dirs +
-- ['/usr/lib/termcap'],
-- 'termcap'):
-+ elif self.compiler.find_library_file(lib_dirs, 'termcap'):
- readline_libs.append('termcap')
- exts.append( Extension('readline', ['readline.c'],
-- library_dirs=['/usr/lib/termcap'],
- extra_link_args=readline_extra_link_args,
- libraries=readline_libs) )
- else:
---
-2.7.4
-
--- /dev/null
+From 076ac00569a0e6b330d75951c599a36464c4902b Mon Sep 17 00:00:00 2001
+From: Baruch Siach <baruch@tkos.co.il>
+Date: Wed, 23 Dec 2015 11:44:02 +0100
+Subject: [PATCH] Serial ioctl() workaround
+
+The ioctls.h of some architectures (notably xtensa) references structs from
+linux/serial.h. Make sure to include this header as well.
+
+Also, undef TIOCTTYGSTRUCT that require reference to internal kernel tty_struct,
+but isn't actually referenced in modern kernels.
+
+Signed-off-by: Baruch Siach <baruch@tkos.co.il>
+---
+ Modules/termios.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/Modules/termios.c b/Modules/termios.c
+index b78d33e..58b0444 100644
+--- a/Modules/termios.c
++++ b/Modules/termios.c
+@@ -9,7 +9,9 @@
+ #endif
+
+ #include <termios.h>
++#include <linux/serial.h>
+ #include <sys/ioctl.h>
++#undef TIOCTTYGSTRUCT
+
+ /* HP-UX requires that this be included to pick up MDCD, MCTS, MDSR,
+ * MDTR, MRI, and MRTS (appearantly used internally by some things
+--
+2.9.3
+
--- /dev/null
+From 0d63a5df20abeea7a5f10eaceed376151565e766 Mon Sep 17 00:00:00 2001
+From: Christophe Vu-Brugier <cvubrugier@fastmail.fm>
+Date: Wed, 23 Dec 2015 11:44:30 +0100
+Subject: [PATCH] Do not adjust the shebang of Python scripts for
+ cross-compilation
+
+The copy_scripts() method in distutils copies the scripts listed in
+the setup file and adjusts the first line to refer to the current
+Python interpreter. When cross-compiling, this means that the adjusted
+shebang refers to the host Python interpreter.
+
+This patch modifies copy_scripts() to preserve the shebang when
+cross-compilation is detected.
+
+Signed-off-by: Christophe Vu-Brugier <cvubrugier@fastmail.fm>
+---
+ Lib/distutils/command/build_scripts.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/Lib/distutils/command/build_scripts.py b/Lib/distutils/command/build_scripts.py
+index ccc70e6..d6d5419 100644
+--- a/Lib/distutils/command/build_scripts.py
++++ b/Lib/distutils/command/build_scripts.py
+@@ -91,7 +91,7 @@ class build_scripts(Command):
+ adjust = True
+ post_interp = match.group(1) or b''
+
+- if adjust:
++ if adjust and not '_python_sysroot' in os.environ:
+ log.info("copying and adjusting %s -> %s", script,
+ self.build_dir)
+ updated_files.append(outfile)
+--
+2.9.3
+
+++ /dev/null
-From f270af67f4ea6cc781f7cf05ba66e078190368df Mon Sep 17 00:00:00 2001
-From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
-Date: Wed, 23 Dec 2015 11:36:27 +0100
-Subject: [PATCH] Don't add multiarch paths
-
-The add_multiarch_paths() function leads, in certain build
-environments, to the addition of host header paths to the CFLAGS,
-which is not appropriate for cross-compilation. This patch fixes that
-by simply removing the call to add_multiarch_paths() when we're
-cross-compiling.
-
-Investigation done by David <buildroot-2014@inbox.com>.
-
-Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
----
- setup.py | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/setup.py b/setup.py
-index 1b4b981..9a48d5f 100644
---- a/setup.py
-+++ b/setup.py
-@@ -497,10 +497,10 @@ class PyBuildExt(build_ext):
- if not cross_compiling:
- add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')
- add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
-+ self.add_multiarch_paths()
- # only change this for cross builds for 3.3, issues on Mageia
- if cross_compiling:
- self.add_gcc_paths()
-- self.add_multiarch_paths()
-
- # Add paths specified in the environment variables LDFLAGS and
- # CPPFLAGS for header and library files.
---
-2.7.4
-
+++ /dev/null
-From 01780527e647b15f7f1aed4351c18fb4098a8707 Mon Sep 17 00:00:00 2001
-From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
-Date: Wed, 23 Dec 2015 11:43:24 +0100
-Subject: [PATCH] Abort on failed module build
-
-When building a Python module fails, the setup.py script currently
-doesn't exit with an error, and simply continues. This is not a really
-nice behavior, so this patch changes setup.py to abort with an error,
-so that the build issue is clearly noticeable.
-
-Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
----
- setup.py | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/setup.py b/setup.py
-index 9a48d5f..d02012d 100644
---- a/setup.py
-+++ b/setup.py
-@@ -312,6 +312,7 @@ class PyBuildExt(build_ext):
- print("Failed to build these modules:")
- print_three_column(failed)
- print()
-+ sys.exit(1)
-
- if self.failed_on_import:
- failed = self.failed_on_import[:]
---
-2.7.4
-
--- /dev/null
+From 6bb211f4b53e92ffba793863f8c8b97a90f8dd3c Mon Sep 17 00:00:00 2001
+From: Peter Korsgaard <peter@korsgaard.com>
+Date: Thu, 20 Nov 2014 13:24:59 +0100
+Subject: [PATCH] Misc/python-config.sh.in: ensure sed invocations only match
+ beginning of strings
+
+The build/real prefix handling using sed breaks if build != real and the
+standard include / lib directories are used ($prefix/include and $prefix/lib).
+
+E.G.
+
+prefix_build="/usr", libdir="$prefix/lib", includedir="$prefix/include".
+
+If this gets installed with make DESTDIR="/foo" install, then we end up with
+prefix_real = prefix = "/foo/usr" as expected, but
+includedir="/foo/foo/usr/include" and libdir="/foo/foo/usr/lib" because of
+the double sed invocation (prefix is already expanded). Work around it by
+ensuring we only match the beginning of the string.
+
+Submitted upstream: http://bugs.python.org/issue22907
+
+Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
+---
+ Misc/python-config.sh.in | 12 ++++++------
+ 1 file changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/Misc/python-config.sh.in b/Misc/python-config.sh.in
+index 30c6927..f905a71 100644
+--- a/Misc/python-config.sh.in
++++ b/Misc/python-config.sh.in
+@@ -29,12 +29,12 @@ prefix_real=$(installed_prefix "$0")
+
+ # Use sed to fix paths from their built-to locations to their installed-to
+ # locations.
+-prefix=$(echo "$prefix_build" | sed "s#$prefix_build#$prefix_real#")
++prefix=$(echo "$prefix_build" | sed "s#^$prefix_build#$prefix_real#")
+ exec_prefix_build="@exec_prefix@"
+-exec_prefix=$(echo "$exec_prefix_build" | sed "s#$exec_prefix_build#$prefix_real#")
+-includedir=$(echo "@includedir@" | sed "s#$prefix_build#$prefix_real#")
+-libdir=$(echo "@libdir@" | sed "s#$prefix_build#$prefix_real#")
+-CFLAGS=$(echo "@CFLAGS@" | sed "s#$prefix_build#$prefix_real#")
++exec_prefix=$(echo "$exec_prefix_build" | sed "s#^$exec_prefix_build#$prefix_real#")
++includedir=$(echo "@includedir@" | sed "s#^$prefix_build#$prefix_real#")
++libdir=$(echo "@libdir@" | sed "s#^$prefix_build#$prefix_real#")
++CFLAGS=$(echo "@CFLAGS@" | sed "s#^$prefix_build#$prefix_real#")
+ VERSION="@VERSION@"
+ LIBM="@LIBM@"
+ LIBC="@LIBC@"
+@@ -48,7 +48,7 @@ OPT="@OPT@"
+ PY_ENABLE_SHARED="@PY_ENABLE_SHARED@"
+ LDVERSION="@LDVERSION@"
+ LIBDEST=${prefix}/lib/python${VERSION}
+-LIBPL=$(echo "@LIBPL@" | sed "s#$prefix_build#$prefix_real#")
++LIBPL=$(echo "@LIBPL@" | sed "s#^$prefix_build#$prefix_real#")
+ SO="@EXT_SUFFIX@"
+ PYTHONFRAMEWORK="@PYTHONFRAMEWORK@"
+ INCDIR="-I$includedir/python${VERSION}${ABIFLAGS}"
+--
+2.9.3
+
--- /dev/null
+From 147a1974d15654c579d5ac854f969d7393a20744 Mon Sep 17 00:00:00 2001
+From: Samuel Cabrero <samuelcabrero@gmail.com>
+Date: Wed, 23 Dec 2015 11:45:48 +0100
+Subject: [PATCH] Override system locale and set to default when adding gcc
+ paths
+
+Forces the use of the default locale in the function
+add_gcc_paths, which is called when cross compiling to add the
+include and library paths. This is necessary because otherwise
+the gcc output is localized and the output parsing fails, which
+results in no paths added and detect_modules not able to find
+any system library (eg. libz, libssl, etc.)
+
+[Thomas: patch taken from https://bugs.python.org/issue23767.]
+
+Signed-off-by: Samuel Cabrero <samuelcabrero@gmail.com>
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+---
+ setup.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/setup.py b/setup.py
+index 0be015e..c865172 100644
+--- a/setup.py
++++ b/setup.py
+@@ -457,7 +457,7 @@ class PyBuildExt(build_ext):
+ tmpfile = os.path.join(self.build_temp, 'gccpaths')
+ if not os.path.exists(self.build_temp):
+ os.makedirs(self.build_temp)
+- ret = os.system('%s -E -v - </dev/null 2>%s 1>/dev/null' % (gcc, tmpfile))
++ ret = os.system('LC_ALL=C %s -E -v - </dev/null 2>%s 1>/dev/null' % (gcc, tmpfile))
+ is_gcc = False
+ in_incdirs = False
+ inc_dirs = []
+--
+2.9.3
+
+++ /dev/null
-From 49bfbdadd4808e7868e443b2786faf513c9818ea Mon Sep 17 00:00:00 2001
-From: Baruch Siach <baruch@tkos.co.il>
-Date: Wed, 23 Dec 2015 11:44:02 +0100
-Subject: [PATCH] Serial ioctl() workaround
-
-The ioctls.h of some architectures (notably xtensa) references structs from
-linux/serial.h. Make sure to include this header as well.
-
-Also, undef TIOCTTYGSTRUCT that require reference to internal kernel tty_struct,
-but isn't actually referenced in modern kernels.
-
-Signed-off-by: Baruch Siach <baruch@tkos.co.il>
----
- Modules/termios.c | 2 ++
- 1 file changed, 2 insertions(+)
-
-diff --git a/Modules/termios.c b/Modules/termios.c
-index b78d33e..58b0444 100644
---- a/Modules/termios.c
-+++ b/Modules/termios.c
-@@ -9,7 +9,9 @@
- #endif
-
- #include <termios.h>
-+#include <linux/serial.h>
- #include <sys/ioctl.h>
-+#undef TIOCTTYGSTRUCT
-
- /* HP-UX requires that this be included to pick up MDCD, MCTS, MDSR,
- * MDTR, MRI, and MRTS (appearantly used internally by some things
---
-2.7.4
-
--- /dev/null
+From 7615840f2298aedc990db3d9be2badb19294a807 Mon Sep 17 00:00:00 2001
+From: Christophe Vu-Brugier <cvubrugier@fastmail.fm>
+Date: Wed, 22 Feb 2017 16:48:49 -0800
+Subject: [PATCH] Add importlib fix for PEP 3147 issue
+
+Python 3 has a new standard for installing .pyc file, called PEP
+3147. Unfortunately, this standard requires both the .py and .pyc
+files to be installed for a Python module to be found. This is quite
+annoying on space-constrained embedded systems, since the .py file is
+technically not required for execution.
+
+This patch changes cache_from_source() and source_from_cache() in
+importlib to get rid of the "__pycache__" directory.
+This effectively disables PEP 3147 for:
+
+* The python standard library
+* Packages built with distutils or setuptools
+* Packages built with automake that use the `py-compile` helper
+
+Signed-off-by: Christophe Vu-Brugier <cvubrugier@fastmail.fm>
+[ Andrey Smirnov: ported to Python 3.6 ]
+Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
+---
+ Lib/importlib/_bootstrap_external.py | 38 +++++-------------------------------
+ 1 file changed, 5 insertions(+), 33 deletions(-)
+
+diff --git a/Lib/importlib/_bootstrap_external.py b/Lib/importlib/_bootstrap_external.py
+index 9feec50..3550013 100644
+--- a/Lib/importlib/_bootstrap_external.py
++++ b/Lib/importlib/_bootstrap_external.py
+@@ -275,8 +275,6 @@ def cache_from_source(path, debug_override=None, *, optimization=None):
+ a True value is the same as setting 'optimization' to the empty string
+ while a False value is equivalent to setting 'optimization' to '1'.
+
+- If sys.implementation.cache_tag is None then NotImplementedError is raised.
+-
+ """
+ if debug_override is not None:
+ _warnings.warn('the debug_override parameter is deprecated; use '
+@@ -288,10 +286,7 @@ def cache_from_source(path, debug_override=None, *, optimization=None):
+ path = _os.fspath(path)
+ head, tail = _path_split(path)
+ base, sep, rest = tail.rpartition('.')
+- tag = sys.implementation.cache_tag
+- if tag is None:
+- raise NotImplementedError('sys.implementation.cache_tag is None')
+- almost_filename = ''.join([(base if base else rest), sep, tag])
++ almost_filename = ''.join([(base if base else rest)])
+ if optimization is None:
+ if sys.flags.optimize == 0:
+ optimization = ''
+@@ -302,40 +297,17 @@ def cache_from_source(path, debug_override=None, *, optimization=None):
+ if not optimization.isalnum():
+ raise ValueError('{!r} is not alphanumeric'.format(optimization))
+ almost_filename = '{}.{}{}'.format(almost_filename, _OPT, optimization)
+- return _path_join(head, _PYCACHE, almost_filename + BYTECODE_SUFFIXES[0])
++ return _path_join(head, almost_filename + BYTECODE_SUFFIXES[0])
+
+
+ def source_from_cache(path):
+ """Given the path to a .pyc. file, return the path to its .py file.
+
+ The .pyc file does not need to exist; this simply returns the path to
+- the .py file calculated to correspond to the .pyc file. If path does
+- not conform to PEP 3147/488 format, ValueError will be raised. If
+- sys.implementation.cache_tag is None then NotImplementedError is raised.
+-
++ the .py file calculated to correspond to the .pyc file.
+ """
+- if sys.implementation.cache_tag is None:
+- raise NotImplementedError('sys.implementation.cache_tag is None')
+- path = _os.fspath(path)
+- head, pycache_filename = _path_split(path)
+- head, pycache = _path_split(head)
+- if pycache != _PYCACHE:
+- raise ValueError('{} not bottom-level directory in '
+- '{!r}'.format(_PYCACHE, path))
+- dot_count = pycache_filename.count('.')
+- if dot_count not in {2, 3}:
+- raise ValueError('expected only 2 or 3 dots in '
+- '{!r}'.format(pycache_filename))
+- elif dot_count == 3:
+- optimization = pycache_filename.rsplit('.', 2)[-2]
+- if not optimization.startswith(_OPT):
+- raise ValueError("optimization portion of filename does not start "
+- "with {!r}".format(_OPT))
+- opt_level = optimization[len(_OPT):]
+- if not opt_level.isalnum():
+- raise ValueError("optimization level {!r} is not an alphanumeric "
+- "value".format(optimization))
+- base_filename = pycache_filename.partition('.')[0]
++ head, filename = _path_split(path)
++ base_filename = filename.partition('.')[0]
+ return _path_join(head, base_filename + SOURCE_SUFFIXES[0])
+
+
+--
+2.9.3
+
+++ /dev/null
-From c0eb115234b1c41a25c1a9e8a39e49155357c45a Mon Sep 17 00:00:00 2001
-From: Christophe Vu-Brugier <cvubrugier@fastmail.fm>
-Date: Wed, 23 Dec 2015 11:44:30 +0100
-Subject: [PATCH] Do not adjust the shebang of Python scripts for
- cross-compilation
-
-The copy_scripts() method in distutils copies the scripts listed in
-the setup file and adjusts the first line to refer to the current
-Python interpreter. When cross-compiling, this means that the adjusted
-shebang refers to the host Python interpreter.
-
-This patch modifies copy_scripts() to preserve the shebang when
-cross-compilation is detected.
-
-Signed-off-by: Christophe Vu-Brugier <cvubrugier@fastmail.fm>
----
- Lib/distutils/command/build_scripts.py | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/Lib/distutils/command/build_scripts.py b/Lib/distutils/command/build_scripts.py
-index 90a8380..bdf4cf1 100644
---- a/Lib/distutils/command/build_scripts.py
-+++ b/Lib/distutils/command/build_scripts.py
-@@ -91,7 +91,7 @@ class build_scripts(Command):
- adjust = True
- post_interp = match.group(1) or b''
-
-- if adjust:
-+ if adjust and not '_python_sysroot' in os.environ:
- log.info("copying and adjusting %s -> %s", script,
- self.build_dir)
- updated_files.append(outfile)
---
-2.7.4
-
--- /dev/null
+From 203087fe335a4b254c415f298ac6710d3f98b27e Mon Sep 17 00:00:00 2001
+From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+Date: Wed, 22 Feb 2017 17:01:18 -0800
+Subject: [PATCH] Add an option to disable installation of test modules
+
+The Python standard distribution comes with many test modules, that
+are not necessarly useful on embedded targets.
+
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+Signed-off-by: Samuel Martin <s.martin49@gmail.com>
+[ Andrey Smirnov: ported to Python 3.6 ]
+Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
+---
+ Makefile.pre.in | 55 ++++++++++++++++++++++++++++++++++++-------------------
+ configure.ac | 5 +++++
+ 2 files changed, 41 insertions(+), 19 deletions(-)
+
+diff --git a/Makefile.pre.in b/Makefile.pre.in
+index 0e06ddb..029d3e3 100644
+--- a/Makefile.pre.in
++++ b/Makefile.pre.in
+@@ -1191,8 +1191,28 @@ maninstall: altmaninstall
+
+ # Install the library
+ XMLLIBSUBDIRS= xml xml/dom xml/etree xml/parsers xml/sax
+-LIBSUBDIRS= tkinter tkinter/test tkinter/test/test_tkinter \
+- tkinter/test/test_ttk site-packages test \
++
++LIBSUBDIRS= tkinter site-packages \
++ asyncio \
++ collections concurrent concurrent/futures encodings \
++ email email/mime \
++ ensurepip ensurepip/_bundled \
++ html json http dbm xmlrpc \
++ sqlite3 \
++ logging csv wsgiref urllib \
++ lib2to3 lib2to3/fixes lib2to3/pgen2 \
++ ctypes ctypes/macholib \
++ idlelib idlelib/Icons \
++ distutils distutils/command $(XMLLIBSUBDIRS) \
++ importlib \
++ turtledemo \
++ multiprocessing multiprocessing/dummy \
++ unittest \
++ venv venv/scripts venv/scripts/common venv/scripts/posix \
++ curses pydoc_data
++
++TESTSUBDIRS= tkinter/test tkinter/test/test_tkinter \
++ tkinter/test/test_ttk test \
+ test/audiodata \
+ test/capath test/data \
+ test/cjkencodings test/decimaltestdata test/xmltestdata \
+@@ -1226,29 +1246,26 @@ LIBSUBDIRS= tkinter tkinter/test tkinter/test/test_tkinter \
+ test/test_importlib/namespace_pkgs/project3/parent/child \
+ test/test_importlib/namespace_pkgs/module_and_namespace_package \
+ test/test_importlib/namespace_pkgs/module_and_namespace_package/a_test \
+- asyncio \
+ test/test_asyncio \
+- collections concurrent concurrent/futures encodings \
+- email email/mime test/test_email test/test_email/data \
+- ensurepip ensurepip/_bundled \
+- html json test/test_json http dbm xmlrpc \
+- sqlite3 sqlite3/test \
+- logging csv wsgiref urllib \
+- lib2to3 lib2to3/fixes lib2to3/pgen2 lib2to3/tests \
++ test/test_email test/test_email/data \
++ test/test_json \
++ sqlite3/test \
++ lib2to3/tests \
+ lib2to3/tests/data lib2to3/tests/data/fixers \
+ lib2to3/tests/data/fixers/myfixes \
+- ctypes ctypes/test ctypes/macholib \
+- idlelib idlelib/Icons idlelib/idle_test \
+- distutils distutils/command distutils/tests $(XMLLIBSUBDIRS) \
+- importlib test/test_importlib test/test_importlib/builtin \
++ ctypes/test \
++ idlelib/idle_test \
++ distutils/tests \
++ test/test_importlib test/test_importlib/builtin \
+ test/test_importlib/extension test/test_importlib/frozen \
+ test/test_importlib/import_ test/test_importlib/source \
+ test/test_tools test/test_warnings test/test_warnings/data \
+- turtledemo \
+- multiprocessing multiprocessing/dummy \
+- unittest unittest/test unittest/test/testmock \
+- venv venv/scripts venv/scripts/common venv/scripts/posix \
+- curses pydoc_data
++ unittest/test unittest/test/testmock
++
++ifeq (@TEST_MODULES@,yes)
++LIBSUBDIRS += $(TESTSUBDIRS)
++endif
++
+ libinstall: build_all $(srcdir)/Modules/xxmodule.c
+ @for i in $(SCRIPTDIR) $(LIBDEST); \
+ do \
+diff --git a/configure.ac b/configure.ac
+index fc4e71a..972eaca 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -3081,6 +3081,11 @@ if test "$posix_threads" = "yes"; then
+ AC_CHECK_FUNCS(pthread_atfork)
+ fi
+
++AC_SUBST(TEST_MODULES)
++
++AC_ARG_ENABLE(test-modules,
++ AS_HELP_STRING([--disable-test-modules], [disable test modules]),
++ [ TEST_MODULES="${enableval}" ], [ TEST_MODULES=yes ])
+
+ # Check for enable-ipv6
+ AH_TEMPLATE(ENABLE_IPV6, [Define if --enable-ipv6 is specified])
+--
+2.9.3
+
+++ /dev/null
-From a92c541ce8dd40af86642ac420e628aeeb6a5f05 Mon Sep 17 00:00:00 2001
-From: Peter Korsgaard <peter@korsgaard.com>
-Date: Thu, 20 Nov 2014 13:24:59 +0100
-Subject: [PATCH] Misc/python-config.sh.in: ensure sed invocations only match
- beginning of strings
-
-The build/real prefix handling using sed breaks if build != real and the
-standard include / lib directories are used ($prefix/include and $prefix/lib).
-
-E.G.
-
-prefix_build="/usr", libdir="$prefix/lib", includedir="$prefix/include".
-
-If this gets installed with make DESTDIR="/foo" install, then we end up with
-prefix_real = prefix = "/foo/usr" as expected, but
-includedir="/foo/foo/usr/include" and libdir="/foo/foo/usr/lib" because of
-the double sed invocation (prefix is already expanded). Work around it by
-ensuring we only match the beginning of the string.
-
-Submitted upstream: http://bugs.python.org/issue22907
-
-Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
----
- Misc/python-config.sh.in | 12 ++++++------
- 1 file changed, 6 insertions(+), 6 deletions(-)
-
-diff --git a/Misc/python-config.sh.in b/Misc/python-config.sh.in
-index 30c6927..f905a71 100644
---- a/Misc/python-config.sh.in
-+++ b/Misc/python-config.sh.in
-@@ -29,12 +29,12 @@ prefix_real=$(installed_prefix "$0")
-
- # Use sed to fix paths from their built-to locations to their installed-to
- # locations.
--prefix=$(echo "$prefix_build" | sed "s#$prefix_build#$prefix_real#")
-+prefix=$(echo "$prefix_build" | sed "s#^$prefix_build#$prefix_real#")
- exec_prefix_build="@exec_prefix@"
--exec_prefix=$(echo "$exec_prefix_build" | sed "s#$exec_prefix_build#$prefix_real#")
--includedir=$(echo "@includedir@" | sed "s#$prefix_build#$prefix_real#")
--libdir=$(echo "@libdir@" | sed "s#$prefix_build#$prefix_real#")
--CFLAGS=$(echo "@CFLAGS@" | sed "s#$prefix_build#$prefix_real#")
-+exec_prefix=$(echo "$exec_prefix_build" | sed "s#^$exec_prefix_build#$prefix_real#")
-+includedir=$(echo "@includedir@" | sed "s#^$prefix_build#$prefix_real#")
-+libdir=$(echo "@libdir@" | sed "s#^$prefix_build#$prefix_real#")
-+CFLAGS=$(echo "@CFLAGS@" | sed "s#^$prefix_build#$prefix_real#")
- VERSION="@VERSION@"
- LIBM="@LIBM@"
- LIBC="@LIBC@"
-@@ -48,7 +48,7 @@ OPT="@OPT@"
- PY_ENABLE_SHARED="@PY_ENABLE_SHARED@"
- LDVERSION="@LDVERSION@"
- LIBDEST=${prefix}/lib/python${VERSION}
--LIBPL=$(echo "@LIBPL@" | sed "s#$prefix_build#$prefix_real#")
-+LIBPL=$(echo "@LIBPL@" | sed "s#^$prefix_build#$prefix_real#")
- SO="@EXT_SUFFIX@"
- PYTHONFRAMEWORK="@PYTHONFRAMEWORK@"
- INCDIR="-I$includedir/python${VERSION}${ABIFLAGS}"
---
-2.7.4
-
--- /dev/null
+From 5255a7e995d67a7f192b4cf3921826a365c00281 Mon Sep 17 00:00:00 2001
+From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+Date: Wed, 22 Feb 2017 17:07:56 -0800
+Subject: [PATCH] Add an option to disable pydoc
+
+It removes 0.5 MB of data from the target plus the pydoc script
+itself.
+
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+Signed-off-by: Samuel Martin <s.martin49@gmail.com>
+[ Andrey Smirnov: ported to Python 3.6 ]
+Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
+---
+ Makefile.pre.in | 8 +++++++-
+ configure.ac | 6 ++++++
+ setup.py | 9 +++++++--
+ 3 files changed, 20 insertions(+), 3 deletions(-)
+
+diff --git a/Makefile.pre.in b/Makefile.pre.in
+index 029d3e3..92315f2 100644
+--- a/Makefile.pre.in
++++ b/Makefile.pre.in
+@@ -1161,7 +1161,9 @@ bininstall: altbininstall
+ -rm -f $(DESTDIR)$(BINDIR)/idle3
+ (cd $(DESTDIR)$(BINDIR); $(LN) -s idle$(VERSION) idle3)
+ -rm -f $(DESTDIR)$(BINDIR)/pydoc3
++ifeq (@PYDOC@,yes)
+ (cd $(DESTDIR)$(BINDIR); $(LN) -s pydoc$(VERSION) pydoc3)
++endif
+ -rm -f $(DESTDIR)$(BINDIR)/2to3
+ (cd $(DESTDIR)$(BINDIR); $(LN) -s 2to3-$(VERSION) 2to3)
+ -rm -f $(DESTDIR)$(BINDIR)/pyvenv
+@@ -1209,7 +1211,7 @@ LIBSUBDIRS= tkinter site-packages \
+ multiprocessing multiprocessing/dummy \
+ unittest \
+ venv venv/scripts venv/scripts/common venv/scripts/posix \
+- curses pydoc_data
++ curses
+
+ TESTSUBDIRS= tkinter/test tkinter/test/test_tkinter \
+ tkinter/test/test_ttk test \
+@@ -1266,6 +1268,10 @@ ifeq (@TEST_MODULES@,yes)
+ LIBSUBDIRS += $(TESTSUBDIRS)
+ endif
+
++ifeq (@PYDOC@,yes)
++LIBSUBDIRS += pydoc_data
++endif
++
+ libinstall: build_all $(srcdir)/Modules/xxmodule.c
+ @for i in $(SCRIPTDIR) $(LIBDEST); \
+ do \
+diff --git a/configure.ac b/configure.ac
+index 972eaca..654594a 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -3081,6 +3081,12 @@ if test "$posix_threads" = "yes"; then
+ AC_CHECK_FUNCS(pthread_atfork)
+ fi
+
++AC_SUBST(PYDOC)
++
++AC_ARG_ENABLE(pydoc,
++ AS_HELP_STRING([--disable-pydoc], [disable pydoc]),
++ [ PYDOC="${enableval}" ], [ PYDOC=yes ])
++
+ AC_SUBST(TEST_MODULES)
+
+ AC_ARG_ENABLE(test-modules,
+diff --git a/setup.py b/setup.py
+index c865172..26bf414 100644
+--- a/setup.py
++++ b/setup.py
+@@ -2278,6 +2278,12 @@ def main():
+ # turn off warnings when deprecated modules are imported
+ import warnings
+ warnings.filterwarnings("ignore",category=DeprecationWarning)
++
++ scripts = ['Tools/scripts/idle3', 'Tools/scripts/2to3',
++ 'Lib/smtpd.py']
++ if not '--disable-pydoc' in sysconfig.get_config_var("CONFIG_ARGS"):
++ scripts += [ 'Tools/scripts/pydoc3' ]
++
+ setup(# PyPI Metadata (PEP 301)
+ name = "Python",
+ version = sys.version.split()[0],
+@@ -2302,8 +2308,7 @@ def main():
+ # If you change the scripts installed here, you also need to
+ # check the PyBuildScripts command above, and change the links
+ # created by the bininstall target in Makefile.pre.in
+- scripts = ["Tools/scripts/pydoc3", "Tools/scripts/idle3",
+- "Tools/scripts/2to3", "Tools/scripts/pyvenv"]
++ scripts = scripts
+ )
+
+ # --install-platlib
+--
+2.9.3
+
+++ /dev/null
-From f33d59b67f26649babc8c91e38eff9bc817d0470 Mon Sep 17 00:00:00 2001
-From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
-Date: Wed, 23 Dec 2015 11:45:13 +0100
-Subject: [PATCH] Do not harcode invalid path to ncursesw headers
-
-Adding /usr/include/ncursesw is obviously invalid when
-cross-compiling. Since the ncursesw headers are no longer installed in
-usr/include/ncursesw/, but directly in usr/include, there is anyway no
-need for a special header path.
-
-Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
----
- setup.py | 1 -
- 1 file changed, 1 deletion(-)
-
-diff --git a/setup.py b/setup.py
-index d02012d..cc2f00b 100644
---- a/setup.py
-+++ b/setup.py
-@@ -1326,7 +1326,6 @@ class PyBuildExt(build_ext):
- panel_library = 'panel'
- if curses_library == 'ncursesw':
- curses_defines.append(('HAVE_NCURSESW', '1'))
-- curses_includes.append('/usr/include/ncursesw')
- # Bug 1464056: If _curses.so links with ncursesw,
- # _curses_panel.so must link with panelw.
- panel_library = 'panelw'
---
-2.7.4
-
--- /dev/null
+From a60b0237cb8eb1899b5c4dcf71527437e79972c9 Mon Sep 17 00:00:00 2001
+From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+Date: Wed, 22 Feb 2017 17:15:31 -0800
+Subject: [PATCH] Add an option to disable lib2to3
+
+lib2to3 is a library to convert Python 2.x code to Python 3.x. As
+such, it is probably not very useful on embedded system targets.
+
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+Signed-off-by: Samuel Martin <s.martin49@gmail.com>
+[ Andrey Smirnov: ported to Python 3.6 ]
+Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
+---
+ Makefile.pre.in | 16 ++++++++++++----
+ configure.ac | 6 ++++++
+ setup.py | 5 +++--
+ 3 files changed, 21 insertions(+), 6 deletions(-)
+
+diff --git a/Makefile.pre.in b/Makefile.pre.in
+index 92315f2..8e67c91 100644
+--- a/Makefile.pre.in
++++ b/Makefile.pre.in
+@@ -1165,7 +1165,9 @@ ifeq (@PYDOC@,yes)
+ (cd $(DESTDIR)$(BINDIR); $(LN) -s pydoc$(VERSION) pydoc3)
+ endif
+ -rm -f $(DESTDIR)$(BINDIR)/2to3
++ifeq (@LIB2TO3@,yes)
+ (cd $(DESTDIR)$(BINDIR); $(LN) -s 2to3-$(VERSION) 2to3)
++endif
+ -rm -f $(DESTDIR)$(BINDIR)/pyvenv
+ (cd $(DESTDIR)$(BINDIR); $(LN) -s pyvenv-$(VERSION) pyvenv)
+ if test "x$(LIPO_32BIT_FLAGS)" != "x" ; then \
+@@ -1202,7 +1204,6 @@ LIBSUBDIRS= tkinter site-packages \
+ html json http dbm xmlrpc \
+ sqlite3 \
+ logging csv wsgiref urllib \
+- lib2to3 lib2to3/fixes lib2to3/pgen2 \
+ ctypes ctypes/macholib \
+ idlelib idlelib/Icons \
+ distutils distutils/command $(XMLLIBSUBDIRS) \
+@@ -1252,9 +1253,6 @@ TESTSUBDIRS= tkinter/test tkinter/test/test_tkinter \
+ test/test_email test/test_email/data \
+ test/test_json \
+ sqlite3/test \
+- lib2to3/tests \
+- lib2to3/tests/data lib2to3/tests/data/fixers \
+- lib2to3/tests/data/fixers/myfixes \
+ ctypes/test \
+ idlelib/idle_test \
+ distutils/tests \
+@@ -1264,6 +1262,14 @@ TESTSUBDIRS= tkinter/test tkinter/test/test_tkinter \
+ test/test_tools test/test_warnings test/test_warnings/data \
+ unittest/test unittest/test/testmock
+
++ifeq (@LIB2TO3@,yes)
++LIBSUBDIRS += lib2to3 lib2to3/fixes lib2to3/pgen2
++TESTSUBDIRS += lib2to3/tests \
++ lib2to3/tests/data \
++ lib2to3/tests/data/fixers \
++ lib2to3/tests/data/fixers/myfixes
++endif
++
+ ifeq (@TEST_MODULES@,yes)
+ LIBSUBDIRS += $(TESTSUBDIRS)
+ endif
+@@ -1363,10 +1369,12 @@ ifeq (@PYC_BUILD@,yes)
+ -d $(LIBDEST)/site-packages -f \
+ -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
+ endif
++ifeq (@LIB2TO3@,yes)
+ -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
+ $(PYTHON_FOR_BUILD) -m lib2to3.pgen2.driver $(DESTDIR)$(LIBDEST)/lib2to3/Grammar.txt
+ -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
+ $(PYTHON_FOR_BUILD) -m lib2to3.pgen2.driver $(DESTDIR)$(LIBDEST)/lib2to3/PatternGrammar.txt
++endif
+
+ python-config: $(srcdir)/Misc/python-config.in Misc/python-config.sh
+ # Substitution happens here, as the completely-expanded BINDIR
+diff --git a/configure.ac b/configure.ac
+index 654594a..b518cbe 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -3093,6 +3093,12 @@ AC_ARG_ENABLE(test-modules,
+ AS_HELP_STRING([--disable-test-modules], [disable test modules]),
+ [ TEST_MODULES="${enableval}" ], [ TEST_MODULES=yes ])
+
++AC_SUBST(LIB2TO3)
++
++AC_ARG_ENABLE(lib2to3,
++ AS_HELP_STRING([--disable-lib2to3], [disable lib2to3]),
++ [ LIB2TO3="${enableval}" ], [ LIB2TO3=yes ])
++
+ # Check for enable-ipv6
+ AH_TEMPLATE(ENABLE_IPV6, [Define if --enable-ipv6 is specified])
+ AC_MSG_CHECKING([if --enable-ipv6 is specified])
+diff --git a/setup.py b/setup.py
+index 26bf414..80ec79b 100644
+--- a/setup.py
++++ b/setup.py
+@@ -2279,10 +2279,11 @@ def main():
+ import warnings
+ warnings.filterwarnings("ignore",category=DeprecationWarning)
+
+- scripts = ['Tools/scripts/idle3', 'Tools/scripts/2to3',
+- 'Lib/smtpd.py']
++ scripts = ['Tools/scripts/idle3', 'Lib/smtpd.py']
+ if not '--disable-pydoc' in sysconfig.get_config_var("CONFIG_ARGS"):
+ scripts += [ 'Tools/scripts/pydoc3' ]
++ if not '--disable-lib2to3' in sysconfig.get_config_var("CONFIG_ARGS"):
++ scripts += [ 'Tools/scripts/2to3' ]
+
+ setup(# PyPI Metadata (PEP 301)
+ name = "Python",
+--
+2.9.3
+
+++ /dev/null
-From 3f2764f8433f49cb7a9e647d3e4ec2ba3cffb694 Mon Sep 17 00:00:00 2001
-From: Samuel Cabrero <samuelcabrero@gmail.com>
-Date: Wed, 23 Dec 2015 11:45:48 +0100
-Subject: [PATCH] Override system locale and set to default when adding gcc
- paths
-
-Forces the use of the default locale in the function
-add_gcc_paths, which is called when cross compiling to add the
-include and library paths. This is necessary because otherwise
-the gcc output is localized and the output parsing fails, which
-results in no paths added and detect_modules not able to find
-any system library (eg. libz, libssl, etc.)
-
-[Thomas: patch taken from https://bugs.python.org/issue23767.]
-
-Signed-off-by: Samuel Cabrero <samuelcabrero@gmail.com>
-Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
----
- setup.py | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/setup.py b/setup.py
-index cc2f00b..1c3b838 100644
---- a/setup.py
-+++ b/setup.py
-@@ -457,7 +457,7 @@ class PyBuildExt(build_ext):
- tmpfile = os.path.join(self.build_temp, 'gccpaths')
- if not os.path.exists(self.build_temp):
- os.makedirs(self.build_temp)
-- ret = os.system('%s -E -v - </dev/null 2>%s 1>/dev/null' % (gcc, tmpfile))
-+ ret = os.system('LC_ALL=C %s -E -v - </dev/null 2>%s 1>/dev/null' % (gcc, tmpfile))
- is_gcc = False
- in_incdirs = False
- inc_dirs = []
---
-2.7.4
-
+++ /dev/null
-From 66c1baaf357f75591ee2f31966385b6eb96c8eb4 Mon Sep 17 00:00:00 2001
-From: Christophe Vu-Brugier <cvubrugier@fastmail.fm>
-Date: Wed, 23 Dec 2015 11:46:14 +0100
-Subject: [PATCH] Add importlib fix for PEP 3147 issue
-
-Python 3 has a new standard for installing .pyc file, called PEP
-3147. Unfortunately, this standard requires both the .py and .pyc
-files to be installed for a Python module to be found. This is quite
-annoying on space-constrained embedded systems, since the .py file is
-technically not required for execution.
-
-This patch changes cache_from_source() and source_from_cache() in
-importlib to get rid of the "__pycache__" directory.
-This effectively disables PEP 3147 for:
-
-* The python standard library
-* Packages built with distutils or setuptools
-* Packages built with automake that use the `py-compile` helper
-
-Signed-off-by: Christophe Vu-Brugier <cvubrugier@fastmail.fm>
----
- Lib/importlib/_bootstrap_external.py | 37 +++++-------------------------------
- 1 file changed, 5 insertions(+), 32 deletions(-)
-
-diff --git a/Lib/importlib/_bootstrap_external.py b/Lib/importlib/_bootstrap_external.py
-index 9788828..dfcc27e 100644
---- a/Lib/importlib/_bootstrap_external.py
-+++ b/Lib/importlib/_bootstrap_external.py
-@@ -258,8 +258,6 @@ def cache_from_source(path, debug_override=None, *, optimization=None):
- a True value is the same as setting 'optimization' to the empty string
- while a False value is equivalent to setting 'optimization' to '1'.
-
-- If sys.implementation.cache_tag is None then NotImplementedError is raised.
--
- """
- if debug_override is not None:
- _warnings.warn('the debug_override parameter is deprecated; use '
-@@ -270,10 +268,7 @@ def cache_from_source(path, debug_override=None, *, optimization=None):
- optimization = '' if debug_override else 1
- head, tail = _path_split(path)
- base, sep, rest = tail.rpartition('.')
-- tag = sys.implementation.cache_tag
-- if tag is None:
-- raise NotImplementedError('sys.implementation.cache_tag is None')
-- almost_filename = ''.join([(base if base else rest), sep, tag])
-+ almost_filename = ''.join([(base if base else rest)])
- if optimization is None:
- if sys.flags.optimize == 0:
- optimization = ''
-@@ -284,39 +279,17 @@ def cache_from_source(path, debug_override=None, *, optimization=None):
- if not optimization.isalnum():
- raise ValueError('{!r} is not alphanumeric'.format(optimization))
- almost_filename = '{}.{}{}'.format(almost_filename, _OPT, optimization)
-- return _path_join(head, _PYCACHE, almost_filename + BYTECODE_SUFFIXES[0])
-+ return _path_join(head, almost_filename + BYTECODE_SUFFIXES[0])
-
-
- def source_from_cache(path):
- """Given the path to a .pyc. file, return the path to its .py file.
-
- The .pyc file does not need to exist; this simply returns the path to
-- the .py file calculated to correspond to the .pyc file. If path does
-- not conform to PEP 3147/488 format, ValueError will be raised. If
-- sys.implementation.cache_tag is None then NotImplementedError is raised.
--
-+ the .py file calculated to correspond to the .pyc file.
- """
-- if sys.implementation.cache_tag is None:
-- raise NotImplementedError('sys.implementation.cache_tag is None')
-- head, pycache_filename = _path_split(path)
-- head, pycache = _path_split(head)
-- if pycache != _PYCACHE:
-- raise ValueError('{} not bottom-level directory in '
-- '{!r}'.format(_PYCACHE, path))
-- dot_count = pycache_filename.count('.')
-- if dot_count not in {2, 3}:
-- raise ValueError('expected only 2 or 3 dots in '
-- '{!r}'.format(pycache_filename))
-- elif dot_count == 3:
-- optimization = pycache_filename.rsplit('.', 2)[-2]
-- if not optimization.startswith(_OPT):
-- raise ValueError("optimization portion of filename does not start "
-- "with {!r}".format(_OPT))
-- opt_level = optimization[len(_OPT):]
-- if not opt_level.isalnum():
-- raise ValueError("optimization level {!r} is not an alphanumeric "
-- "value".format(optimization))
-- base_filename = pycache_filename.partition('.')[0]
-+ head, filename = _path_split(path)
-+ base_filename = filename.partition('.')[0]
- return _path_join(head, base_filename + SOURCE_SUFFIXES[0])
-
-
---
-2.7.4
-
--- /dev/null
+From 59b833c2ee545e53bcb920e9509b67419c2fb1ad Mon Sep 17 00:00:00 2001
+From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+Date: Wed, 22 Feb 2017 17:20:45 -0800
+Subject: [PATCH] Add option to disable the sqlite3 module
+
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+Signed-off-by: Samuel Martin <s.martin49@gmail.com>
+[ Andrey Smirnov: ported to Python 3.6 ]
+Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
+---
+ Makefile.pre.in | 7 +++++--
+ configure.ac | 9 +++++++++
+ 2 files changed, 14 insertions(+), 2 deletions(-)
+
+diff --git a/Makefile.pre.in b/Makefile.pre.in
+index 8e67c91..3907f92 100644
+--- a/Makefile.pre.in
++++ b/Makefile.pre.in
+@@ -1202,7 +1202,6 @@ LIBSUBDIRS= tkinter site-packages \
+ email email/mime \
+ ensurepip ensurepip/_bundled \
+ html json http dbm xmlrpc \
+- sqlite3 \
+ logging csv wsgiref urllib \
+ ctypes ctypes/macholib \
+ idlelib idlelib/Icons \
+@@ -1252,7 +1251,6 @@ TESTSUBDIRS= tkinter/test tkinter/test/test_tkinter \
+ test/test_asyncio \
+ test/test_email test/test_email/data \
+ test/test_json \
+- sqlite3/test \
+ ctypes/test \
+ idlelib/idle_test \
+ distutils/tests \
+@@ -1270,6 +1268,11 @@ TESTSUBDIRS += lib2to3/tests \
+ lib2to3/tests/data/fixers/myfixes
+ endif
+
++ifeq (@SQLITE3@,yes)
++LIBSUBDIRS += sqlite3
++TESTSUBDIRS += sqlite3/test
++endif
++
+ ifeq (@TEST_MODULES@,yes)
+ LIBSUBDIRS += $(TESTSUBDIRS)
+ endif
+diff --git a/configure.ac b/configure.ac
+index b518cbe..a30c45d 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -3081,6 +3081,15 @@ if test "$posix_threads" = "yes"; then
+ AC_CHECK_FUNCS(pthread_atfork)
+ fi
+
++AC_SUBST(SQLITE3)
++AC_ARG_ENABLE(sqlite3,
++ AS_HELP_STRING([--disable-sqlite3], [disable sqlite3]),
++ [ SQLITE3="${enableval}" ], [ SQLITE3=yes ])
++
++if test "$SQLITE3" = "no" ; then
++ DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} _sqlite3"
++fi
++
+ AC_SUBST(PYDOC)
+
+ AC_ARG_ENABLE(pydoc,
+--
+2.9.3
+
+++ /dev/null
-From 78e54257cf149408036661be98be6f2650c5a8f9 Mon Sep 17 00:00:00 2001
-From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
-Date: Wed, 23 Dec 2015 11:47:00 +0100
-Subject: [PATCH] Add an option to disable installation of test modules
-
-The Python standard distribution comes with many test modules, that
-are not necessarly useful on embedded targets.
-
-Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
-Signed-off-by: Samuel Martin <s.martin49@gmail.com>
----
- Makefile.pre.in | 56 ++++++++++++++++++++++++++++++++++++--------------------
- configure.ac | 6 ++++++
- 2 files changed, 42 insertions(+), 20 deletions(-)
-
-diff --git a/Makefile.pre.in b/Makefile.pre.in
-index d70375a..e5a4372 100644
---- a/Makefile.pre.in
-+++ b/Makefile.pre.in
-@@ -1192,8 +1192,30 @@ maninstall: altmaninstall
- PLATDIR= @PLATDIR@
- MACHDEPS= $(PLATDIR)
- XMLLIBSUBDIRS= xml xml/dom xml/etree xml/parsers xml/sax
--LIBSUBDIRS= tkinter tkinter/test tkinter/test/test_tkinter \
-- tkinter/test/test_ttk site-packages test \
-+LIBSUBDIRS= tkinter \
-+ site-packages \
-+ asyncio \
-+ collections concurrent concurrent/futures encodings \
-+ email email/mime \
-+ ensurepip ensurepip/_bundled \
-+ html json http dbm xmlrpc \
-+ sqlite3 \
-+ logging csv wsgiref urllib \
-+ lib2to3 lib2to3/fixes lib2to3/pgen2 \
-+ ctypes ctypes/macholib \
-+ idlelib idlelib/Icons \
-+ distutils distutils/command $(XMLLIBSUBDIRS) \
-+ importlib \
-+ turtledemo \
-+ multiprocessing multiprocessing/dummy \
-+ unittest \
-+ venv venv/scripts venv/scripts/posix \
-+ curses pydoc_data $(MACHDEPS)
-+
-+TESTSUBDIRS = tkinter/test tkinter/test/test_tkinter tkinter/test/test_ttk \
-+ test test/test_asyncio \
-+ test/test_email test/test_email/data \
-+ test/test_json \
- test/audiodata \
- test/capath test/data \
- test/cjkencodings test/decimaltestdata test/xmltestdata \
-@@ -1225,28 +1247,22 @@ LIBSUBDIRS= tkinter tkinter/test tkinter/test/test_tkinter \
- test/test_importlib/namespace_pkgs/project3/parent/child \
- test/test_importlib/namespace_pkgs/module_and_namespace_package \
- test/test_importlib/namespace_pkgs/module_and_namespace_package/a_test \
-- asyncio \
-- test/test_asyncio \
-- collections concurrent concurrent/futures encodings \
-- email email/mime test/test_email test/test_email/data \
-- ensurepip ensurepip/_bundled \
-- html json test/test_json http dbm xmlrpc \
-- sqlite3 sqlite3/test \
-- logging csv wsgiref urllib \
-- lib2to3 lib2to3/fixes lib2to3/pgen2 lib2to3/tests \
-+ sqlite3/test \
-+ lib2to3/tests \
- lib2to3/tests/data lib2to3/tests/data/fixers \
- lib2to3/tests/data/fixers/myfixes \
-- ctypes ctypes/test ctypes/macholib \
-- idlelib idlelib/Icons idlelib/idle_test \
-- distutils distutils/command distutils/tests $(XMLLIBSUBDIRS) \
-- importlib test/test_importlib test/test_importlib/builtin \
-+ ctypes/test \
-+ idlelib/idle_test \
-+ distutils/tests \
-+ test/test_importlib test/test_importlib/builtin \
- test/test_importlib/extension test/test_importlib/frozen \
- test/test_importlib/import_ test/test_importlib/source \
-- turtledemo \
-- multiprocessing multiprocessing/dummy \
-- unittest unittest/test unittest/test/testmock \
-- venv venv/scripts venv/scripts/posix \
-- curses pydoc_data $(MACHDEPS)
-+ unittest/test unittest/test/testmock
-+
-+ifeq (@TEST_MODULES@,yes)
-+LIBSUBDIRS += $(TESTSUBDIRS)
-+endif
-+
- libinstall: build_all $(srcdir)/Lib/$(PLATDIR) $(srcdir)/Modules/xxmodule.c
- @for i in $(SCRIPTDIR) $(LIBDEST); \
- do \
-diff --git a/configure.ac b/configure.ac
-index c43ff9f..8b8c249 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -2977,6 +2977,12 @@ if test "$posix_threads" = "yes"; then
- fi
-
-
-+AC_SUBST(TEST_MODULES)
-+
-+AC_ARG_ENABLE(test-modules,
-+ AS_HELP_STRING([--disable-test-modules], [disable test modules]),
-+ [ TEST_MODULES="${enableval}" ], [ TEST_MODULES=yes ])
-+
- # Check for enable-ipv6
- AH_TEMPLATE(ENABLE_IPV6, [Define if --enable-ipv6 is specified])
- AC_MSG_CHECKING([if --enable-ipv6 is specified])
---
-2.7.4
-
--- /dev/null
+From 4fc4260e66f8b004f14feb332c57a2d8fdd305de Mon Sep 17 00:00:00 2001
+From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+Date: Wed, 22 Feb 2017 17:23:42 -0800
+Subject: [PATCH] Add an option to disable the tk module
+
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+Signed-off-by: Samuel Martin <s.martin49@gmail.com>
+[ Andrey Smirnov: ported to Python 3.6 ]
+Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
+---
+ Makefile.pre.in | 11 ++++++++---
+ configure.ac | 9 +++++++++
+ 2 files changed, 17 insertions(+), 3 deletions(-)
+
+diff --git a/Makefile.pre.in b/Makefile.pre.in
+index 3907f92..93ef34d 100644
+--- a/Makefile.pre.in
++++ b/Makefile.pre.in
+@@ -1196,7 +1196,7 @@ maninstall: altmaninstall
+ # Install the library
+ XMLLIBSUBDIRS= xml xml/dom xml/etree xml/parsers xml/sax
+
+-LIBSUBDIRS= tkinter site-packages \
++LIBSUBDIRS= site-packages \
+ asyncio \
+ collections concurrent concurrent/futures encodings \
+ email email/mime \
+@@ -1213,8 +1213,7 @@ LIBSUBDIRS= tkinter site-packages \
+ venv venv/scripts venv/scripts/common venv/scripts/posix \
+ curses
+
+-TESTSUBDIRS= tkinter/test tkinter/test/test_tkinter \
+- tkinter/test/test_ttk test \
++TESTSUBDIRS= test \
+ test/audiodata \
+ test/capath test/data \
+ test/cjkencodings test/decimaltestdata test/xmltestdata \
+@@ -1260,6 +1259,12 @@ TESTSUBDIRS= tkinter/test tkinter/test/test_tkinter \
+ test/test_tools test/test_warnings test/test_warnings/data \
+ unittest/test unittest/test/testmock
+
++ifeq (@TK@,yes)
++LIBSUBDIRS += tkinter
++TESTSUBDIRS += tkinter/test tkinter/test/test_tkinter \
++ tkinter/test/test_ttk
++endif
++
+ ifeq (@LIB2TO3@,yes)
+ LIBSUBDIRS += lib2to3 lib2to3/fixes lib2to3/pgen2
+ TESTSUBDIRS += lib2to3/tests \
+diff --git a/configure.ac b/configure.ac
+index a30c45d..52887c9 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -3090,6 +3090,15 @@ if test "$SQLITE3" = "no" ; then
+ DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} _sqlite3"
+ fi
+
++AC_SUBST(TK)
++AC_ARG_ENABLE(tk,
++ AS_HELP_STRING([--disable-tk], [disable tk]),
++ [ TK="${enableval}" ], [ TK=yes ])
++
++if test "$TK" = "no"; then
++ DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} _tkinter"
++fi
++
+ AC_SUBST(PYDOC)
+
+ AC_ARG_ENABLE(pydoc,
+--
+2.9.3
+
+++ /dev/null
-From e07206329b3a4cdecaeca7991996950f82cd8744 Mon Sep 17 00:00:00 2001
-From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
-Date: Wed, 23 Dec 2015 11:47:11 +0100
-Subject: [PATCH] Add an option to disable pydoc
-
-It removes 0.5 MB of data from the target plus the pydoc script
-itself.
-
-Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
-Signed-off-by: Samuel Martin <s.martin49@gmail.com>
----
- Makefile.pre.in | 8 +++++++-
- configure.ac | 5 +++++
- setup.py | 9 +++++++--
- 3 files changed, 19 insertions(+), 3 deletions(-)
-
-diff --git a/Makefile.pre.in b/Makefile.pre.in
-index e5a4372..83fc343 100644
---- a/Makefile.pre.in
-+++ b/Makefile.pre.in
-@@ -1160,7 +1160,9 @@ bininstall: altbininstall
- -rm -f $(DESTDIR)$(BINDIR)/idle3
- (cd $(DESTDIR)$(BINDIR); $(LN) -s idle$(VERSION) idle3)
- -rm -f $(DESTDIR)$(BINDIR)/pydoc3
-+ifeq (@PYDOC@,yes)
- (cd $(DESTDIR)$(BINDIR); $(LN) -s pydoc$(VERSION) pydoc3)
-+endif
- -rm -f $(DESTDIR)$(BINDIR)/2to3
- (cd $(DESTDIR)$(BINDIR); $(LN) -s 2to3-$(VERSION) 2to3)
- -rm -f $(DESTDIR)$(BINDIR)/pyvenv
-@@ -1210,7 +1212,7 @@ LIBSUBDIRS= tkinter \
- multiprocessing multiprocessing/dummy \
- unittest \
- venv venv/scripts venv/scripts/posix \
-- curses pydoc_data $(MACHDEPS)
-+ curses $(MACHDEPS)
-
- TESTSUBDIRS = tkinter/test tkinter/test/test_tkinter tkinter/test/test_ttk \
- test test/test_asyncio \
-@@ -1259,6 +1261,10 @@ TESTSUBDIRS = tkinter/test tkinter/test/test_tkinter tkinter/test/test_ttk \
- test/test_importlib/import_ test/test_importlib/source \
- unittest/test unittest/test/testmock
-
-+ifeq (@PYDOC@,yes)
-+LIBSUBDIRS += pydoc_data
-+endif
-+
- ifeq (@TEST_MODULES@,yes)
- LIBSUBDIRS += $(TESTSUBDIRS)
- endif
-diff --git a/configure.ac b/configure.ac
-index 8b8c249..eea25d4 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -2976,6 +2976,11 @@ if test "$posix_threads" = "yes"; then
- AC_CHECK_FUNCS(pthread_atfork)
- fi
-
-+AC_SUBST(PYDOC)
-+
-+AC_ARG_ENABLE(pydoc,
-+ AS_HELP_STRING([--disable-pydoc], [disable pydoc]),
-+ [ PYDOC="${enableval}" ], [ PYDOC=yes ])
-
- AC_SUBST(TEST_MODULES)
-
-diff --git a/setup.py b/setup.py
-index 1c3b838..2a01896 100644
---- a/setup.py
-+++ b/setup.py
-@@ -2253,6 +2253,12 @@ def main():
- # turn off warnings when deprecated modules are imported
- import warnings
- warnings.filterwarnings("ignore",category=DeprecationWarning)
-+
-+ scripts = ['Tools/scripts/idle3', 'Tools/scripts/2to3',
-+ 'Lib/smtpd.py']
-+ if not '--disable-pydoc' in sysconfig.get_config_var("CONFIG_ARGS"):
-+ scripts += [ 'Tools/scripts/pydoc3' ]
-+
- setup(# PyPI Metadata (PEP 301)
- name = "Python",
- version = sys.version.split()[0],
-@@ -2277,8 +2283,7 @@ def main():
- # If you change the scripts installed here, you also need to
- # check the PyBuildScripts command above, and change the links
- # created by the bininstall target in Makefile.pre.in
-- scripts = ["Tools/scripts/pydoc3", "Tools/scripts/idle3",
-- "Tools/scripts/2to3", "Tools/scripts/pyvenv"]
-+ scripts = scripts,
- )
-
- # --install-platlib
---
-2.7.4
-
--- /dev/null
+From 25cb62e9ff67c990be5a694d66394f20b7ca1fda Mon Sep 17 00:00:00 2001
+From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+Date: Wed, 22 Feb 2017 17:31:51 -0800
+Subject: [PATCH] Add an option to disable the curses module
+
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+Signed-off-by: Samuel Martin <s.martin49@gmail.com>
+[ Andrey Smirnov: ported to Python 3.6 ]
+Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
+---
+ Makefile.pre.in | 7 +++++--
+ configure.ac | 9 +++++++++
+ 2 files changed, 14 insertions(+), 2 deletions(-)
+
+diff --git a/Makefile.pre.in b/Makefile.pre.in
+index 93ef34d..3621130 100644
+--- a/Makefile.pre.in
++++ b/Makefile.pre.in
+@@ -1210,8 +1210,7 @@ LIBSUBDIRS= site-packages \
+ turtledemo \
+ multiprocessing multiprocessing/dummy \
+ unittest \
+- venv venv/scripts venv/scripts/common venv/scripts/posix \
+- curses
++ venv venv/scripts venv/scripts/common venv/scripts/posix
+
+ TESTSUBDIRS= test \
+ test/audiodata \
+@@ -1265,6 +1264,10 @@ TESTSUBDIRS += tkinter/test tkinter/test/test_tkinter \
+ tkinter/test/test_ttk
+ endif
+
++ifeq (@CURSES@,yes)
++LIBSUBDIRS += curses
++endif
++
+ ifeq (@LIB2TO3@,yes)
+ LIBSUBDIRS += lib2to3 lib2to3/fixes lib2to3/pgen2
+ TESTSUBDIRS += lib2to3/tests \
+diff --git a/configure.ac b/configure.ac
+index 52887c9..485f73c 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -3099,6 +3099,15 @@ if test "$TK" = "no"; then
+ DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} _tkinter"
+ fi
+
++AC_SUBST(CURSES)
++AC_ARG_ENABLE(curses,
++ AS_HELP_STRING([--disable-curses], [disable curses]),
++ [ CURSES="${enableval}" ], [ CURSES=yes ])
++
++if test "$CURSES" = "no"; then
++ DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} _curses _curses_panel"
++fi
++
+ AC_SUBST(PYDOC)
+
+ AC_ARG_ENABLE(pydoc,
+--
+2.9.3
+
--- /dev/null
+From a7e1fc80dc729018e806d6f3202c852c0d69cba7 Mon Sep 17 00:00:00 2001
+From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+Date: Wed, 22 Feb 2017 17:40:45 -0800
+Subject: [PATCH] Add an option to disable expat
+
+This patch replaces the existing --with-system-expat option with a
+--with-expat={system,builtin,none} option, which allows to tell Python
+whether we want to use the system expat (already installed), the expat
+builtin the Python sources, or no expat at all (which disables the
+installation of XML modules).
+
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+Signed-off-by: Samuel Martin <s.martin49@gmail.com>
+[ Andrey Smirnov: ported to Python 3.6 ]
+Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
+---
+ Makefile.pre.in | 6 +++++-
+ configure.ac | 18 +++++++++++++-----
+ setup.py | 2 +-
+ 3 files changed, 19 insertions(+), 7 deletions(-)
+
+diff --git a/Makefile.pre.in b/Makefile.pre.in
+index 3621130..a9bdbde 100644
+--- a/Makefile.pre.in
++++ b/Makefile.pre.in
+@@ -1205,7 +1205,7 @@ LIBSUBDIRS= site-packages \
+ logging csv wsgiref urllib \
+ ctypes ctypes/macholib \
+ idlelib idlelib/Icons \
+- distutils distutils/command $(XMLLIBSUBDIRS) \
++ distutils distutils/command \
+ importlib \
+ turtledemo \
+ multiprocessing multiprocessing/dummy \
+@@ -1268,6 +1268,10 @@ ifeq (@CURSES@,yes)
+ LIBSUBDIRS += curses
+ endif
+
++ifeq (@EXPAT@,yes)
++LIBSUBDIRS += $(XMLLIBSUBDIRS)
++endif
++
+ ifeq (@LIB2TO3@,yes)
+ LIBSUBDIRS += lib2to3 lib2to3/fixes lib2to3/pgen2
+ TESTSUBDIRS += lib2to3/tests \
+diff --git a/configure.ac b/configure.ac
+index 485f73c..a426b3a 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -2782,13 +2782,21 @@ 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,
+- AS_HELP_STRING([--with-system-expat], [build pyexpat module using an installed expat library]),
++AC_MSG_CHECKING(for --with-expat)
++AC_ARG_WITH(expat,
++ AS_HELP_STRING([--with-expat], [select which expat version to use: system, builtin, none]),
+ [],
+- [with_system_expat="no"])
++ [with_expat="builtin"])
+
+-AC_MSG_RESULT($with_system_expat)
++AC_MSG_RESULT($with_expat)
++
++if test "$with_expat" != "none"; then
++ EXPAT=yes
++else
++ DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} pyexpat"
++ EXPAT=no
++fi
++AC_SUBST(EXPAT)
+
+ # Check for use of the system libffi library
+ AC_MSG_CHECKING(for --with-system-ffi)
+diff --git a/setup.py b/setup.py
+index 80ec79b..660bbd7 100644
+--- a/setup.py
++++ b/setup.py
+@@ -1492,7 +1492,7 @@ class PyBuildExt(build_ext):
+ #
+ # More information on Expat can be found at www.libexpat.org.
+ #
+- if '--with-system-expat' in sysconfig.get_config_var("CONFIG_ARGS"):
++ if '--with-expat=system' in sysconfig.get_config_var("CONFIG_ARGS"):
+ expat_inc = []
+ define_macros = []
+ expat_lib = ['expat']
+--
+2.9.3
+
+++ /dev/null
-From a42283b5bee8bfd0a6a39e6805787643d075f1a5 Mon Sep 17 00:00:00 2001
-From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
-Date: Wed, 23 Dec 2015 11:48:44 +0100
-Subject: [PATCH] Add an option to disable lib2to3
-
-lib2to3 is a library to convert Python 2.x code to Python 3.x. As
-such, it is probably not very useful on embedded system targets.
-
-Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
-Signed-off-by: Samuel Martin <s.martin49@gmail.com>
----
- Makefile.pre.in | 16 ++++++++++++----
- configure.ac | 6 ++++++
- setup.py | 5 +++--
- 3 files changed, 21 insertions(+), 6 deletions(-)
-
-diff --git a/Makefile.pre.in b/Makefile.pre.in
-index 83fc343..aeedad9 100644
---- a/Makefile.pre.in
-+++ b/Makefile.pre.in
-@@ -1164,7 +1164,9 @@ ifeq (@PYDOC@,yes)
- (cd $(DESTDIR)$(BINDIR); $(LN) -s pydoc$(VERSION) pydoc3)
- endif
- -rm -f $(DESTDIR)$(BINDIR)/2to3
-+ifeq (@LIB2TO3@,yes)
- (cd $(DESTDIR)$(BINDIR); $(LN) -s 2to3-$(VERSION) 2to3)
-+endif
- -rm -f $(DESTDIR)$(BINDIR)/pyvenv
- (cd $(DESTDIR)$(BINDIR); $(LN) -s pyvenv-$(VERSION) pyvenv)
- if test "x$(LIPO_32BIT_FLAGS)" != "x" ; then \
-@@ -1203,7 +1205,6 @@ LIBSUBDIRS= tkinter \
- html json http dbm xmlrpc \
- sqlite3 \
- logging csv wsgiref urllib \
-- lib2to3 lib2to3/fixes lib2to3/pgen2 \
- ctypes ctypes/macholib \
- idlelib idlelib/Icons \
- distutils distutils/command $(XMLLIBSUBDIRS) \
-@@ -1250,9 +1251,6 @@ TESTSUBDIRS = tkinter/test tkinter/test/test_tkinter tkinter/test/test_ttk \
- test/test_importlib/namespace_pkgs/module_and_namespace_package \
- test/test_importlib/namespace_pkgs/module_and_namespace_package/a_test \
- sqlite3/test \
-- lib2to3/tests \
-- lib2to3/tests/data lib2to3/tests/data/fixers \
-- lib2to3/tests/data/fixers/myfixes \
- ctypes/test \
- idlelib/idle_test \
- distutils/tests \
-@@ -1265,6 +1263,14 @@ ifeq (@PYDOC@,yes)
- LIBSUBDIRS += pydoc_data
- endif
-
-+ifeq (@LIB2TO3@,yes)
-+LIBSUBDIRS += lib2to3 lib2to3/fixes lib2to3/pgen2
-+TESTSUBDIRS += lib2to3/tests \
-+ lib2to3/tests/data \
-+ lib2to3/tests/data/fixers \
-+ lib2to3/tests/data/fixers/myfixes
-+endif
-+
- ifeq (@TEST_MODULES@,yes)
- LIBSUBDIRS += $(TESTSUBDIRS)
- endif
-@@ -1363,10 +1369,12 @@ ifeq (@PYC_BUILD@,yes)
- -d $(LIBDEST)/site-packages -f \
- -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
- endif
-+ifeq (@LIB2TO3@,yes)
- -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
- $(PYTHON_FOR_BUILD) -m lib2to3.pgen2.driver $(DESTDIR)$(LIBDEST)/lib2to3/Grammar.txt
- -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
- $(PYTHON_FOR_BUILD) -m lib2to3.pgen2.driver $(DESTDIR)$(LIBDEST)/lib2to3/PatternGrammar.txt
-+endif
-
- # Create the PLATDIR source directory, if one wasn't distributed..
- $(srcdir)/Lib/$(PLATDIR):
-diff --git a/configure.ac b/configure.ac
-index eea25d4..32239d3 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -2988,6 +2988,12 @@ AC_ARG_ENABLE(test-modules,
- AS_HELP_STRING([--disable-test-modules], [disable test modules]),
- [ TEST_MODULES="${enableval}" ], [ TEST_MODULES=yes ])
-
-+AC_SUBST(LIB2TO3)
-+
-+AC_ARG_ENABLE(lib2to3,
-+ AS_HELP_STRING([--disable-lib2to3], [disable lib2to3]),
-+ [ LIB2TO3="${enableval}" ], [ LIB2TO3=yes ])
-+
- # Check for enable-ipv6
- AH_TEMPLATE(ENABLE_IPV6, [Define if --enable-ipv6 is specified])
- AC_MSG_CHECKING([if --enable-ipv6 is specified])
-diff --git a/setup.py b/setup.py
-index 2a01896..be27531 100644
---- a/setup.py
-+++ b/setup.py
-@@ -2254,10 +2254,11 @@ def main():
- import warnings
- warnings.filterwarnings("ignore",category=DeprecationWarning)
-
-- scripts = ['Tools/scripts/idle3', 'Tools/scripts/2to3',
-- 'Lib/smtpd.py']
-+ scripts = ['Tools/scripts/idle3', 'Lib/smtpd.py']
- if not '--disable-pydoc' in sysconfig.get_config_var("CONFIG_ARGS"):
- scripts += [ 'Tools/scripts/pydoc3' ]
-+ if not '--disable-lib2to3' in sysconfig.get_config_var("CONFIG_ARGS"):
-+ scripts += [ 'Tools/scripts/2to3' ]
-
- setup(# PyPI Metadata (PEP 301)
- name = "Python",
---
-2.7.4
-
--- /dev/null
+From 4c2965ff24ab8b7351222b210f01ac7db52f4dc7 Mon Sep 17 00:00:00 2001
+From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+Date: Wed, 23 Dec 2015 11:49:55 +0100
+Subject: [PATCH] Add an option to disable CJK codecs
+
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+---
+ configure.ac | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/configure.ac b/configure.ac
+index a426b3a..d88ae47 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -3098,6 +3098,12 @@ if test "$SQLITE3" = "no" ; then
+ DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} _sqlite3"
+ fi
+
++AC_ARG_ENABLE(codecs-cjk,
++ AS_HELP_STRING([--disable-codecs-cjk], [disable CJK codecs]),
++ [ if test "$enableval" = "no"; then
++ DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} _codecs_kr _codecs_jp _codecs_cn _codecs_tw _codecs_hk _codecs_iso2022"
++ fi])
++
+ AC_SUBST(TK)
+ AC_ARG_ENABLE(tk,
+ AS_HELP_STRING([--disable-tk], [disable tk]),
+--
+2.9.3
+
+++ /dev/null
-From 3d12c6e8180bc250d77a4bbb78899ccf8566b1cb Mon Sep 17 00:00:00 2001
-From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
-Date: Wed, 23 Dec 2015 11:49:01 +0100
-Subject: [PATCH] Add option to disable the sqlite3 module
-
-Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
-Signed-off-by: Samuel Martin <s.martin49@gmail.com>
----
- Makefile.pre.in | 7 +++++--
- configure.ac | 9 +++++++++
- 2 files changed, 14 insertions(+), 2 deletions(-)
-
-diff --git a/Makefile.pre.in b/Makefile.pre.in
-index aeedad9..d262c04 100644
---- a/Makefile.pre.in
-+++ b/Makefile.pre.in
-@@ -1203,7 +1203,6 @@ LIBSUBDIRS= tkinter \
- email email/mime \
- ensurepip ensurepip/_bundled \
- html json http dbm xmlrpc \
-- sqlite3 \
- logging csv wsgiref urllib \
- ctypes ctypes/macholib \
- idlelib idlelib/Icons \
-@@ -1250,7 +1249,6 @@ TESTSUBDIRS = tkinter/test tkinter/test/test_tkinter tkinter/test/test_ttk \
- test/test_importlib/namespace_pkgs/project3/parent/child \
- test/test_importlib/namespace_pkgs/module_and_namespace_package \
- test/test_importlib/namespace_pkgs/module_and_namespace_package/a_test \
-- sqlite3/test \
- ctypes/test \
- idlelib/idle_test \
- distutils/tests \
-@@ -1271,6 +1269,11 @@ TESTSUBDIRS += lib2to3/tests \
- lib2to3/tests/data/fixers/myfixes
- endif
-
-+ifeq (@SQLITE3@,yes)
-+LIBSUBDIRS += sqlite3
-+TESTSUBDIRS += sqlite3/test
-+endif
-+
- ifeq (@TEST_MODULES@,yes)
- LIBSUBDIRS += $(TESTSUBDIRS)
- endif
-diff --git a/configure.ac b/configure.ac
-index 32239d3..c9d0912 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -2976,6 +2976,15 @@ if test "$posix_threads" = "yes"; then
- AC_CHECK_FUNCS(pthread_atfork)
- fi
-
-+AC_SUBST(SQLITE3)
-+AC_ARG_ENABLE(sqlite3,
-+ AS_HELP_STRING([--disable-sqlite3], [disable sqlite3]),
-+ [ SQLITE3="${enableval}" ], [ SQLITE3=yes ])
-+
-+if test "$SQLITE3" = "no" ; then
-+ DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} _sqlite3"
-+fi
-+
- AC_SUBST(PYDOC)
-
- AC_ARG_ENABLE(pydoc,
---
-2.7.4
-
--- /dev/null
+From dd10e4ddda9fd4b8205169d223541ab0af506111 Mon Sep 17 00:00:00 2001
+From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+Date: Wed, 23 Dec 2015 11:50:11 +0100
+Subject: [PATCH] Add an option to disable NIS
+
+NIS is not necessarily available in uClibc, so we need an option to
+not compile support for it.
+
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+---
+ configure.ac | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/configure.ac b/configure.ac
+index d88ae47..0099a4a 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -3104,6 +3104,12 @@ AC_ARG_ENABLE(codecs-cjk,
+ DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} _codecs_kr _codecs_jp _codecs_cn _codecs_tw _codecs_hk _codecs_iso2022"
+ fi])
+
++AC_ARG_ENABLE(nis,
++ AS_HELP_STRING([--disable-nis], [disable NIS]),
++ [ if test "$enableval" = "no"; then
++ DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} nis"
++ fi])
++
+ AC_SUBST(TK)
+ AC_ARG_ENABLE(tk,
+ AS_HELP_STRING([--disable-tk], [disable tk]),
+--
+2.9.3
+
+++ /dev/null
-From 61f201afe59bbfbb1094d987fd74ac9cd4764d52 Mon Sep 17 00:00:00 2001
-From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
-Date: Wed, 23 Dec 2015 11:49:14 +0100
-Subject: [PATCH] Add an option to disable the tk module
-
-Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
-Signed-off-by: Samuel Martin <s.martin49@gmail.com>
----
- Makefile.pre.in | 11 ++++++++---
- configure.ac | 9 +++++++++
- 2 files changed, 17 insertions(+), 3 deletions(-)
-
-diff --git a/Makefile.pre.in b/Makefile.pre.in
-index d262c04..851faa3 100644
---- a/Makefile.pre.in
-+++ b/Makefile.pre.in
-@@ -1196,7 +1196,7 @@ maninstall: altmaninstall
- PLATDIR= @PLATDIR@
- MACHDEPS= $(PLATDIR)
- XMLLIBSUBDIRS= xml xml/dom xml/etree xml/parsers xml/sax
--LIBSUBDIRS= tkinter \
-+LIBSUBDIRS= \
- site-packages \
- asyncio \
- collections concurrent concurrent/futures encodings \
-@@ -1214,8 +1214,7 @@ LIBSUBDIRS= tkinter \
- venv venv/scripts venv/scripts/posix \
- curses $(MACHDEPS)
-
--TESTSUBDIRS = tkinter/test tkinter/test/test_tkinter tkinter/test/test_ttk \
-- test test/test_asyncio \
-+TESTSUBDIRS = test test/test_asyncio \
- test/test_email test/test_email/data \
- test/test_json \
- test/audiodata \
-@@ -1274,6 +1273,12 @@ LIBSUBDIRS += sqlite3
- TESTSUBDIRS += sqlite3/test
- endif
-
-+ifeq (@TK@,yes)
-+LIBSUBDIRS += tkinter
-+TESTSUBDIRS += tkinter/test tkinter/test/test_tkinter \
-+ tkinter/test/test_ttk
-+endif
-+
- ifeq (@TEST_MODULES@,yes)
- LIBSUBDIRS += $(TESTSUBDIRS)
- endif
-diff --git a/configure.ac b/configure.ac
-index c9d0912..d5047ec 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -2985,6 +2985,15 @@ if test "$SQLITE3" = "no" ; then
- DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} _sqlite3"
- fi
-
-+AC_SUBST(TK)
-+AC_ARG_ENABLE(tk,
-+ AS_HELP_STRING([--disable-tk], [disable tk]),
-+ [ TK="${enableval}" ], [ TK=yes ])
-+
-+if test "$TK" = "no"; then
-+ DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} _tkinter"
-+fi
-+
- AC_SUBST(PYDOC)
-
- AC_ARG_ENABLE(pydoc,
---
-2.7.4
-
+++ /dev/null
-From 2d1a718b6fc386e718c26dec23633f478e8791a0 Mon Sep 17 00:00:00 2001
-From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
-Date: Wed, 23 Dec 2015 11:49:30 +0100
-Subject: [PATCH] Add an option to disable the curses module
-
-Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
-Signed-off-by: Samuel Martin <s.martin49@gmail.com>
----
- Makefile.pre.in | 6 +++++-
- configure.ac | 9 +++++++++
- 2 files changed, 14 insertions(+), 1 deletion(-)
-
-diff --git a/Makefile.pre.in b/Makefile.pre.in
-index 851faa3..90a055c 100644
---- a/Makefile.pre.in
-+++ b/Makefile.pre.in
-@@ -1212,7 +1212,7 @@ LIBSUBDIRS= \
- multiprocessing multiprocessing/dummy \
- unittest \
- venv venv/scripts venv/scripts/posix \
-- curses $(MACHDEPS)
-+ $(MACHDEPS)
-
- TESTSUBDIRS = test test/test_asyncio \
- test/test_email test/test_email/data \
-@@ -1279,6 +1279,10 @@ TESTSUBDIRS += tkinter/test tkinter/test/test_tkinter \
- tkinter/test/test_ttk
- endif
-
-+ifeq (@CURSES@,yes)
-+LIBSUBDIRS += curses
-+endif
-+
- ifeq (@TEST_MODULES@,yes)
- LIBSUBDIRS += $(TESTSUBDIRS)
- endif
-diff --git a/configure.ac b/configure.ac
-index d5047ec..3814ba0 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -2994,6 +2994,15 @@ if test "$TK" = "no"; then
- DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} _tkinter"
- fi
-
-+AC_SUBST(CURSES)
-+AC_ARG_ENABLE(curses,
-+ AS_HELP_STRING([--disable-curses], [disable curses]),
-+ [ CURSES="${enableval}" ], [ CURSES=yes ])
-+
-+if test "$CURSES" = "no"; then
-+ DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} _curses _curses_panel"
-+fi
-+
- AC_SUBST(PYDOC)
-
- AC_ARG_ENABLE(pydoc,
---
-2.7.4
-
--- /dev/null
+From 949887ee3dbbb274539309d3c42ac04fdd67f34f Mon Sep 17 00:00:00 2001
+From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+Date: Wed, 23 Dec 2015 11:50:27 +0100
+Subject: [PATCH] Add an option to disable unicodedata
+
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+---
+ configure.ac | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/configure.ac b/configure.ac
+index 0099a4a..9820526 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -3110,6 +3110,12 @@ AC_ARG_ENABLE(nis,
+ DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} nis"
+ fi])
+
++AC_ARG_ENABLE(unicodedata,
++ AS_HELP_STRING([--disable-unicodedata], [disable unicodedata]),
++ [ if test "$enableval" = "no"; then
++ DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} unicodedata"
++ fi])
++
+ AC_SUBST(TK)
+ AC_ARG_ENABLE(tk,
+ AS_HELP_STRING([--disable-tk], [disable tk]),
+--
+2.9.3
+
--- /dev/null
+From 49814176a19247a39c55feb8e0eb3656cd801118 Mon Sep 17 00:00:00 2001
+From: Maxime Ripard <maxime.ripard@free-electrons.com>
+Date: Wed, 22 Feb 2017 17:45:14 -0800
+Subject: [PATCH] Add an option to disable IDLE
+
+IDLE is an IDE embedded into python, written using Tk, so it doesn't make
+much sense to have it into our build.
+
+Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
+[ Andrey Smirnov: ported to Python 3.6 ]
+Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
+---
+ Makefile.pre.in | 7 ++++++-
+ configure.ac | 6 ++++++
+ setup.py | 4 +++-
+ 3 files changed, 15 insertions(+), 2 deletions(-)
+
+diff --git a/Makefile.pre.in b/Makefile.pre.in
+index a9bdbde..82b01c9 100644
+--- a/Makefile.pre.in
++++ b/Makefile.pre.in
+@@ -1159,7 +1159,9 @@ bininstall: altbininstall
+ -rm -f $(DESTDIR)$(LIBPC)/python3.pc
+ (cd $(DESTDIR)$(LIBPC); $(LN) -s python-$(VERSION).pc python3.pc)
+ -rm -f $(DESTDIR)$(BINDIR)/idle3
++ifeq (@IDLE@,yes)
+ (cd $(DESTDIR)$(BINDIR); $(LN) -s idle$(VERSION) idle3)
++endif
+ -rm -f $(DESTDIR)$(BINDIR)/pydoc3
+ ifeq (@PYDOC@,yes)
+ (cd $(DESTDIR)$(BINDIR); $(LN) -s pydoc$(VERSION) pydoc3)
+@@ -1204,7 +1206,6 @@ LIBSUBDIRS= site-packages \
+ html json http dbm xmlrpc \
+ logging csv wsgiref urllib \
+ ctypes ctypes/macholib \
+- idlelib idlelib/Icons \
+ distutils distutils/command \
+ importlib \
+ turtledemo \
+@@ -1272,6 +1273,10 @@ ifeq (@EXPAT@,yes)
+ LIBSUBDIRS += $(XMLLIBSUBDIRS)
+ endif
+
++ifeq (@IDLE@,yes)
++LIBSUBDIRS += idlelib idlelib/Icons
++endif
++
+ ifeq (@LIB2TO3@,yes)
+ LIBSUBDIRS += lib2to3 lib2to3/fixes lib2to3/pgen2
+ TESTSUBDIRS += lib2to3/tests \
+diff --git a/configure.ac b/configure.ac
+index 9820526..72989a1 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -3152,6 +3152,12 @@ AC_ARG_ENABLE(lib2to3,
+ AS_HELP_STRING([--disable-lib2to3], [disable lib2to3]),
+ [ LIB2TO3="${enableval}" ], [ LIB2TO3=yes ])
+
++AC_SUBST(IDLE)
++
++AC_ARG_ENABLE(idle3,
++ AS_HELP_STRING([--disable-idle3], [disable idle3 IDE]),
++ [ IDLE="${enableval}" ], [ IDLE=yes ])
++
+ # Check for enable-ipv6
+ AH_TEMPLATE(ENABLE_IPV6, [Define if --enable-ipv6 is specified])
+ AC_MSG_CHECKING([if --enable-ipv6 is specified])
+diff --git a/setup.py b/setup.py
+index 660bbd7..1079eba 100644
+--- a/setup.py
++++ b/setup.py
+@@ -2279,11 +2279,13 @@ def main():
+ import warnings
+ warnings.filterwarnings("ignore",category=DeprecationWarning)
+
+- scripts = ['Tools/scripts/idle3', 'Lib/smtpd.py']
++ scripts = [ 'Lib/smtpd.py']
+ if not '--disable-pydoc' in sysconfig.get_config_var("CONFIG_ARGS"):
+ scripts += [ 'Tools/scripts/pydoc3' ]
+ if not '--disable-lib2to3' in sysconfig.get_config_var("CONFIG_ARGS"):
+ scripts += [ 'Tools/scripts/2to3' ]
++ if not '--disable-idle3' in sysconfig.get_config_var("CONFIG_ARGS"):
++ scripts += [ 'Tools/scripts/idle3' ]
+
+ setup(# PyPI Metadata (PEP 301)
+ name = "Python",
+--
+2.9.3
+
+++ /dev/null
-From cb39a3171e28ac6db79d3604959730746e50c2b4 Mon Sep 17 00:00:00 2001
-From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
-Date: Wed, 23 Dec 2015 11:49:42 +0100
-Subject: [PATCH] Add an option to disable expat
-
-This patch replaces the existing --with-system-expat option with a
---with-expat={system,builtin,none} option, which allows to tell Python
-whether we want to use the system expat (already installed), the expat
-builtin the Python sources, or no expat at all (which disables the
-installation of XML modules).
-
-Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
-Signed-off-by: Samuel Martin <s.martin49@gmail.com>
----
- Makefile.pre.in | 6 +++++-
- configure.ac | 18 +++++++++++++-----
- setup.py | 2 +-
- 3 files changed, 19 insertions(+), 7 deletions(-)
-
-diff --git a/Makefile.pre.in b/Makefile.pre.in
-index 90a055c..fcb1ac4 100644
---- a/Makefile.pre.in
-+++ b/Makefile.pre.in
-@@ -1206,7 +1206,7 @@ LIBSUBDIRS= \
- logging csv wsgiref urllib \
- ctypes ctypes/macholib \
- idlelib idlelib/Icons \
-- distutils distutils/command $(XMLLIBSUBDIRS) \
-+ distutils distutils/command \
- importlib \
- turtledemo \
- multiprocessing multiprocessing/dummy \
-@@ -1283,6 +1283,10 @@ ifeq (@CURSES@,yes)
- LIBSUBDIRS += curses
- endif
-
-+ifeq (@EXPAT@,yes)
-+LIBSUBDIRS += $(XMLLIBSUBDIRS)
-+endif
-+
- ifeq (@TEST_MODULES@,yes)
- LIBSUBDIRS += $(TESTSUBDIRS)
- endif
-diff --git a/configure.ac b/configure.ac
-index 3814ba0..a7e9d16 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -2673,13 +2673,21 @@ 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,
-- AS_HELP_STRING([--with-system-expat], [build pyexpat module using an installed expat library]),
-+AC_MSG_CHECKING(for --with-expat)
-+AC_ARG_WITH(expat,
-+ AS_HELP_STRING([--with-expat], [select which expat version to use: system, builtin, none]),
- [],
-- [with_system_expat="no"])
-+ [with_expat="builtin"])
-
--AC_MSG_RESULT($with_system_expat)
-+AC_MSG_RESULT($with_expat)
-+
-+if test "$with_expat" != "none"; then
-+ EXPAT=yes
-+else
-+ DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} pyexpat"
-+ EXPAT=no
-+fi
-+AC_SUBST(EXPAT)
-
- # Check for use of the system libffi library
- AC_MSG_CHECKING(for --with-system-ffi)
-diff --git a/setup.py b/setup.py
-index be27531..53a471c 100644
---- a/setup.py
-+++ b/setup.py
-@@ -1464,7 +1464,7 @@ class PyBuildExt(build_ext):
- #
- # More information on Expat can be found at www.libexpat.org.
- #
-- if '--with-system-expat' in sysconfig.get_config_var("CONFIG_ARGS"):
-+ if '--with-expat=system' in sysconfig.get_config_var("CONFIG_ARGS"):
- expat_inc = []
- define_macros = []
- expat_lib = ['expat']
---
-2.7.4
-
+++ /dev/null
-From 26fb4f055203332db8a346ae80da542f721df01d Mon Sep 17 00:00:00 2001
-From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
-Date: Wed, 23 Dec 2015 11:49:55 +0100
-Subject: [PATCH] Add an option to disable CJK codecs
-
-Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
----
- configure.ac | 6 ++++++
- 1 file changed, 6 insertions(+)
-
-diff --git a/configure.ac b/configure.ac
-index a7e9d16..e9ea63f 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -2993,6 +2993,12 @@ if test "$SQLITE3" = "no" ; then
- DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} _sqlite3"
- fi
-
-+AC_ARG_ENABLE(codecs-cjk,
-+ AS_HELP_STRING([--disable-codecs-cjk], [disable CJK codecs]),
-+ [ if test "$enableval" = "no"; then
-+ DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} _codecs_kr _codecs_jp _codecs_cn _codecs_tw _codecs_hk _codecs_iso2022"
-+ fi])
-+
- AC_SUBST(TK)
- AC_ARG_ENABLE(tk,
- AS_HELP_STRING([--disable-tk], [disable tk]),
---
-2.7.4
-
--- /dev/null
+From dc321780e26a9270f20b784f438a632bd952cbb3 Mon Sep 17 00:00:00 2001
+From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+Date: Wed, 23 Dec 2015 11:51:31 +0100
+Subject: [PATCH] Add an option to disable decimal
+
+This patch replaces the existing --with-system-libmpdec option with a
+--with-libmpdec={system,builtin,none} option, which allows to tell
+Python whether we want to use the system libmpdec (already installed),
+the libmpdec builtin the Python sources, or no libmpdec at all.
+
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+---
+ configure.ac | 17 ++++++++++++-----
+ setup.py | 2 +-
+ 2 files changed, 13 insertions(+), 6 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index 72989a1..71aea1d 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -2831,13 +2831,20 @@ AC_SUBST(LIBFFI_INCLUDEDIR)
+ AC_MSG_RESULT($with_system_ffi)
+
+ # Check for use of the system libmpdec library
+-AC_MSG_CHECKING(for --with-system-libmpdec)
+-AC_ARG_WITH(system_libmpdec,
+- AS_HELP_STRING([--with-system-libmpdec], [build _decimal module using an installed libmpdec library]),
++AC_MSG_CHECKING(for --with-libmpdec)
++AC_ARG_WITH(libmpdec,
++ AS_HELP_STRING([--with-libmpdec], [select which libmpdec version to use: system, builtin, none]),
+ [],
+- [with_system_libmpdec="no"])
++ [with_libmpdec="builtin"])
+
+-AC_MSG_RESULT($with_system_libmpdec)
++AC_MSG_RESULT($with_libmpdec)
++if test "$with_libmpdec" != "none"; then
++ MPDEC=yes
++else
++ DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} _decimal"
++ MPDEC=no
++fi
++AC_SUBST(MPDEC)
+
+ # Check for support for loadable sqlite extensions
+ AC_MSG_CHECKING(for --enable-loadable-sqlite-extensions)
+diff --git a/setup.py b/setup.py
+index 1079eba..c3a96c1 100644
+--- a/setup.py
++++ b/setup.py
+@@ -2055,7 +2055,7 @@ class PyBuildExt(build_ext):
+ def _decimal_ext(self):
+ extra_compile_args = []
+ undef_macros = []
+- if '--with-system-libmpdec' in sysconfig.get_config_var("CONFIG_ARGS"):
++ if '--with-libmpdec=system' in sysconfig.get_config_var("CONFIG_ARGS"):
+ include_dirs = []
+ libraries = [':libmpdec.so.2']
+ sources = ['_decimal/_decimal.c']
+--
+2.9.3
+
+++ /dev/null
-From a2b911055f5b75e02d6a8853a9b21dfad277758e Mon Sep 17 00:00:00 2001
-From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
-Date: Wed, 23 Dec 2015 11:50:11 +0100
-Subject: [PATCH] Add an option to disable NIS
-
-NIS is not necessarily available in uClibc, so we need an option to
-not compile support for it.
-
-Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
----
- configure.ac | 6 ++++++
- 1 file changed, 6 insertions(+)
-
-diff --git a/configure.ac b/configure.ac
-index e9ea63f..98d1332 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -2999,6 +2999,12 @@ AC_ARG_ENABLE(codecs-cjk,
- DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} _codecs_kr _codecs_jp _codecs_cn _codecs_tw _codecs_hk _codecs_iso2022"
- fi])
-
-+AC_ARG_ENABLE(nis,
-+ AS_HELP_STRING([--disable-nis], [disable NIS]),
-+ [ if test "$enableval" = "no"; then
-+ DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} nis"
-+ fi])
-+
- AC_SUBST(TK)
- AC_ARG_ENABLE(tk,
- AS_HELP_STRING([--disable-tk], [disable tk]),
---
-2.7.4
-
--- /dev/null
+From 48f485cfdf79452308a0c6ac24a25c31bacbcbec Mon Sep 17 00:00:00 2001
+From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+Date: Wed, 23 Dec 2015 11:51:58 +0100
+Subject: [PATCH] Add an option to disable the ossaudiodev module
+
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+---
+ configure.ac | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/configure.ac b/configure.ac
+index 71aea1d..9a61018 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -2846,6 +2846,12 @@ else
+ fi
+ AC_SUBST(MPDEC)
+
++AC_ARG_ENABLE(ossaudiodev,
++ AS_HELP_STRING([--disable-ossaudiodev], [disable OSSAUDIODEV]),
++ [ if test "$enableval" = "no"; then
++ DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} ossaudiodev"
++ fi])
++
+ # Check for support for loadable sqlite extensions
+ AC_MSG_CHECKING(for --enable-loadable-sqlite-extensions)
+ AC_ARG_ENABLE(loadable-sqlite-extensions,
+--
+2.9.3
+
+++ /dev/null
-From 8f0bf1aac225c2a4465baeefc3e4538c27c497e7 Mon Sep 17 00:00:00 2001
-From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
-Date: Wed, 23 Dec 2015 11:50:27 +0100
-Subject: [PATCH] Add an option to disable unicodedata
-
-Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
----
- configure.ac | 6 ++++++
- 1 file changed, 6 insertions(+)
-
-diff --git a/configure.ac b/configure.ac
-index 98d1332..b1a1f39 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -3005,6 +3005,12 @@ AC_ARG_ENABLE(nis,
- DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} nis"
- fi])
-
-+AC_ARG_ENABLE(unicodedata,
-+ AS_HELP_STRING([--disable-unicodedata], [disable unicodedata]),
-+ [ if test "$enableval" = "no"; then
-+ DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} unicodedata"
-+ fi])
-+
- AC_SUBST(TK)
- AC_ARG_ENABLE(tk,
- AS_HELP_STRING([--disable-tk], [disable tk]),
---
-2.7.4
-
--- /dev/null
+From 0fbfab21290eeca5b908745e5fb51d2ab2a50aef Mon Sep 17 00:00:00 2001
+From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+Date: Wed, 22 Feb 2017 17:53:40 -0800
+Subject: [PATCH] Support PGEN_FOR_BUILD and FREEZE_IMPORTLIB_FOR_BUILD
+
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+[ Andrey Smirnov: ported to Python 3.6 ]
+Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
+---
+ Makefile.pre.in | 10 ++++++++++
+ configure.ac | 3 +++
+ 2 files changed, 13 insertions(+)
+
+diff --git a/Makefile.pre.in b/Makefile.pre.in
+index 82b01c9..7c14a4e 100644
+--- a/Makefile.pre.in
++++ b/Makefile.pre.in
+@@ -719,10 +719,15 @@ Programs/_testembed: Programs/_testembed.o $(LIBRARY) $(LDLIBRARY) $(PY3LIBRARY)
+ ############################################################################
+ # Importlib
+
++ifeq (@FREEZE_IMPORTLIB_FOR_BUILD@,)
+ Programs/_freeze_importlib.o: Programs/_freeze_importlib.c Makefile
+
+ Programs/_freeze_importlib: Programs/_freeze_importlib.o $(LIBRARY_OBJS_OMIT_FROZEN)
+ $(LINKCC) $(PY_LDFLAGS) -o $@ Programs/_freeze_importlib.o $(LIBRARY_OBJS_OMIT_FROZEN) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST)
++else
++Programs/_freeze_importlib: @FREEZE_IMPORTLIB_FOR_BUILD@
++ cp $^ $@
++endif
+
+ Python/importlib_external.h: @GENERATED_COMMENT@ $(srcdir)/Lib/importlib/_bootstrap_external.py Programs/_freeze_importlib Python/marshal.c
+ ./Programs/_freeze_importlib \
+@@ -796,8 +801,13 @@ $(GRAMMAR_H): @GENERATED_COMMENT@ $(GRAMMAR_INPUT) $(PGEN)
+ $(GRAMMAR_C): @GENERATED_COMMENT@ $(GRAMMAR_H)
+ touch $(GRAMMAR_C)
+
++ifeq (@PGEN_FOR_BUILD@,)
+ $(PGEN): $(PGENOBJS)
+ $(CC) $(OPT) $(PY_LDFLAGS) $(PGENOBJS) $(LIBS) -o $(PGEN)
++else
++$(PGEN): @PGEN_FOR_BUILD@
++ cp $^ $@
++endif
+
+ Parser/grammar.o: $(srcdir)/Parser/grammar.c \
+ $(srcdir)/Include/token.h \
+diff --git a/configure.ac b/configure.ac
+index 9a61018..3a12788 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -91,6 +91,9 @@ fi
+ AC_SUBST(PYTHON_FOR_BUILD)
+ AC_SUBST(GENERATED_COMMENT)
+
++AC_SUBST(PGEN_FOR_BUILD)
++AC_SUBST(FREEZE_IMPORTLIB_FOR_BUILD)
++
+ dnl Ensure that if prefix is specified, it does not end in a slash. If
+ dnl it does, we get path names containing '//' which is both ugly and
+ dnl can cause trouble.
+--
+2.9.3
+
+++ /dev/null
-From 6187913d2d84a8f0df85781e32a23eb053365134 Mon Sep 17 00:00:00 2001
-From: Maxime Ripard <maxime.ripard@free-electrons.com>
-Date: Wed, 23 Dec 2015 11:50:42 +0100
-Subject: [PATCH] Add an option to disable IDLE
-
-IDLE is an IDE embedded into python, written using Tk, so it doesn't make
-much sense to have it into our build.
-
-Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
----
- Makefile.pre.in | 7 ++++++-
- configure.ac | 6 ++++++
- setup.py | 4 +++-
- 3 files changed, 15 insertions(+), 2 deletions(-)
-
-diff --git a/Makefile.pre.in b/Makefile.pre.in
-index fcb1ac4..0c26bcf 100644
---- a/Makefile.pre.in
-+++ b/Makefile.pre.in
-@@ -1158,7 +1158,9 @@ bininstall: altbininstall
- -rm -f $(DESTDIR)$(LIBPC)/python3.pc
- (cd $(DESTDIR)$(LIBPC); $(LN) -s python-$(VERSION).pc python3.pc)
- -rm -f $(DESTDIR)$(BINDIR)/idle3
-+ifeq (@IDLE@,yes)
- (cd $(DESTDIR)$(BINDIR); $(LN) -s idle$(VERSION) idle3)
-+endif
- -rm -f $(DESTDIR)$(BINDIR)/pydoc3
- ifeq (@PYDOC@,yes)
- (cd $(DESTDIR)$(BINDIR); $(LN) -s pydoc$(VERSION) pydoc3)
-@@ -1205,7 +1207,6 @@ LIBSUBDIRS= \
- html json http dbm xmlrpc \
- logging csv wsgiref urllib \
- ctypes ctypes/macholib \
-- idlelib idlelib/Icons \
- distutils distutils/command \
- importlib \
- turtledemo \
-@@ -1287,6 +1288,10 @@ ifeq (@EXPAT@,yes)
- LIBSUBDIRS += $(XMLLIBSUBDIRS)
- endif
-
-+ifeq (@IDLE@,yes)
-+LIBSUBDIRS += idlelib idlelib/Icons
-+endif
-+
- ifeq (@TEST_MODULES@,yes)
- LIBSUBDIRS += $(TESTSUBDIRS)
- endif
-diff --git a/configure.ac b/configure.ac
-index b1a1f39..d1be997 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -3047,6 +3047,12 @@ AC_ARG_ENABLE(lib2to3,
- AS_HELP_STRING([--disable-lib2to3], [disable lib2to3]),
- [ LIB2TO3="${enableval}" ], [ LIB2TO3=yes ])
-
-+AC_SUBST(IDLE)
-+
-+AC_ARG_ENABLE(idle3,
-+ AS_HELP_STRING([--disable-idle3], [disable idle3 IDE]),
-+ [ IDLE="${enableval}" ], [ IDLE=yes ])
-+
- # Check for enable-ipv6
- AH_TEMPLATE(ENABLE_IPV6, [Define if --enable-ipv6 is specified])
- AC_MSG_CHECKING([if --enable-ipv6 is specified])
-diff --git a/setup.py b/setup.py
-index 53a471c..b443987 100644
---- a/setup.py
-+++ b/setup.py
-@@ -2254,11 +2254,13 @@ def main():
- import warnings
- warnings.filterwarnings("ignore",category=DeprecationWarning)
-
-- scripts = ['Tools/scripts/idle3', 'Lib/smtpd.py']
-+ scripts = ['Lib/smtpd.py']
- if not '--disable-pydoc' in sysconfig.get_config_var("CONFIG_ARGS"):
- scripts += [ 'Tools/scripts/pydoc3' ]
- if not '--disable-lib2to3' in sysconfig.get_config_var("CONFIG_ARGS"):
- scripts += [ 'Tools/scripts/2to3' ]
-+ if not '--disable-idle3' in sysconfig.get_config_var("CONFIG_ARGS"):
-+ scripts += [ 'Tools/scripts/idle3' ]
-
- setup(# PyPI Metadata (PEP 301)
- name = "Python",
---
-2.7.4
-
--- /dev/null
+From 275db73c38e9b2135c774c475826fa077f8835c4 Mon Sep 17 00:00:00 2001
+From: Nicolas Cavallari <nicolas.cavallari@green-communications.fr>
+Date: Wed, 22 Feb 2017 17:55:59 -0800
+Subject: [PATCH] Add an option to disable openssl support.
+
+Signed-off-by: Nicolas Cavallari <nicolas.cavallari@green-communications.fr>
+---
+ configure.ac | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/configure.ac b/configure.ac
+index 3a12788..af12c09 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -3132,6 +3132,12 @@ AC_ARG_ENABLE(unicodedata,
+ DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} unicodedata"
+ fi])
+
++AC_ARG_ENABLE(openssl,
++ AS_HELP_STRING([--disable-openssl], [disable openssl support]),
++ [ if test "$enableval" = "no"; then
++ DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} ssl _ssl _hashlib"
++ fi])
++
+ AC_SUBST(TK)
+ AC_ARG_ENABLE(tk,
+ AS_HELP_STRING([--disable-tk], [disable tk]),
+--
+2.9.3
+
+++ /dev/null
-From 1c51f93b8244e3e3be4d125465255c5a056abe22 Mon Sep 17 00:00:00 2001
-From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
-Date: Wed, 23 Dec 2015 11:51:31 +0100
-Subject: [PATCH] Add an option to disable decimal
-
-This patch replaces the existing --with-system-libmpdec option with a
---with-libmpdec={system,builtin,none} option, which allows to tell
-Python whether we want to use the system libmpdec (already installed),
-the libmpdec builtin the Python sources, or no libmpdec at all.
-
-Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
----
- configure.ac | 17 ++++++++++++-----
- setup.py | 2 +-
- 2 files changed, 13 insertions(+), 6 deletions(-)
-
-diff --git a/configure.ac b/configure.ac
-index d1be997..3d08ab0 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -2706,13 +2706,20 @@ AC_SUBST(LIBFFI_INCLUDEDIR)
- AC_MSG_RESULT($with_system_ffi)
-
- # Check for use of the system libmpdec library
--AC_MSG_CHECKING(for --with-system-libmpdec)
--AC_ARG_WITH(system_libmpdec,
-- AS_HELP_STRING([--with-system-libmpdec], [build _decimal module using an installed libmpdec library]),
-+AC_MSG_CHECKING(for --with-libmpdec)
-+AC_ARG_WITH(libmpdec,
-+ AS_HELP_STRING([--with-libmpdec], [select which libmpdec version to use: system, builtin, none]),
- [],
-- [with_system_libmpdec="no"])
-+ [with_libmpdec="builtin"])
-
--AC_MSG_RESULT($with_system_libmpdec)
-+AC_MSG_RESULT($with_libmpdec)
-+if test "$with_libmpdec" != "none"; then
-+ MPDEC=yes
-+else
-+ DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} _decimal"
-+ MPDEC=no
-+fi
-+AC_SUBST(MPDEC)
-
- # Check for support for loadable sqlite extensions
- AC_MSG_CHECKING(for --enable-loadable-sqlite-extensions)
-diff --git a/setup.py b/setup.py
-index b443987..a1580a0 100644
---- a/setup.py
-+++ b/setup.py
-@@ -2021,7 +2021,7 @@ class PyBuildExt(build_ext):
- def _decimal_ext(self):
- extra_compile_args = []
- undef_macros = []
-- if '--with-system-libmpdec' in sysconfig.get_config_var("CONFIG_ARGS"):
-+ if '--with-libmpdec=system' in sysconfig.get_config_var("CONFIG_ARGS"):
- include_dirs = []
- libraries = [':libmpdec.so.2']
- sources = ['_decimal/_decimal.c']
---
-2.7.4
-
--- /dev/null
+From 57e9ef788c27a112b79e489b375882f66f818b0a Mon Sep 17 00:00:00 2001
+From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+Date: Tue, 7 Mar 2017 23:29:05 +0100
+Subject: [PATCH] Add an option to disable the readline module
+
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+---
+ configure.ac | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/configure.ac b/configure.ac
+index af12c09..64dadb4 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -3138,6 +3138,12 @@ AC_ARG_ENABLE(openssl,
+ DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} ssl _ssl _hashlib"
+ fi])
+
++AC_ARG_ENABLE(readline,
++ AS_HELP_STRING([--disable-readline], [disable readline]),
++ [ if test "$enableval" = "no"; then
++ DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} readline"
++ fi])
++
+ AC_SUBST(TK)
+ AC_ARG_ENABLE(tk,
+ AS_HELP_STRING([--disable-tk], [disable tk]),
+--
+2.9.3
+
+++ /dev/null
-From ed4bf13c66a3faa186781ca8ab2978a9bc8d5f39 Mon Sep 17 00:00:00 2001
-From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
-Date: Wed, 23 Dec 2015 11:51:58 +0100
-Subject: [PATCH] Add an option to disable the ossaudiodev module
-
-Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
----
- configure.ac | 6 ++++++
- 1 file changed, 6 insertions(+)
-
-diff --git a/configure.ac b/configure.ac
-index 3d08ab0..4e2b88e 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -2721,6 +2721,12 @@ else
- fi
- AC_SUBST(MPDEC)
-
-+AC_ARG_ENABLE(ossaudiodev,
-+ AS_HELP_STRING([--disable-ossaudiodev], [disable OSSAUDIODEV]),
-+ [ if test "$enableval" = "no"; then
-+ DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} ossaudiodev"
-+ fi])
-+
- # Check for support for loadable sqlite extensions
- AC_MSG_CHECKING(for --enable-loadable-sqlite-extensions)
- AC_ARG_ENABLE(loadable-sqlite-extensions,
---
-2.7.4
-
--- /dev/null
+From 25c72356a587dbc3a08679c6713be02a18f7e646 Mon Sep 17 00:00:00 2001
+From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+Date: Tue, 7 Mar 2017 23:31:11 +0100
+Subject: [PATCH] Add options to disable zlib, bzip2 and xz modules
+
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+---
+ configure.ac | 18 ++++++++++++++++++
+ 1 file changed, 18 insertions(+)
+
+diff --git a/configure.ac b/configure.ac
+index 64dadb4..92e9abe 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -3144,6 +3144,24 @@ AC_ARG_ENABLE(readline,
+ DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} readline"
+ fi])
+
++AC_ARG_ENABLE(bzip2,
++ AS_HELP_STRING([--disable-bzip2], [disable bzip2]),
++ [ if test "$enableval" = "no"; then
++ DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} _bz2"
++ fi])
++
++AC_ARG_ENABLE(zlib,
++ AS_HELP_STRING([--disable-zlib], [disable zlib]),
++ [ if test "$enableval" = "no"; then
++ DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} zlib"
++ fi])
++
++AC_ARG_ENABLE(xz,
++ AS_HELP_STRING([--disable-xz], [disable xz]),
++ [ if test "$enableval" = "no"; then
++ DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} _lzma"
++ fi])
++
+ AC_SUBST(TK)
+ AC_ARG_ENABLE(tk,
+ AS_HELP_STRING([--disable-tk], [disable tk]),
+--
+2.9.3
+
+++ /dev/null
-From e151b6863bd8f697f17b50eda2cecef57e433c3e Mon Sep 17 00:00:00 2001
-From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
-Date: Wed, 23 Dec 2015 13:58:00 +0100
-Subject: [PATCH] Support PGEN_FOR_BUILD and FREEZE_IMPORTLIB_FOR_BUILD
-
-Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
----
- Makefile.pre.in | 10 ++++++++++
- configure.ac | 3 +++
- 2 files changed, 13 insertions(+)
-
-diff --git a/Makefile.pre.in b/Makefile.pre.in
-index 0c26bcf..d1237eb 100644
---- a/Makefile.pre.in
-+++ b/Makefile.pre.in
-@@ -719,10 +719,15 @@ Programs/_testembed: Programs/_testembed.o $(LIBRARY) $(LDLIBRARY) $(PY3LIBRARY)
- ############################################################################
- # Importlib
-
-+ifeq (@FREEZE_IMPORTLIB_FOR_BUILD@,)
- Programs/_freeze_importlib.o: Programs/_freeze_importlib.c Makefile
-
- Programs/_freeze_importlib: Programs/_freeze_importlib.o $(LIBRARY_OBJS_OMIT_FROZEN)
- $(LINKCC) $(PY_LDFLAGS) -o $@ Programs/_freeze_importlib.o $(LIBRARY_OBJS_OMIT_FROZEN) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST)
-+else
-+Programs/_freeze_importlib: @FREEZE_IMPORTLIB_FOR_BUILD@
-+ cp $^ $@
-+endif
-
- Python/importlib_external.h: $(srcdir)/Lib/importlib/_bootstrap_external.py Programs/_freeze_importlib
- if test "$(cross_compiling)" != "yes"; then \
-@@ -811,8 +816,13 @@ $(GRAMMAR_C): $(GRAMMAR_H)
- mv $(GRAMMAR_C).tmp $(GRAMMAR_C); \
- fi
-
-+ifeq (@PGEN_FOR_BUILD@,)
- $(PGEN): $(PGENOBJS)
- $(CC) $(OPT) $(PY_LDFLAGS) $(PGENOBJS) $(LIBS) -o $(PGEN)
-+else
-+$(PGEN): @PGEN_FOR_BUILD@
-+ cp $^ $@
-+endif
-
- Parser/grammar.o: $(srcdir)/Parser/grammar.c \
- $(srcdir)/Include/token.h \
-diff --git a/configure.ac b/configure.ac
-index 4e2b88e..16a827c 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -80,6 +80,9 @@ else
- fi
- AC_SUBST(PYTHON_FOR_BUILD)
-
-+AC_SUBST(PGEN_FOR_BUILD)
-+AC_SUBST(FREEZE_IMPORTLIB_FOR_BUILD)
-+
- dnl Ensure that if prefix is specified, it does not end in a slash. If
- dnl it does, we get path names containing '//' which is both ugly and
- dnl can cause trouble.
---
-2.7.4
-
+++ /dev/null
-From d903da1181cedb76d8191b33aea0519844f85b22 Mon Sep 17 00:00:00 2001
-From: Nicolas Cavallari <nicolas.cavallari@green-communications.fr>
-Date: Tue, 7 Mar 2017 23:25:12 +0100
-Subject: [PATCH] Add an option to disable openssl support.
-
-Signed-off-by: Nicolas Cavallari <nicolas.cavallari@green-communications.fr>
----
- configure.ac | 6 ++++++
- 1 file changed, 6 insertions(+)
-
-diff --git a/configure.ac b/configure.ac
-index 16a827c..65c0ce0 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -3027,6 +3027,12 @@ AC_ARG_ENABLE(unicodedata,
- DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} unicodedata"
- fi])
-
-+AC_ARG_ENABLE(openssl,
-+ AS_HELP_STRING([--disable-openssl], [disable openssl support]),
-+ [ if test "$enableval" = "no"; then
-+ DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} ssl _ssl _hashlib"
-+ fi])
-+
- AC_SUBST(TK)
- AC_ARG_ENABLE(tk,
- AS_HELP_STRING([--disable-tk], [disable tk]),
---
-2.7.4
-
+++ /dev/null
-From c01d039d96909a6f4df6fff5f6e7ffe7e3f1e7b2 Mon Sep 17 00:00:00 2001
-From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
-Date: Tue, 7 Mar 2017 23:29:05 +0100
-Subject: [PATCH] Add an option to disable the readline module
-
-Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
----
- configure.ac | 6 ++++++
- 1 file changed, 6 insertions(+)
-
-diff --git a/configure.ac b/configure.ac
-index 65c0ce0..c274e13 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -3033,6 +3033,12 @@ AC_ARG_ENABLE(openssl,
- DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} ssl _ssl _hashlib"
- fi])
-
-+AC_ARG_ENABLE(readline,
-+ AS_HELP_STRING([--disable-readline], [disable readline]),
-+ [ if test "$enableval" = "no"; then
-+ DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} readline"
-+ fi])
-+
- AC_SUBST(TK)
- AC_ARG_ENABLE(tk,
- AS_HELP_STRING([--disable-tk], [disable tk]),
---
-2.7.4
-
+++ /dev/null
-From 69a5a3b7a0307476772943da70162dfe716c674f Mon Sep 17 00:00:00 2001
-From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
-Date: Tue, 7 Mar 2017 23:31:11 +0100
-Subject: [PATCH] Add options to disable zlib, bzip2 and xz modules
-
-Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
----
- configure.ac | 18 ++++++++++++++++++
- 1 file changed, 18 insertions(+)
-
-diff --git a/configure.ac b/configure.ac
-index c274e13..fac9c57 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -3039,6 +3039,24 @@ AC_ARG_ENABLE(readline,
- DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} readline"
- fi])
-
-+AC_ARG_ENABLE(bzip2,
-+ AS_HELP_STRING([--disable-bzip2], [disable bzip2]),
-+ [ if test "$enableval" = "no"; then
-+ DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} _bz2"
-+ fi])
-+
-+AC_ARG_ENABLE(zlib,
-+ AS_HELP_STRING([--disable-zlib], [disable zlib]),
-+ [ if test "$enableval" = "no"; then
-+ DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} zlib"
-+ fi])
-+
-+AC_ARG_ENABLE(xz,
-+ AS_HELP_STRING([--disable-xz], [disable xz]),
-+ [ if test "$enableval" = "no"; then
-+ DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} _lzma"
-+ fi])
-+
- AC_SUBST(TK)
- AC_ARG_ENABLE(tk,
- AS_HELP_STRING([--disable-tk], [disable tk]),
---
-2.7.4
-
-# From https://www.python.org/downloads/release/python-352/
-md5 8906efbacfcdc7c3c9198aeefafd159e Python-3.5.2.tar.xz
+# From https://www.python.org/downloads/release/python-361/
+md5 692b4fc3a2ba0d54d1495d4ead5b0b5c Python-3.6.1.tar.xz
# Locally computed
-sha256 0010f56100b9b74259ebcd5d4b295a32324b58b517403a10d1a2aa7cb22bca40 Python-3.5.2.tar.xz
+sha256 a01810ddfcec216bcdb357a84bfaafdfaa0ca42bbdaa4cb7ff74f5a9961e4041 Python-3.6.1.tar.xz
+
#
################################################################################
-PYTHON3_VERSION_MAJOR = 3.5
-PYTHON3_VERSION = $(PYTHON3_VERSION_MAJOR).2
+PYTHON3_VERSION_MAJOR = 3.6
+PYTHON3_VERSION = $(PYTHON3_VERSION_MAJOR).1
PYTHON3_SOURCE = Python-$(PYTHON3_VERSION).tar.xz
PYTHON3_SITE = http://python.org/ftp/python/$(PYTHON3_VERSION)
PYTHON3_LICENSE = Python software foundation license v2, others
endif
# Provided to other packages
-PYTHON3_PATH = $(TARGET_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR)/sysconfigdata/:$(TARGET_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR)/site-packages/
+PYTHON3_PATH = $(TARGET_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR)/:$(TARGET_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR)/site-packages/
$(eval $(autotools-package))
$(eval $(host-autotools-package))