--- /dev/null
+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>
+Index: b/setup.py
+===================================================================
+--- a/setup.py
++++ b/setup.py
+@@ -493,7 +493,8 @@
+ 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
--- /dev/null
+distutils: fix build_ext check to find whether we're building Python or not
+
+The build_ext logic uses
+sys.executable.startswith(os.path.join(sys.exec_prefix, "bin")) to
+determine whether we're building a third-party Python extension, or a
+built-in Python extension. However, this check is wrong in
+cross-compilation mode, and instead, the sysconfig.python_build
+variable should be used.
+
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+Index: b/Lib/distutils/command/build_ext.py
+===================================================================
+--- a/Lib/distutils/command/build_ext.py
++++ b/Lib/distutils/command/build_ext.py
+@@ -237,7 +237,7 @@
+ # Python's library directory must be appended to library_dirs
+ # See Issues: #1600860, #4366
+ if (sysconfig.get_config_var('Py_ENABLE_SHARED')):
+- if sys.executable.startswith(os.path.join(sys.exec_prefix, "bin")):
++ if not sysconfig.python_build:
+ # building third party extensions
+ self.library_dirs.append(sysconfig.get_config_var('LIBDIR'))
+ else:
--- /dev/null
+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>
+
+Index: b/Makefile.pre.in
+===================================================================
+--- a/Makefile.pre.in
++++ b/Makefile.pre.in
+@@ -558,6 +558,9 @@
+ 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`
+
+ # Build the shared modules
+ # Under GNU make, MAKEFLAGS are sorted and normalized; the 's' for
+@@ -1196,7 +1199,7 @@
+ 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); \
+@@ -1206,6 +1209,11 @@
+ 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; \
+@@ -1529,7 +1537,7 @@
+ 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 Modules/_testembed Modules/_freeze_importlib
+
+Index: b/configure.ac
+===================================================================
+--- a/configure.ac
++++ b/configure.ac
+@@ -70,7 +70,7 @@
+ 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])
--- /dev/null
+python3: Fix pyc-only related runtime exceptions
+
+Python3 changes the pyc lookup strategy, ignoring the
+__pycache__ directory if the .py file is missing. Change
+install location to enable use of .pyc without their parent .py
+
+See http://www.python.org/dev/peps/pep-3147
+
+Signed-off-by: Daniel Nelson <daniel@sigpwr.com>
+
+Index: b/configure.ac
+===================================================================
+--- a/configure.ac
++++ b/configure.ac
+@@ -352,6 +352,23 @@
+ AC_SUBST(FRAMEWORKUNIXTOOLSPREFIX)
+ AC_SUBST(FRAMEWORKINSTALLAPPSPREFIX)
+
++STDLIB_CACHE_FLAGS=
++AC_MSG_CHECKING(for --enable-old-stdlib-cache)
++AC_ARG_ENABLE(old-stdlib-cache,
++ AS_HELP_STRING([--enable-old-stdlib-cache], [enable pre-pep3147 stdlib cache]),
++[
++ if test "$enableval" = "yes"
++ then
++ STDLIB_CACHE_FLAGS="-b"
++ else
++ STDLIB_CACHE_FLAGS=""
++ fi
++],
++[
++ STDLIB_CACHE_FLAGS=""
++])
++AC_SUBST(STDLIB_CACHE_FLAGS)
++
+ ##AC_ARG_WITH(dyld,
+ ## AS_HELP_STRING([--with-dyld],
+ ## [Use (OpenStep|Rhapsody) dynamic linker]))
+Index: b/Makefile.pre.in
+===================================================================
+--- a/Makefile.pre.in
++++ b/Makefile.pre.in
+@@ -162,6 +162,9 @@
+ # Options to enable prebinding (for fast startup prior to Mac OS X 10.3)
+ OTHER_LIBTOOL_OPT=@OTHER_LIBTOOL_OPT@
+
++# Option to enable old-style precompiled stdlib
++STDLIB_CACHE_FLAGS=@STDLIB_CACHE_FLAGS@
++
+ # Environment to run shared python without installed libraries
+ RUNSHARED= @RUNSHARED@
+
+@@ -1246,21 +1249,21 @@
+ fi
+ -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
+ $(PYTHON_FOR_BUILD) -Wi $(DESTDIR)$(LIBDEST)/compileall.py \
+- -d $(LIBDEST) -f \
++ -d $(LIBDEST) -f $(STDLIB_CACHE_FLAGS) \
+ -x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \
+ $(DESTDIR)$(LIBDEST)
+ -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
+ $(PYTHON_FOR_BUILD) -Wi -O $(DESTDIR)$(LIBDEST)/compileall.py \
+- -d $(LIBDEST) -f \
++ -d $(LIBDEST) -f $(STDLIB_CACHE_FLAGS) \
+ -x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \
+ $(DESTDIR)$(LIBDEST)
+ -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
+ $(PYTHON_FOR_BUILD) -Wi $(DESTDIR)$(LIBDEST)/compileall.py \
+- -d $(LIBDEST)/site-packages -f \
++ -d $(LIBDEST)/site-packages -f $(STDLIB_CACHE_FLAGS) \
+ -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
+ -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
+ $(PYTHON_FOR_BUILD) -Wi -O $(DESTDIR)$(LIBDEST)/compileall.py \
+- -d $(LIBDEST)/site-packages -f \
++ -d $(LIBDEST)/site-packages -f $(STDLIB_CACHE_FLAGS) \
+ -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
+ -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
+ $(PYTHON_FOR_BUILD) -m lib2to3.pgen2.driver $(DESTDIR)$(LIBDEST)/lib2to3/Grammar.txt
--- /dev/null
+Index: b/Makefile.pre.in
+===================================================================
+--- a/Makefile.pre.in
++++ b/Makefile.pre.in
+@@ -1247,24 +1247,32 @@
+ $(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 $(STDLIB_CACHE_FLAGS) \
+ -x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \
+ $(DESTDIR)$(LIBDEST)
++endif
++ifeq (@PYO_BUILD@,yes)
+ -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
+ $(PYTHON_FOR_BUILD) -Wi -O $(DESTDIR)$(LIBDEST)/compileall.py \
+ -d $(LIBDEST) -f $(STDLIB_CACHE_FLAGS) \
+ -x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \
+ $(DESTDIR)$(LIBDEST)
++endif
++ifeq (@PYC_BUILD@,yes)
+ -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
+ $(PYTHON_FOR_BUILD) -Wi $(DESTDIR)$(LIBDEST)/compileall.py \
+ -d $(LIBDEST)/site-packages -f $(STDLIB_CACHE_FLAGS) \
+ -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
++endif
++ifeq (@PYO_BUILD@,yes)
+ -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
+ $(PYTHON_FOR_BUILD) -Wi -O $(DESTDIR)$(LIBDEST)/compileall.py \
+ -d $(LIBDEST)/site-packages -f $(STDLIB_CACHE_FLAGS) \
+ -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) \
+Index: b/configure.ac
+===================================================================
+--- a/configure.ac
++++ b/configure.ac
+@@ -939,6 +939,18 @@
+
+ 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 ])
++
++AC_SUBST(PYO_BUILD)
++
++AC_ARG_ENABLE(pyo-build,
++ AS_HELP_STRING([--disable-pyo-build], [disable build of pyo files]),
++ [ PYO_BUILD="${enableval}" ], [ PYO_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
--- /dev/null
+Disable buggy_getaddrinfo configure test when cross-compiling with IPv6 support
+
+Signed-off-by: Vanya Sergeev <vsergeev at gmail.com>
+
+---
+ configure.ac | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+Index: b/configure.ac
+===================================================================
+--- a/configure.ac
++++ b/configure.ac
+@@ -3429,7 +3429,7 @@
+
+ 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
--- /dev/null
+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 | 4 ++++
+ configure.ac | 2 ++
+ setup.py | 5 ++++-
+ 3 files changed, 10 insertions(+), 1 deletion(-)
+
+Index: b/Makefile.pre.in
+===================================================================
+--- a/Makefile.pre.in
++++ b/Makefile.pre.in
+@@ -180,6 +180,8 @@
+ # configure script arguments
+ CONFIG_ARGS= @CONFIG_ARGS@
+
++# disabled extensions
++DISABLED_EXTENSIONS= @DISABLED_EXTENSIONS@
+
+ # Subdirectories with code
+ SRCDIRS= @SRCDIRS@
+@@ -576,6 +578,7 @@
+ 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
+@@ -1386,7 +1389,8 @@
+ # 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) \
+Index: b/configure.ac
+===================================================================
+--- a/configure.ac
++++ b/configure.ac
+@@ -2366,6 +2366,8 @@
+
+ AC_PATH_TOOL([PKG_CONFIG], [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,
+Index: b/setup.py
+===================================================================
+--- a/setup.py
++++ b/setup.py
+@@ -39,7 +39,10 @@
+ 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
--- /dev/null
+Index: b/Lib/distutils/sysconfig.py
+===================================================================
+--- a/Lib/distutils/sysconfig.py
++++ b/Lib/distutils/sysconfig.py
+@@ -423,40 +423,11 @@
+ _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"""
--- /dev/null
+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>
+
+Index: b/Lib/distutils/sysconfig.py
+===================================================================
+--- a/Lib/distutils/sysconfig.py
++++ b/Lib/distutils/sysconfig.py
+@@ -16,10 +16,17 @@
+ 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/PCBuild9. If we're dealing with an x64 Windows build,
+Index: b/Lib/distutils/command/build_ext.py
+===================================================================
+--- a/Lib/distutils/command/build_ext.py
++++ b/Lib/distutils/command/build_ext.py
+@@ -239,7 +239,10 @@
+ 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('.')
--- /dev/null
+Don't look in /usr/lib/termcap for libraries
+
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+
+Index: b/setup.py
+===================================================================
+--- a/setup.py
++++ b/setup.py
+@@ -733,12 +733,9 @@
+ 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:
--- /dev/null
+python3: do not rely only on LIBRARY_PATH for old compilers
+
+The cross-compilation improvements integrated in Python rely on the
+compiler exposing a line starting with LIBRARY_PATH when called with
+-E -v. This is used by Python setup.py to find the installation
+locations of libraries.
+
+However, this LIBRARY_PATH line is not shown by very old compilers,
+such as the gcc 4.2.x compiler used on the AVR32 architecture. This
+causes libraries installed in the sysroot, such as libffi, to not be
+detected by the setup.py script.
+
+To fix this problem, this patch adds addtional logic to setup.py,
+which consists in deriving the library paths from the sysroot
+location, if no LIBRARY_PATH field was found.
+
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+
+Index: b/setup.py
+===================================================================
+--- a/setup.py
++++ b/setup.py
+@@ -427,6 +427,7 @@
+ in_incdirs = False
+ inc_dirs = []
+ lib_dirs = []
++ compiler_has_library_path = False
+ try:
+ if ret >> 8 == 0:
+ with open(tmpfile) as fp:
+@@ -438,6 +439,7 @@
+ elif line.startswith("End of search list"):
+ in_incdirs = False
+ elif is_gcc and line.startswith("LIBRARY_PATH"):
++ compiler_has_library_path = True
+ for d in line.strip().split("=")[1].split(":"):
+ d = os.path.normpath(d)
+ if '/gcc/' not in d:
+@@ -449,6 +451,15 @@
+ finally:
+ os.unlink(tmpfile)
+
++ if not compiler_has_library_path:
++ ret = os.system("%s -print-file-name=libc.a | sed -r -e 's:(usr/)?lib(32|64)?/([^/]*/)?libc\.a::' >%s" % (gcc, tmpfile))
++ with open(tmpfile) as fp:
++ line = fp.readline().strip()
++ add_dir_to_list(self.compiler.library_dirs,
++ os.path.join(line, "usr", "lib"))
++ add_dir_to_list(self.compiler.library_dirs,
++ os.path.join(line, "lib"))
++
+ def detect_modules(self):
+ # Ensure that /usr/local is always used, but the local build
+ # directories (i.e. '.' and 'Include') must be first. See issue
--- /dev/null
+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>
+
+Index: b/setup.py
+===================================================================
+--- a/setup.py
++++ b/setup.py
+@@ -467,10 +467,10 @@
+ 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.
--- /dev/null
+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>
+
+Index: b/setup.py
+===================================================================
+--- a/setup.py
++++ b/setup.py
+@@ -284,6 +284,7 @@
+ print("Failed to build these modules:")
+ print_three_column(failed)
+ print()
++ sys.exit(1)
+
+ def build_extension(self, ext):
+
--- /dev/null
+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>
+---
+diff -Nuar Python-3.4.1-orig/Modules/termios.c Python-3.4.1/Modules/termios.c
+--- Python-3.4.1-orig/Modules/termios.c 2014-05-19 08:19:39.000000000 +0300
++++ Python-3.4.1/Modules/termios.c 2014-08-06 21:16:11.892362933 +0300
+@@ -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
--- /dev/null
+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>
+
+Index: b/Lib/distutils/command/build_scripts.py
+===================================================================
+--- a/Lib/distutils/command/build_scripts.py
++++ b/Lib/distutils/command/build_scripts.py
+@@ -91,7 +91,7 @@
+ 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)
--- /dev/null
+Add distutils 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.
+
+For the Python standard library, our Python 3 package already contains
+a patch named python3-004-old-stdlib-cache.patch, which allows to
+disable the PEP 3147 installation.
+
+But that lives the distutils/setuptools package an unsolved
+problem. This patch therefore adds a new patch to Python, which makes
+distutils package use the traditional installation path when byte
+compiling, rather than the PEP 3147 installation path. Since
+setuptools relies on distutils internally, it also fixes setuptools
+based packages.
+
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+
+Index: b/Lib/distutils/util.py
+===================================================================
+--- a/Lib/distutils/util.py
++++ b/Lib/distutils/util.py
+@@ -437,7 +437,9 @@
+ # Terminology from the py_compile module:
+ # cfile - byte-compiled file
+ # dfile - purported source filename (same as 'file' by default)
+- if optimize >= 0:
++ if "_python_sysroot" in os.environ:
++ cfile = file + (__debug__ and "c" or "o")
++ elif optimize >= 0:
+ cfile = importlib.util.cache_from_source(
+ file, debug_override=not optimize)
+ else:
--- /dev/null
+From 50f34d2cac63b6bf0935294a7d63d9451714f4c4 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 64c81e5..f75eec5 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="@SO@"
+ PYTHONFRAMEWORK="@PYTHONFRAMEWORK@"
+ INCDIR="-I$includedir/python${VERSION}${ABIFLAGS}"
+--
+2.1.3
+
--- /dev/null
+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 | 50 ++++++++++++++++++++++++++++++++------------------
+ configure.ac | 6 ++++++
+ 2 files changed, 38 insertions(+), 18 deletions(-)
+
+Index: b/Makefile.pre.in
+===================================================================
+--- a/Makefile.pre.in
++++ b/Makefile.pre.in
+@@ -1135,8 +1135,30 @@
+ EXTRAPLATDIR= @EXTRAPLATDIR@
+ MACHDEPS= $(PLATDIR) $(EXTRAPLATDIR)
+ 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 \
+@@ -1163,28 +1185,22 @@
+ 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 \
+Index: b/configure.ac
+===================================================================
+--- a/configure.ac
++++ b/configure.ac
+@@ -2673,6 +2673,12 @@
+ 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])
--- /dev/null
+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(-)
+
+Index: b/Makefile.pre.in
+===================================================================
+--- a/Makefile.pre.in
++++ b/Makefile.pre.in
+@@ -1102,7 +1102,9 @@
+ -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
+@@ -1153,7 +1155,7 @@
+ 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 \
+@@ -1197,6 +1199,10 @@
+ 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
+Index: b/configure.ac
+===================================================================
+--- a/configure.ac
++++ b/configure.ac
+@@ -2672,6 +2672,11 @@
+ 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)
+
+Index: b/setup.py
+===================================================================
+--- a/setup.py
++++ b/setup.py
+@@ -2212,6 +2212,12 @@
+ # 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],
+@@ -2236,8 +2242,7 @@
+ # 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
--- /dev/null
+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 | 18 ++++++++++++++----
+ configure.ac | 6 ++++++
+ setup.py | 5 +++--
+ 3 files changed, 23 insertions(+), 6 deletions(-)
+
+Index: b/Makefile.pre.in
+===================================================================
+--- a/Makefile.pre.in
++++ b/Makefile.pre.in
+@@ -1106,7 +1106,9 @@
+ (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 \
+@@ -1146,7 +1148,6 @@
+ 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) \
+@@ -1188,9 +1189,6 @@
+ 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 \
+@@ -1203,6 +1201,14 @@
+ 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
+@@ -1298,10 +1304,12 @@
+ -d $(LIBDEST)/site-packages -f $(STDLIB_CACHE_FLAGS) \
+ -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):
+Index: b/setup.py
+===================================================================
+--- a/setup.py
++++ b/setup.py
+@@ -2213,10 +2213,11 @@
+ 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",
+Index: b/configure.ac
+===================================================================
+--- a/configure.ac
++++ b/configure.ac
+@@ -2684,6 +2684,12 @@
+ 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])
--- /dev/null
+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 | 9 +++++++--
+ configure.ac | 9 +++++++++
+ 2 files changed, 16 insertions(+), 2 deletions(-)
+
+Index: b/configure.ac
+===================================================================
+--- a/configure.ac
++++ b/configure.ac
+@@ -2672,6 +2672,15 @@
+ 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,
+Index: b/Makefile.pre.in
+===================================================================
+--- a/Makefile.pre.in
++++ b/Makefile.pre.in
+@@ -1146,7 +1146,6 @@
+ email email/mime \
+ ensurepip ensurepip/_bundled \
+ html json http dbm xmlrpc \
+- sqlite3 \
+ logging csv wsgiref urllib \
+ ctypes ctypes/macholib \
+ idlelib idlelib/Icons \
+@@ -1188,7 +1187,6 @@
+ 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 \
+@@ -1209,6 +1207,11 @@
+ lib2to3/tests/data/fixers/myfixes
+ endif
+
++ifeq (@SQLITE3@,yes)
++LIBSUBDIRS += sqlite3
++TESTSUBDIRS += sqlite3/test
++endif
++
+ ifeq (@TEST_MODULES@,yes)
+ LIBSUBDIRS += $(TESTSUBDIRS)
+ endif
--- /dev/null
+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 | 14 +++++++++++---
+ configure.ac | 9 +++++++++
+ 2 files changed, 20 insertions(+), 3 deletions(-)
+
+Index: b/Makefile.pre.in
+===================================================================
+--- a/Makefile.pre.in
++++ b/Makefile.pre.in
+@@ -1139,7 +1139,7 @@
+ EXTRAPLATDIR= @EXTRAPLATDIR@
+ MACHDEPS= $(PLATDIR) $(EXTRAPLATDIR)
+ XMLLIBSUBDIRS= xml xml/dom xml/etree xml/parsers xml/sax
+-LIBSUBDIRS= tkinter \
++LIBSUBDIRS= \
+ site-packages \
+ asyncio \
+ collections concurrent concurrent/futures encodings \
+@@ -1157,8 +1157,7 @@
+ 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 \
+@@ -1212,6 +1211,12 @@
+ 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
+Index: b/configure.ac
+===================================================================
+--- a/configure.ac
++++ b/configure.ac
+@@ -2681,6 +2681,15 @@
+ 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,
--- /dev/null
+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(-)
+
+Index: b/Makefile.pre.in
+===================================================================
+--- a/Makefile.pre.in
++++ b/Makefile.pre.in
+@@ -1155,7 +1155,7 @@
+ 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 \
+@@ -1217,6 +1217,10 @@
+ tkinter/test/test_ttk
+ endif
+
++ifeq (@CURSES@,yes)
++LIBSUBDIRS += curses
++endif
++
+ ifeq (@TEST_MODULES@,yes)
+ LIBSUBDIRS += $(TESTSUBDIRS)
+ endif
+Index: b/configure.ac
+===================================================================
+--- a/configure.ac
++++ b/configure.ac
+@@ -2690,6 +2690,15 @@
+ 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,
--- /dev/null
+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(-)
+
+Index: b/Makefile.pre.in
+===================================================================
+--- a/Makefile.pre.in
++++ b/Makefile.pre.in
+@@ -1149,7 +1149,7 @@
+ logging csv wsgiref urllib \
+ ctypes ctypes/macholib \
+ idlelib idlelib/Icons \
+- distutils distutils/command $(XMLLIBSUBDIRS) \
++ distutils distutils/command \
+ importlib \
+ turtledemo \
+ multiprocessing multiprocessing/dummy \
+@@ -1221,6 +1221,10 @@
+ LIBSUBDIRS += curses
+ endif
+
++ifeq (@EXPAT@,yes)
++LIBSUBDIRS += $(XMLLIBSUBDIRS)
++endif
++
+ ifeq (@TEST_MODULES@,yes)
+ LIBSUBDIRS += $(TESTSUBDIRS)
+ endif
+Index: b/configure.ac
+===================================================================
+--- a/configure.ac
++++ b/configure.ac
+@@ -2369,13 +2369,21 @@
+ 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)
+Index: b/setup.py
+===================================================================
+--- a/setup.py
++++ b/setup.py
+@@ -1426,7 +1426,7 @@
+ #
+ # 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']
--- /dev/null
+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(+)
+
+Index: b/configure.ac
+===================================================================
+--- a/configure.ac
++++ b/configure.ac
+@@ -2689,6 +2689,12 @@
+ 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]),
--- /dev/null
+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(+)
+
+Index: b/configure.ac
+===================================================================
+--- a/configure.ac
++++ b/configure.ac
+@@ -2695,6 +2695,12 @@
+ 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]),
--- /dev/null
+Add an option to disable unicodedata
+
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+
+---
+ configure.ac | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+Index: b/configure.ac
+===================================================================
+--- a/configure.ac
++++ b/configure.ac
+@@ -2701,6 +2701,12 @@
+ 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]),
--- /dev/null
+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 | 8 +++++++-
+ configure.ac | 6 ++++++
+ setup.py | 4 +++-
+ 3 files changed, 16 insertions(+), 2 deletions(-)
+
+Index: b/Makefile.pre.in
+===================================================================
+--- a/Makefile.pre.in
++++ b/Makefile.pre.in
+@@ -1100,7 +1100,9 @@
+ -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)
+@@ -1148,7 +1150,6 @@
+ html json http dbm xmlrpc \
+ logging csv wsgiref urllib \
+ ctypes ctypes/macholib \
+- idlelib idlelib/Icons \
+ distutils distutils/command \
+ importlib \
+ turtledemo \
+@@ -1225,6 +1226,10 @@
+ LIBSUBDIRS += $(XMLLIBSUBDIRS)
+ endif
+
++ifeq (@IDLE@,yes)
++LIBSUBDIRS += idlelib idlelib/Icons
++endif
++
+ ifeq (@TEST_MODULES@,yes)
+ LIBSUBDIRS += $(TESTSUBDIRS)
+ endif
+Index: b/configure.ac
+===================================================================
+--- a/configure.ac
++++ b/configure.ac
+@@ -2743,6 +2743,12 @@
+ 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])
+Index: b/setup.py
+===================================================================
+--- a/setup.py
++++ b/setup.py
+@@ -2213,11 +2213,13 @@
+ 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",
--- /dev/null
+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>
+---
+
+Index: b/configure.ac
+===================================================================
+--- a/configure.ac
++++ b/configure.ac
+@@ -2402,13 +2402,20 @@
+ 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)
+Index: b/setup.py
+===================================================================
+--- a/setup.py
++++ b/setup.py
+@@ -1980,7 +1980,7 @@
+ 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']
+++ /dev/null
-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>
-Index: b/setup.py
-===================================================================
---- a/setup.py
-+++ b/setup.py
-@@ -493,7 +493,8 @@
- 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
+++ /dev/null
-distutils: fix build_ext check to find whether we're building Python or not
-
-The build_ext logic uses
-sys.executable.startswith(os.path.join(sys.exec_prefix, "bin")) to
-determine whether we're building a third-party Python extension, or a
-built-in Python extension. However, this check is wrong in
-cross-compilation mode, and instead, the sysconfig.python_build
-variable should be used.
-
-Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
-Index: b/Lib/distutils/command/build_ext.py
-===================================================================
---- a/Lib/distutils/command/build_ext.py
-+++ b/Lib/distutils/command/build_ext.py
-@@ -237,7 +237,7 @@
- # Python's library directory must be appended to library_dirs
- # See Issues: #1600860, #4366
- if (sysconfig.get_config_var('Py_ENABLE_SHARED')):
-- if sys.executable.startswith(os.path.join(sys.exec_prefix, "bin")):
-+ if not sysconfig.python_build:
- # building third party extensions
- self.library_dirs.append(sysconfig.get_config_var('LIBDIR'))
- else:
+++ /dev/null
-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>
-
-Index: b/Makefile.pre.in
-===================================================================
---- a/Makefile.pre.in
-+++ b/Makefile.pre.in
-@@ -558,6 +558,9 @@
- 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`
-
- # Build the shared modules
- # Under GNU make, MAKEFLAGS are sorted and normalized; the 's' for
-@@ -1196,7 +1199,7 @@
- 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); \
-@@ -1206,6 +1209,11 @@
- 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; \
-@@ -1529,7 +1537,7 @@
- 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 Modules/_testembed Modules/_freeze_importlib
-
-Index: b/configure.ac
-===================================================================
---- a/configure.ac
-+++ b/configure.ac
-@@ -70,7 +70,7 @@
- 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])
+++ /dev/null
-python3: Fix pyc-only related runtime exceptions
-
-Python3 changes the pyc lookup strategy, ignoring the
-__pycache__ directory if the .py file is missing. Change
-install location to enable use of .pyc without their parent .py
-
-See http://www.python.org/dev/peps/pep-3147
-
-Signed-off-by: Daniel Nelson <daniel@sigpwr.com>
-
-Index: b/configure.ac
-===================================================================
---- a/configure.ac
-+++ b/configure.ac
-@@ -352,6 +352,23 @@
- AC_SUBST(FRAMEWORKUNIXTOOLSPREFIX)
- AC_SUBST(FRAMEWORKINSTALLAPPSPREFIX)
-
-+STDLIB_CACHE_FLAGS=
-+AC_MSG_CHECKING(for --enable-old-stdlib-cache)
-+AC_ARG_ENABLE(old-stdlib-cache,
-+ AS_HELP_STRING([--enable-old-stdlib-cache], [enable pre-pep3147 stdlib cache]),
-+[
-+ if test "$enableval" = "yes"
-+ then
-+ STDLIB_CACHE_FLAGS="-b"
-+ else
-+ STDLIB_CACHE_FLAGS=""
-+ fi
-+],
-+[
-+ STDLIB_CACHE_FLAGS=""
-+])
-+AC_SUBST(STDLIB_CACHE_FLAGS)
-+
- ##AC_ARG_WITH(dyld,
- ## AS_HELP_STRING([--with-dyld],
- ## [Use (OpenStep|Rhapsody) dynamic linker]))
-Index: b/Makefile.pre.in
-===================================================================
---- a/Makefile.pre.in
-+++ b/Makefile.pre.in
-@@ -162,6 +162,9 @@
- # Options to enable prebinding (for fast startup prior to Mac OS X 10.3)
- OTHER_LIBTOOL_OPT=@OTHER_LIBTOOL_OPT@
-
-+# Option to enable old-style precompiled stdlib
-+STDLIB_CACHE_FLAGS=@STDLIB_CACHE_FLAGS@
-+
- # Environment to run shared python without installed libraries
- RUNSHARED= @RUNSHARED@
-
-@@ -1246,21 +1249,21 @@
- fi
- -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
- $(PYTHON_FOR_BUILD) -Wi $(DESTDIR)$(LIBDEST)/compileall.py \
-- -d $(LIBDEST) -f \
-+ -d $(LIBDEST) -f $(STDLIB_CACHE_FLAGS) \
- -x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \
- $(DESTDIR)$(LIBDEST)
- -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
- $(PYTHON_FOR_BUILD) -Wi -O $(DESTDIR)$(LIBDEST)/compileall.py \
-- -d $(LIBDEST) -f \
-+ -d $(LIBDEST) -f $(STDLIB_CACHE_FLAGS) \
- -x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \
- $(DESTDIR)$(LIBDEST)
- -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
- $(PYTHON_FOR_BUILD) -Wi $(DESTDIR)$(LIBDEST)/compileall.py \
-- -d $(LIBDEST)/site-packages -f \
-+ -d $(LIBDEST)/site-packages -f $(STDLIB_CACHE_FLAGS) \
- -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
- -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
- $(PYTHON_FOR_BUILD) -Wi -O $(DESTDIR)$(LIBDEST)/compileall.py \
-- -d $(LIBDEST)/site-packages -f \
-+ -d $(LIBDEST)/site-packages -f $(STDLIB_CACHE_FLAGS) \
- -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
- -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
- $(PYTHON_FOR_BUILD) -m lib2to3.pgen2.driver $(DESTDIR)$(LIBDEST)/lib2to3/Grammar.txt
+++ /dev/null
-Index: b/Makefile.pre.in
-===================================================================
---- a/Makefile.pre.in
-+++ b/Makefile.pre.in
-@@ -1247,24 +1247,32 @@
- $(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 $(STDLIB_CACHE_FLAGS) \
- -x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \
- $(DESTDIR)$(LIBDEST)
-+endif
-+ifeq (@PYO_BUILD@,yes)
- -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
- $(PYTHON_FOR_BUILD) -Wi -O $(DESTDIR)$(LIBDEST)/compileall.py \
- -d $(LIBDEST) -f $(STDLIB_CACHE_FLAGS) \
- -x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \
- $(DESTDIR)$(LIBDEST)
-+endif
-+ifeq (@PYC_BUILD@,yes)
- -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
- $(PYTHON_FOR_BUILD) -Wi $(DESTDIR)$(LIBDEST)/compileall.py \
- -d $(LIBDEST)/site-packages -f $(STDLIB_CACHE_FLAGS) \
- -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
-+endif
-+ifeq (@PYO_BUILD@,yes)
- -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
- $(PYTHON_FOR_BUILD) -Wi -O $(DESTDIR)$(LIBDEST)/compileall.py \
- -d $(LIBDEST)/site-packages -f $(STDLIB_CACHE_FLAGS) \
- -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) \
-Index: b/configure.ac
-===================================================================
---- a/configure.ac
-+++ b/configure.ac
-@@ -939,6 +939,18 @@
-
- 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 ])
-+
-+AC_SUBST(PYO_BUILD)
-+
-+AC_ARG_ENABLE(pyo-build,
-+ AS_HELP_STRING([--disable-pyo-build], [disable build of pyo files]),
-+ [ PYO_BUILD="${enableval}" ], [ PYO_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
+++ /dev/null
-Disable buggy_getaddrinfo configure test when cross-compiling with IPv6 support
-
-Signed-off-by: Vanya Sergeev <vsergeev at gmail.com>
-
----
- configure.ac | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-Index: b/configure.ac
-===================================================================
---- a/configure.ac
-+++ b/configure.ac
-@@ -3429,7 +3429,7 @@
-
- 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
+++ /dev/null
-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 | 4 ++++
- configure.ac | 2 ++
- setup.py | 5 ++++-
- 3 files changed, 10 insertions(+), 1 deletion(-)
-
-Index: b/Makefile.pre.in
-===================================================================
---- a/Makefile.pre.in
-+++ b/Makefile.pre.in
-@@ -180,6 +180,8 @@
- # configure script arguments
- CONFIG_ARGS= @CONFIG_ARGS@
-
-+# disabled extensions
-+DISABLED_EXTENSIONS= @DISABLED_EXTENSIONS@
-
- # Subdirectories with code
- SRCDIRS= @SRCDIRS@
-@@ -576,6 +578,7 @@
- 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
-@@ -1386,7 +1389,8 @@
- # 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) \
-Index: b/configure.ac
-===================================================================
---- a/configure.ac
-+++ b/configure.ac
-@@ -2366,6 +2366,8 @@
-
- AC_PATH_TOOL([PKG_CONFIG], [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,
-Index: b/setup.py
-===================================================================
---- a/setup.py
-+++ b/setup.py
-@@ -39,7 +39,10 @@
- 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
+++ /dev/null
-Index: b/Lib/distutils/sysconfig.py
-===================================================================
---- a/Lib/distutils/sysconfig.py
-+++ b/Lib/distutils/sysconfig.py
-@@ -423,40 +423,11 @@
- _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"""
+++ /dev/null
-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>
-
-Index: b/Lib/distutils/sysconfig.py
-===================================================================
---- a/Lib/distutils/sysconfig.py
-+++ b/Lib/distutils/sysconfig.py
-@@ -16,10 +16,17 @@
- 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/PCBuild9. If we're dealing with an x64 Windows build,
-Index: b/Lib/distutils/command/build_ext.py
-===================================================================
---- a/Lib/distutils/command/build_ext.py
-+++ b/Lib/distutils/command/build_ext.py
-@@ -239,7 +239,10 @@
- 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('.')
+++ /dev/null
-Don't look in /usr/lib/termcap for libraries
-
-Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
-
-Index: b/setup.py
-===================================================================
---- a/setup.py
-+++ b/setup.py
-@@ -733,12 +733,9 @@
- 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:
+++ /dev/null
-python3: do not rely only on LIBRARY_PATH for old compilers
-
-The cross-compilation improvements integrated in Python rely on the
-compiler exposing a line starting with LIBRARY_PATH when called with
--E -v. This is used by Python setup.py to find the installation
-locations of libraries.
-
-However, this LIBRARY_PATH line is not shown by very old compilers,
-such as the gcc 4.2.x compiler used on the AVR32 architecture. This
-causes libraries installed in the sysroot, such as libffi, to not be
-detected by the setup.py script.
-
-To fix this problem, this patch adds addtional logic to setup.py,
-which consists in deriving the library paths from the sysroot
-location, if no LIBRARY_PATH field was found.
-
-Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
-
-Index: b/setup.py
-===================================================================
---- a/setup.py
-+++ b/setup.py
-@@ -427,6 +427,7 @@
- in_incdirs = False
- inc_dirs = []
- lib_dirs = []
-+ compiler_has_library_path = False
- try:
- if ret >> 8 == 0:
- with open(tmpfile) as fp:
-@@ -438,6 +439,7 @@
- elif line.startswith("End of search list"):
- in_incdirs = False
- elif is_gcc and line.startswith("LIBRARY_PATH"):
-+ compiler_has_library_path = True
- for d in line.strip().split("=")[1].split(":"):
- d = os.path.normpath(d)
- if '/gcc/' not in d:
-@@ -449,6 +451,15 @@
- finally:
- os.unlink(tmpfile)
-
-+ if not compiler_has_library_path:
-+ ret = os.system("%s -print-file-name=libc.a | sed -r -e 's:(usr/)?lib(32|64)?/([^/]*/)?libc\.a::' >%s" % (gcc, tmpfile))
-+ with open(tmpfile) as fp:
-+ line = fp.readline().strip()
-+ add_dir_to_list(self.compiler.library_dirs,
-+ os.path.join(line, "usr", "lib"))
-+ add_dir_to_list(self.compiler.library_dirs,
-+ os.path.join(line, "lib"))
-+
- def detect_modules(self):
- # Ensure that /usr/local is always used, but the local build
- # directories (i.e. '.' and 'Include') must be first. See issue
+++ /dev/null
-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>
-
-Index: b/setup.py
-===================================================================
---- a/setup.py
-+++ b/setup.py
-@@ -467,10 +467,10 @@
- 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.
+++ /dev/null
-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>
-
-Index: b/setup.py
-===================================================================
---- a/setup.py
-+++ b/setup.py
-@@ -284,6 +284,7 @@
- print("Failed to build these modules:")
- print_three_column(failed)
- print()
-+ sys.exit(1)
-
- def build_extension(self, ext):
-
+++ /dev/null
-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>
----
-diff -Nuar Python-3.4.1-orig/Modules/termios.c Python-3.4.1/Modules/termios.c
---- Python-3.4.1-orig/Modules/termios.c 2014-05-19 08:19:39.000000000 +0300
-+++ Python-3.4.1/Modules/termios.c 2014-08-06 21:16:11.892362933 +0300
-@@ -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
+++ /dev/null
-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>
-
-Index: b/Lib/distutils/command/build_scripts.py
-===================================================================
---- a/Lib/distutils/command/build_scripts.py
-+++ b/Lib/distutils/command/build_scripts.py
-@@ -91,7 +91,7 @@
- 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)
+++ /dev/null
-Add distutils 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.
-
-For the Python standard library, our Python 3 package already contains
-a patch named python3-004-old-stdlib-cache.patch, which allows to
-disable the PEP 3147 installation.
-
-But that lives the distutils/setuptools package an unsolved
-problem. This patch therefore adds a new patch to Python, which makes
-distutils package use the traditional installation path when byte
-compiling, rather than the PEP 3147 installation path. Since
-setuptools relies on distutils internally, it also fixes setuptools
-based packages.
-
-Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
-
-Index: b/Lib/distutils/util.py
-===================================================================
---- a/Lib/distutils/util.py
-+++ b/Lib/distutils/util.py
-@@ -437,7 +437,9 @@
- # Terminology from the py_compile module:
- # cfile - byte-compiled file
- # dfile - purported source filename (same as 'file' by default)
-- if optimize >= 0:
-+ if "_python_sysroot" in os.environ:
-+ cfile = file + (__debug__ and "c" or "o")
-+ elif optimize >= 0:
- cfile = importlib.util.cache_from_source(
- file, debug_override=not optimize)
- else:
+++ /dev/null
-From 50f34d2cac63b6bf0935294a7d63d9451714f4c4 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 64c81e5..f75eec5 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="@SO@"
- PYTHONFRAMEWORK="@PYTHONFRAMEWORK@"
- INCDIR="-I$includedir/python${VERSION}${ABIFLAGS}"
---
-2.1.3
-
+++ /dev/null
-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 | 50 ++++++++++++++++++++++++++++++++------------------
- configure.ac | 6 ++++++
- 2 files changed, 38 insertions(+), 18 deletions(-)
-
-Index: b/Makefile.pre.in
-===================================================================
---- a/Makefile.pre.in
-+++ b/Makefile.pre.in
-@@ -1135,8 +1135,30 @@
- EXTRAPLATDIR= @EXTRAPLATDIR@
- MACHDEPS= $(PLATDIR) $(EXTRAPLATDIR)
- 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 \
-@@ -1163,28 +1185,22 @@
- 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 \
-Index: b/configure.ac
-===================================================================
---- a/configure.ac
-+++ b/configure.ac
-@@ -2673,6 +2673,12 @@
- 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])
+++ /dev/null
-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(-)
-
-Index: b/Makefile.pre.in
-===================================================================
---- a/Makefile.pre.in
-+++ b/Makefile.pre.in
-@@ -1102,7 +1102,9 @@
- -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
-@@ -1153,7 +1155,7 @@
- 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 \
-@@ -1197,6 +1199,10 @@
- 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
-Index: b/configure.ac
-===================================================================
---- a/configure.ac
-+++ b/configure.ac
-@@ -2672,6 +2672,11 @@
- 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)
-
-Index: b/setup.py
-===================================================================
---- a/setup.py
-+++ b/setup.py
-@@ -2212,6 +2212,12 @@
- # 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],
-@@ -2236,8 +2242,7 @@
- # 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
+++ /dev/null
-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 | 18 ++++++++++++++----
- configure.ac | 6 ++++++
- setup.py | 5 +++--
- 3 files changed, 23 insertions(+), 6 deletions(-)
-
-Index: b/Makefile.pre.in
-===================================================================
---- a/Makefile.pre.in
-+++ b/Makefile.pre.in
-@@ -1106,7 +1106,9 @@
- (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 \
-@@ -1146,7 +1148,6 @@
- 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) \
-@@ -1188,9 +1189,6 @@
- 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 \
-@@ -1203,6 +1201,14 @@
- 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
-@@ -1298,10 +1304,12 @@
- -d $(LIBDEST)/site-packages -f $(STDLIB_CACHE_FLAGS) \
- -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):
-Index: b/setup.py
-===================================================================
---- a/setup.py
-+++ b/setup.py
-@@ -2213,10 +2213,11 @@
- 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",
-Index: b/configure.ac
-===================================================================
---- a/configure.ac
-+++ b/configure.ac
-@@ -2684,6 +2684,12 @@
- 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])
+++ /dev/null
-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 | 9 +++++++--
- configure.ac | 9 +++++++++
- 2 files changed, 16 insertions(+), 2 deletions(-)
-
-Index: b/configure.ac
-===================================================================
---- a/configure.ac
-+++ b/configure.ac
-@@ -2672,6 +2672,15 @@
- 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,
-Index: b/Makefile.pre.in
-===================================================================
---- a/Makefile.pre.in
-+++ b/Makefile.pre.in
-@@ -1146,7 +1146,6 @@
- email email/mime \
- ensurepip ensurepip/_bundled \
- html json http dbm xmlrpc \
-- sqlite3 \
- logging csv wsgiref urllib \
- ctypes ctypes/macholib \
- idlelib idlelib/Icons \
-@@ -1188,7 +1187,6 @@
- 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 \
-@@ -1209,6 +1207,11 @@
- lib2to3/tests/data/fixers/myfixes
- endif
-
-+ifeq (@SQLITE3@,yes)
-+LIBSUBDIRS += sqlite3
-+TESTSUBDIRS += sqlite3/test
-+endif
-+
- ifeq (@TEST_MODULES@,yes)
- LIBSUBDIRS += $(TESTSUBDIRS)
- endif
+++ /dev/null
-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 | 14 +++++++++++---
- configure.ac | 9 +++++++++
- 2 files changed, 20 insertions(+), 3 deletions(-)
-
-Index: b/Makefile.pre.in
-===================================================================
---- a/Makefile.pre.in
-+++ b/Makefile.pre.in
-@@ -1139,7 +1139,7 @@
- EXTRAPLATDIR= @EXTRAPLATDIR@
- MACHDEPS= $(PLATDIR) $(EXTRAPLATDIR)
- XMLLIBSUBDIRS= xml xml/dom xml/etree xml/parsers xml/sax
--LIBSUBDIRS= tkinter \
-+LIBSUBDIRS= \
- site-packages \
- asyncio \
- collections concurrent concurrent/futures encodings \
-@@ -1157,8 +1157,7 @@
- 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 \
-@@ -1212,6 +1211,12 @@
- 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
-Index: b/configure.ac
-===================================================================
---- a/configure.ac
-+++ b/configure.ac
-@@ -2681,6 +2681,15 @@
- 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,
+++ /dev/null
-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(-)
-
-Index: b/Makefile.pre.in
-===================================================================
---- a/Makefile.pre.in
-+++ b/Makefile.pre.in
-@@ -1155,7 +1155,7 @@
- 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 \
-@@ -1217,6 +1217,10 @@
- tkinter/test/test_ttk
- endif
-
-+ifeq (@CURSES@,yes)
-+LIBSUBDIRS += curses
-+endif
-+
- ifeq (@TEST_MODULES@,yes)
- LIBSUBDIRS += $(TESTSUBDIRS)
- endif
-Index: b/configure.ac
-===================================================================
---- a/configure.ac
-+++ b/configure.ac
-@@ -2690,6 +2690,15 @@
- 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,
+++ /dev/null
-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(-)
-
-Index: b/Makefile.pre.in
-===================================================================
---- a/Makefile.pre.in
-+++ b/Makefile.pre.in
-@@ -1149,7 +1149,7 @@
- logging csv wsgiref urllib \
- ctypes ctypes/macholib \
- idlelib idlelib/Icons \
-- distutils distutils/command $(XMLLIBSUBDIRS) \
-+ distutils distutils/command \
- importlib \
- turtledemo \
- multiprocessing multiprocessing/dummy \
-@@ -1221,6 +1221,10 @@
- LIBSUBDIRS += curses
- endif
-
-+ifeq (@EXPAT@,yes)
-+LIBSUBDIRS += $(XMLLIBSUBDIRS)
-+endif
-+
- ifeq (@TEST_MODULES@,yes)
- LIBSUBDIRS += $(TESTSUBDIRS)
- endif
-Index: b/configure.ac
-===================================================================
---- a/configure.ac
-+++ b/configure.ac
-@@ -2369,13 +2369,21 @@
- 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)
-Index: b/setup.py
-===================================================================
---- a/setup.py
-+++ b/setup.py
-@@ -1426,7 +1426,7 @@
- #
- # 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']
+++ /dev/null
-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(+)
-
-Index: b/configure.ac
-===================================================================
---- a/configure.ac
-+++ b/configure.ac
-@@ -2689,6 +2689,12 @@
- 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]),
+++ /dev/null
-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(+)
-
-Index: b/configure.ac
-===================================================================
---- a/configure.ac
-+++ b/configure.ac
-@@ -2695,6 +2695,12 @@
- 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]),
+++ /dev/null
-Add an option to disable unicodedata
-
-Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
-
----
- configure.ac | 6 ++++++
- 1 file changed, 6 insertions(+)
-
-Index: b/configure.ac
-===================================================================
---- a/configure.ac
-+++ b/configure.ac
-@@ -2701,6 +2701,12 @@
- 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]),
+++ /dev/null
-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 | 8 +++++++-
- configure.ac | 6 ++++++
- setup.py | 4 +++-
- 3 files changed, 16 insertions(+), 2 deletions(-)
-
-Index: b/Makefile.pre.in
-===================================================================
---- a/Makefile.pre.in
-+++ b/Makefile.pre.in
-@@ -1100,7 +1100,9 @@
- -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)
-@@ -1148,7 +1150,6 @@
- html json http dbm xmlrpc \
- logging csv wsgiref urllib \
- ctypes ctypes/macholib \
-- idlelib idlelib/Icons \
- distutils distutils/command \
- importlib \
- turtledemo \
-@@ -1225,6 +1226,10 @@
- LIBSUBDIRS += $(XMLLIBSUBDIRS)
- endif
-
-+ifeq (@IDLE@,yes)
-+LIBSUBDIRS += idlelib idlelib/Icons
-+endif
-+
- ifeq (@TEST_MODULES@,yes)
- LIBSUBDIRS += $(TESTSUBDIRS)
- endif
-Index: b/configure.ac
-===================================================================
---- a/configure.ac
-+++ b/configure.ac
-@@ -2743,6 +2743,12 @@
- 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])
-Index: b/setup.py
-===================================================================
---- a/setup.py
-+++ b/setup.py
-@@ -2213,11 +2213,13 @@
- 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",
+++ /dev/null
-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>
----
-
-Index: b/configure.ac
-===================================================================
---- a/configure.ac
-+++ b/configure.ac
-@@ -2402,13 +2402,20 @@
- 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)
-Index: b/setup.py
-===================================================================
---- a/setup.py
-+++ b/setup.py
-@@ -1980,7 +1980,7 @@
- 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']