From: Maxime Ripard Date: Wed, 29 May 2013 08:36:57 +0000 (+0200) Subject: python3: Port python2 patches to reduce the interpreter size X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f1c092da8ba4d03125387a337ab45c9b5a1315dc;p=buildroot.git python3: Port python2 patches to reduce the interpreter size Some of the python2 patches were left behind when doing the python3 package. This was because the python build system can now autodetect what packages can be built in the system. However, some of these patches are actually useful to reduce drastically the size of the interpreter. This patch ports the relevant patches to the python3 package, and adds a new patch to remove the idle3 IDE as well from the interpreter. Fixes #5696 Signed-off-by: Maxime Ripard Signed-off-by: Peter Korsgaard --- diff --git a/package/python3/Config.in b/package/python3/Config.in index 5959d31c6c..4a70b5e5c3 100644 --- a/package/python3/Config.in +++ b/package/python3/Config.in @@ -41,6 +41,11 @@ config BR2_PACKAGE_PYTHON3_BZIP2 help bzip2 module for Python3 +config BR2_PACKAGE_PYTHON3_CODECSCJK + bool "codecscjk module" + help + Chinese/Japanese/Korean codecs module for Python (large). + config BR2_PACKAGE_PYTHON3_CURSES select BR2_PACKAGE_NCURSES bool "curses module" @@ -66,6 +71,12 @@ config BR2_PACKAGE_PYTHON3_SSL help _ssl module for Python3 (required for https in urllib etc). +config BR2_PACKAGE_PYTHON3_UNICODEDATA + bool "unicodedata module" + default y + help + Unicode character database (used by stringprep module) (large). + config BR2_PACKAGE_PYTHON3_SQLITE bool "sqlite module" select BR2_PACKAGE_SQLITE diff --git a/package/python3/python3-000-generate-sysconfigdata-buildir.patch b/package/python3/python3-000-generate-sysconfigdata-buildir.patch new file mode 100644 index 0000000000..a29aa0ffc8 --- /dev/null +++ b/package/python3/python3-000-generate-sysconfigdata-buildir.patch @@ -0,0 +1,158 @@ +changeset: 79745:f85c3f4d9b98 +parent: 79743:36b2ca7dc893 +parent: 79744:24d52d3060e8 +user: Trent Nelson +date: Tue Oct 16 08:17:11 2012 -0400 +summary: Merge issue #15298: ensure _sysconfigdata is generated in build directory, + +Taken from upstream. + +--- + Lib/sysconfig.py | 11 ++++++++++- + Makefile.pre.in | 24 +++++++++++++----------- + setup.py | 14 -------------- + 3 files changed, 23 insertions(+), 26 deletions(-) + +Index: Python-3.3.0/Lib/sysconfig.py +=================================================================== +--- Python-3.3.0.orig/Lib/sysconfig.py ++++ Python-3.3.0/Lib/sysconfig.py +@@ -390,13 +390,22 @@ + if _PYTHON_BUILD: + vars['LDSHARED'] = vars['BLDSHARED'] + +- destfile = os.path.join(os.path.dirname(__file__), '_sysconfigdata.py') ++ pybuilddir = 'build/lib.%s-%s' % (get_platform(), sys.version[:3]) ++ if hasattr(sys, "gettotalrefcount"): ++ pybuilddir += '-pydebug' ++ os.makedirs(pybuilddir, exist_ok=True) ++ destfile = os.path.join(pybuilddir, '_sysconfigdata.py') ++ + with open(destfile, 'w', encoding='utf8') as f: + f.write('# system configuration generated and used by' + ' the sysconfig module\n') + f.write('build_time_vars = ') + pprint.pprint(vars, stream=f) + ++ # Create file used for sys.path fixup -- see Modules/getpath.c ++ with open('pybuilddir.txt', 'w', encoding='ascii') as f: ++ f.write(pybuilddir) ++ + def _init_posix(vars): + """Initialize the module as appropriate for POSIX systems.""" + # _sysconfigdata is generated at build time, see _generate_posix_vars() +Index: Python-3.3.0/Makefile.pre.in +=================================================================== +--- Python-3.3.0.orig/Makefile.pre.in ++++ Python-3.3.0/Makefile.pre.in +@@ -410,8 +410,6 @@ + Objects/unicodectype.o \ + Objects/weakrefobject.o + +-SYSCONFIGDATA=$(srcdir)/Lib/_sysconfigdata.py +- + ########################################################################## + # objects that get linked into the Python library + LIBRARY_OBJS_OMIT_FROZEN= \ +@@ -432,7 +430,7 @@ + + # Default target + all: build_all +-build_all: $(BUILDPYTHON) $(SYSCONFIGDATA) oldsharedmods sharedmods gdbhooks Modules/_testembed ++build_all: $(BUILDPYTHON) oldsharedmods sharedmods gdbhooks Modules/_testembed + + # Compile a binary with gcc profile guided optimization. + profile-opt: +@@ -466,15 +464,17 @@ + $(BUILDPYTHON): Modules/python.o $(LIBRARY) $(LDLIBRARY) $(PY3LIBRARY) + $(LINKCC) $(PY_LDFLAGS) $(LINKFORSHARED) -o $@ Modules/python.o $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST) + +-platform: $(BUILDPYTHON) $(SYSCONFIGDATA) ++platform: $(BUILDPYTHON) + $(RUNSHARED) $(PYTHON_FOR_BUILD) -c 'import sys ; from sysconfig import get_platform ; print(get_platform()+"-"+sys.version[0:3])' >platform + +-# Generate the sysconfig build-time data +-$(SYSCONFIGDATA): $(BUILDPYTHON) ++# Create build directory and generate the sysconfig build-time data there. ++# pybuilddir.txt contains the name of the build dir and is used for ++# sys.path fixup -- see Modules/getpath.c. ++pybuilddir.txt: $(BUILDPYTHON) + $(RUNSHARED) $(PYTHON_FOR_BUILD) -S -m sysconfig --generate-posix-vars + + # Build the shared modules +-sharedmods: $(BUILDPYTHON) $(SYSCONFIGDATA) ++sharedmods: $(BUILDPYTHON) pybuilddir.txt + case $$MAKEFLAGS in *s*) quiet=-q; esac; \ + $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \ + $(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build +@@ -1036,7 +1036,7 @@ + else true; \ + fi; \ + done +- @for i in $(srcdir)/Lib/*.py ; \ ++ @for i in $(srcdir)/Lib/*.py `cat pybuilddir.txt`/_sysconfigdata.py; \ + do \ + if test -x $$i; then \ + $(INSTALL_SCRIPT) $$i $(DESTDIR)$(LIBDEST); \ +@@ -1196,6 +1196,8 @@ + --install-scripts=$(BINDIR) \ + --install-platlib=$(DESTSHARED) \ + --root=$(DESTDIR)/ ++ -rm $(DESTDIR)$(DESTSHARED)/_sysconfigdata.py ++ -rm -r $(DESTDIR)$(DESTSHARED)/__pycache__ + + # Here are a couple of targets for MacOSX again, to install a full + # framework-based Python. frameworkinstall installs everything, the +@@ -1341,9 +1343,10 @@ + find . -name '*.s[ol]' -exec rm -f {} ';' + find . -name '*.so.[0-9]*.[0-9]*' -exec rm -f {} ';' + find build -name 'fficonfig.h' -exec rm -f {} ';' || true +- find build -name 'fficonfig.py' -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 Lib/lib2to3/*Grammar*.pickle +- -rm -f $(SYSCONFIGDATA) + -rm -f Modules/_testembed Modules/_freeze_importlib + + profile-removal: +@@ -1367,7 +1370,6 @@ + Modules/Setup Modules/Setup.local Modules/Setup.config \ + Modules/ld_so_aix Modules/python.exp Misc/python.pc + -rm -f python*-gdb.py +- -rm -f pybuilddir.txt + find $(srcdir) '(' -name '*.fdc' -o -name '*~' \ + -o -name '[@,#]*' -o -name '*.old' \ + -o -name '*.orig' -o -name '*.rej' \ +Index: Python-3.3.0/setup.py +=================================================================== +--- Python-3.3.0.orig/setup.py ++++ Python-3.3.0/setup.py +@@ -33,10 +33,6 @@ + # This global variable is used to hold the list of modules to be disabled. + disabled_module_list = [] + +-# File which contains the directory for shared mods (for sys.path fixup +-# when running from the build dir, see Modules/getpath.c) +-_BUILDDIR_COOKIE = "pybuilddir.txt" +- + def add_dir_to_list(dirlist, dir): + """Add the directory 'dir' to the list 'dirlist' (after any relative + directories) if: +@@ -252,16 +248,6 @@ + args['compiler_so'] = compiler + ' ' + ccshared + ' ' + cflags + self.compiler.set_executables(**args) + +- # Not only do we write the builddir cookie, but we manually install +- # the shared modules directory if it isn't already in sys.path. +- # Otherwise trying to import the extensions after building them +- # will fail. +- with open(_BUILDDIR_COOKIE, "wb") as f: +- f.write(self.build_lib.encode('utf-8', 'surrogateescape')) +- abs_build_lib = os.path.join(os.getcwd(), self.build_lib) +- if abs_build_lib not in sys.path: +- sys.path.append(abs_build_lib) +- + build_ext.build_extensions(self) + + longest = max([len(e.name) for e in self.extensions]) diff --git a/package/python3/python3-001-support-for-build.patch b/package/python3/python3-001-support-for-build.patch new file mode 100644 index 0000000000..8c57cfb9cc --- /dev/null +++ b/package/python3/python3-001-support-for-build.patch @@ -0,0 +1,68 @@ +Add support in Python build system to specify host pgen + +Python needs a "pgen" program to build itself. Unfortunately, the +Python build system assumes that it can use the pgen program it has +just built to build itself. Obviously, this cannot work in +cross-compilation mode since the pgen program have been built for the +target. + +Therefore, this patch adds support in the Python build system for the +new PGEN_FOR_BUILD variable, so that we can point Python ./configure +script to the pgen program that have been previously built for the +host. + +Patch ported to python2.7 by Maxime Ripard , and +later significantly reworked by Thomas Petazzoni +, with some inspiration taken +from the Python patches of the PTXdist project, and then ported to +python3.3 by Maxime Ripard + +Signed-off-by: Maxime Ripard +--- + Makefile.pre.in | 5 +++-- + configure.ac | 5 +++++ + 2 files changed, 8 insertions(+), 2 deletions(-) + +Index: Python-3.3.0/Makefile.pre.in +=================================================================== +--- Python-3.3.0.orig/Makefile.pre.in ++++ Python-3.3.0/Makefile.pre.in +@@ -239,6 +239,7 @@ + ########################################################################## + # Parser + PGEN= Parser/pgen$(EXE) ++PGEN_FOR_BUILD=@PGEN_FOR_BUILD@ + + PSRCS= \ + Parser/acceler.c \ +@@ -639,8 +640,8 @@ + + $(GRAMMAR_H): $(GRAMMAR_INPUT) $(PGENSRCS) + @$(MKDIR_P) Include +- $(MAKE) $(PGEN) +- $(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C) ++ $(MAKE) $(PGEN_FOR_BUILD) ++ $(PGEN_FOR_BUILD) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C) + $(GRAMMAR_C): $(GRAMMAR_H) $(GRAMMAR_INPUT) $(PGENSRCS) + $(MAKE) $(GRAMMAR_H) + touch $(GRAMMAR_C) +Index: Python-3.3.0/configure.ac +=================================================================== +--- Python-3.3.0.orig/configure.ac ++++ Python-3.3.0/configure.ac +@@ -51,10 +51,15 @@ + AC_MSG_RESULT($interp) + PYTHON_FOR_BUILD="_PYTHON_PROJECT_BASE=$srcdir"' _PYTHON_HOST_PLATFORM=$(_PYTHON_HOST_PLATFORM) PYTHONPATH=$(srcdir)/Lib:$(srcdir)/Lib/plat-$(MACHDEP) '$interp + fi ++ AC_MSG_CHECKING(pgen for build) ++ PGEN_FOR_BUILD="${PGEN_FOR_BUILD}" ++ AC_MSG_RESULT($PGEN_FOR_BUILD) + else + PYTHON_FOR_BUILD='./$(BUILDPYTHON) -E' ++ PGEN_FOR_BUILD='./$(PGEN)' + fi + AC_SUBST(PYTHON_FOR_BUILD) ++AC_SUBST(PGEN_FOR_BUILD) + + dnl Ensure that if prefix is specified, it does not end in a slash. If + dnl it does, we get path names containing '//' which is both ugly and diff --git a/package/python3/python3-002-no-host-headers-libs.patch b/package/python3/python3-002-no-host-headers-libs.patch new file mode 100644 index 0000000000..9783f28ade --- /dev/null +++ b/package/python3/python3-002-no-host-headers-libs.patch @@ -0,0 +1,72 @@ +Do not look at host headers/libraries in cross-compile mode + +When we are cross-compiling, setup.py should never look in /usr or +/usr/local to find headers or libraries. A later patch adds a +mechanism to tell setup.py to look in a specific directory for headers +and libraries. + +Patch first written by Thomas Petazzoni + for python2.7, and then ported +to python3.3 by Maxime Ripard + +Signed-off-by: Maxime Ripard +--- + setup.py | 23 +++++------------------ + 1 file changed, 5 insertions(+), 18 deletions(-) + +Index: Python-3.3.0/setup.py +=================================================================== +--- Python-3.3.0.orig/setup.py ++++ Python-3.3.0/setup.py +@@ -447,10 +447,8 @@ + 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') +- # only change this for cross builds for 3.3, issues on Mageia +- if cross_compiling: + self.add_gcc_paths() +- self.add_multiarch_paths() ++ self.add_multiarch_paths() + + # Add paths specified in the environment variables LDFLAGS and + # CPPFLAGS for header and library files. +@@ -458,10 +456,7 @@ + # directly since an inconsistently reproducible issue comes up where + # the environment variable is not set even though the value were passed + # into configure and stored in the Makefile (issue found on OS X 10.3). +- for env_var, arg_name, dir_list in ( +- ('LDFLAGS', '-R', self.compiler.runtime_library_dirs), +- ('LDFLAGS', '-L', self.compiler.library_dirs), +- ('CPPFLAGS', '-I', self.compiler.include_dirs)): ++ for env_var, arg_name, dir_list in (): + env_val = sysconfig.get_config_var(env_var) + if env_val: + # To prevent optparse from raising an exception about any +@@ -486,17 +481,6 @@ + for directory in reversed(options.dirs): + add_dir_to_list(dir_list, directory) + +- if os.path.normpath(sys.base_prefix) != '/usr' \ +- and not sysconfig.get_config_var('PYTHONFRAMEWORK'): +- # 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 +- # the one that is currently installed (issue #7473) +- add_dir_to_list(self.compiler.library_dirs, +- sysconfig.get_config_var("LIBDIR")) +- add_dir_to_list(self.compiler.include_dirs, +- sysconfig.get_config_var("INCLUDEDIR")) +- + # lib_dirs and inc_dirs are used to search for files; + # if a file is found in one of those directories, it can + # be assumed that no additional -I,-L directives are needed. +@@ -506,6 +490,9 @@ + '/lib', '/usr/lib', + ] + inc_dirs = self.compiler.include_dirs + ['/usr/include'] ++ else: ++ lib_dirs = self.compiler.library_dirs ++ inc_dirs = self.compiler.include_dirs + exts = [] + missing = [] + diff --git a/package/python3/python3-003-staging-header-libs.patch b/package/python3/python3-003-staging-header-libs.patch new file mode 100644 index 0000000000..b0efe29614 --- /dev/null +++ b/package/python3/python3-003-staging-header-libs.patch @@ -0,0 +1,41 @@ +Tell setup.py the location of headers/libraries + +Allow the libraries detection routine to look for headers and libs in +other directories than /usr/include or /usr/lib through the +environment variables PYTHON_MODULES_INCLUDE and PYTHON_MODULES_LIB. + +We can then use it to look for libraries in the buildroot staging +directory. + +Ported to python3.3 by Maxime Ripard based +on the work by Thomas Petazzoni + +Signed-off-by: Maxime Ripard +--- + setup.py | 13 +++++++++++++ + 1 file changed, 13 insertions(+) + +Index: Python-3.3.0/setup.py +=================================================================== +--- Python-3.3.0.orig/setup.py ++++ Python-3.3.0/setup.py +@@ -441,6 +441,19 @@ + os.unlink(tmpfile) + + def detect_modules(self): ++ try: ++ modules_include_dirs = os.environ["PYTHON_MODULES_INCLUDE"].split() ++ except KeyError: ++ modules_include_dirs = ['/usr/include'] ++ try: ++ modules_lib_dirs = os.environ["PYTHON_MODULES_LIB"].split() ++ except KeyError: ++ modules_lib_dirs = ['/usr/lib'] ++ for dir in modules_include_dirs: ++ add_dir_to_list(self.compiler.include_dirs, dir) ++ for dir in modules_lib_dirs: ++ add_dir_to_list(self.compiler.library_dirs, dir) ++ + # Ensure that /usr/local is always used, but the local build + # directories (i.e. '.' and 'Include') must be first. See issue + # 10520. diff --git a/package/python3/python3-004-no-import-when-cross-compiling.patch b/package/python3/python3-004-no-import-when-cross-compiling.patch new file mode 100644 index 0000000000..cd5a437472 --- /dev/null +++ b/package/python3/python3-004-no-import-when-cross-compiling.patch @@ -0,0 +1,27 @@ +Disable import check when cross-compiling + +Once Python has compiled an extension (i.e some C code, potentially +linked to a library), it tries to import it. This cannot work in +cross-compilation mode, so we just disable this check. + +Signed-off-by: Thomas Petazzoni +Signed-off-by: Maxime Ripard +--- + setup.py | 4 ++++ + 1 file changed, 4 insertions(+) + +Index: Python-3.3.0/setup.py +=================================================================== +--- Python-3.3.0.orig/setup.py ++++ Python-3.3.0/setup.py +@@ -318,6 +318,10 @@ + self.announce('WARNING: skipping import check for Cygwin-based "%s"' + % ext.name) + return ++ if os.environ.get('CROSS_COMPILING') == 'yes': ++ self.announce('WARNING: skipping import check for cross compiled "%s"' ++ % ext.name) ++ return + ext_filename = os.path.join( + self.build_lib, + self.get_ext_filename(self.get_ext_fullname(ext.name))) diff --git a/package/python3/python3-005-do-not-generate-pyo-files.patch b/package/python3/python3-005-do-not-generate-pyo-files.patch new file mode 100644 index 0000000000..983d546473 --- /dev/null +++ b/package/python3/python3-005-do-not-generate-pyo-files.patch @@ -0,0 +1,40 @@ +Do not generate .pyo files + +By default, the Python installation byte-compiles all modules in two +forms: the normal bytecode (.pyc) and an optimized bytecode (.pyo). + +According to +http://www.network-theory.co.uk/docs/pytut/CompiledPythonfiles.html, +the optimization do not do anything useful, and generating both the +"non-optimized" and "optimized" bytecode variants takes time. + +Signed-off-by: Thomas Petazzoni +--- + Makefile.pre.in | 9 --------- + 1 file changed, 9 deletions(-) + +Index: Python-3.3.0/Makefile.pre.in +=================================================================== +--- Python-3.3.0.orig/Makefile.pre.in ++++ Python-3.3.0/Makefile.pre.in +@@ -1082,20 +1082,11 @@ + -d $(LIBDEST) -f \ + -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 \ +- -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 \ + -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages + -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ +- $(PYTHON_FOR_BUILD) -Wi -O $(DESTDIR)$(LIBDEST)/compileall.py \ +- -d $(LIBDEST)/site-packages -f \ +- -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages +- -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 diff --git a/package/python3/python3-006-reread-environment.patch b/package/python3/python3-006-reread-environment.patch new file mode 100644 index 0000000000..752b15a4e2 --- /dev/null +++ b/package/python3/python3-006-reread-environment.patch @@ -0,0 +1,63 @@ +Make sure setup.py reads the correct CONFIG_ARGS + +The setup.py script that builds and installs all the Python modules +shipped with the interpreter looks at the CONFIG_ARGS variable stored +in the "sysconfig" module to look at the ./configure options and +adjust its behaviour accordingly. + +Unfortunately, when cross-compiling, the value of CONFIG_ARGS returned +by the sysconfig are the one passed to the ./configure script of the +*host* Python and not the one we're currently building for the target. + +In order to avoid that, we re-initialize the values in the sysconfig +module by re-reading the environment at the beginning of the setup.py +script, and we make sure that the CONFIG_ARGS variable is actually +part of the environment of setup.py. + +See the beginning of +http://article.gmane.org/gmane.comp.python.devel/99772 for the +inspiration. + +Signed-off-by: Thomas Petazzoni + +--- + Makefile.pre.in | 4 +++- + setup.py | 3 +++ + 2 files changed, 6 insertions(+), 1 deletion(-) + +Index: Python-3.3.0/setup.py +=================================================================== +--- Python-3.3.0.orig/setup.py ++++ Python-3.3.0/setup.py +@@ -30,6 +30,9 @@ + # Were we compiled --with-pydebug or with #define Py_DEBUG? + COMPILED_WITH_PYDEBUG = ('--with-pydebug' in sysconfig.get_config_var("CONFIG_ARGS")) + ++sysconfig.get_config_vars() ++sysconfig._CONFIG_VARS.update(os.environ) ++ + # This global variable is used to hold the list of modules to be disabled. + disabled_module_list = [] + +Index: Python-3.3.0/Makefile.pre.in +=================================================================== +--- Python-3.3.0.orig/Makefile.pre.in ++++ Python-3.3.0/Makefile.pre.in +@@ -478,6 +478,7 @@ + sharedmods: $(BUILDPYTHON) pybuilddir.txt + case $$MAKEFLAGS in *s*) quiet=-q; esac; \ + $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \ ++ CONFIG_ARGS="$(CONFIG_ARGS)" \ + $(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build + + # Build static library +@@ -1183,7 +1184,8 @@ + # Install the dynamically loadable modules + # This goes into $(exec_prefix) + sharedinstall: sharedmods +- $(RUNSHARED) $(PYTHON_FOR_BUILD) $(srcdir)/setup.py install \ ++ $(RUNSHARED) CONFIG_ARGS="$(CONFIG_ARGS)" \ ++ $(PYTHON_FOR_BUILD) $(srcdir)/setup.py install \ + --prefix=$(prefix) \ + --install-scripts=$(BINDIR) \ + --install-platlib=$(DESTSHARED) \ diff --git a/package/python3/python3-007-change-pyconfig-h-location.patch b/package/python3/python3-007-change-pyconfig-h-location.patch new file mode 100644 index 0000000000..8d45daef4d --- /dev/null +++ b/package/python3/python3-007-change-pyconfig-h-location.patch @@ -0,0 +1,76 @@ +Change the location of pyconfig.h + +The Python interpreter has a really strange behaviour: at *runtime*, +it reads a Makefile and a header file named pyconfig.h to get some +information about the configuration. + +The Makefile is located in usr/lib/python3.3/config-3.3m, which is fine +since this location is kept on the target. + +However, by default, the pyconfig.h is installed in +usr/include/python3.3m, but we completely remove the usr/include +directory for the target. Since making an exception just for +pyconfig.h is annoying, this patch also installs pyconfig.h to +usr/lib/python3.3/config-3.3m, and modifies the sysconfig module so that it +looks in this location instead of usr/include. + +The pyconfig.h is still kept in usr/include/python3.3m, because it is +needed in the $(STAGING_DIR) when building third-party Python +extensions that contain C code. + +Signed-off-by: Thomas Petazzoni + +--- + Lib/distutils/sysconfig.py | 3 ++- + Lib/sysconfig.py | 2 +- + Makefile.pre.in | 3 ++- + 3 files changed, 5 insertions(+), 3 deletions(-) + +Index: Python-3.3.0/Lib/distutils/sysconfig.py +=================================================================== +--- Python-3.3.0.orig/Lib/distutils/sysconfig.py ++++ Python-3.3.0/Lib/distutils/sysconfig.py +@@ -239,7 +239,8 @@ + else: + inc_dir = _sys_home or project_base + else: +- inc_dir = get_python_inc(plat_specific=1) ++ lib_dir = get_python_lib(plat_specific=1, standard_lib=1) ++ inc_dir = os.path.join(lib_dir, "config") + if get_python_version() < '2.2': + config_h = 'config.h' + else: +Index: Python-3.3.0/Lib/sysconfig.py +=================================================================== +--- Python-3.3.0.orig/Lib/sysconfig.py ++++ Python-3.3.0/Lib/sysconfig.py +@@ -467,7 +467,7 @@ + else: + inc_dir = _sys_home or _PROJECT_BASE + else: +- inc_dir = get_path('platinclude') ++ inc_dir = os.path.join(get_path('stdlib'), "config") + return os.path.join(inc_dir, 'pyconfig.h') + + +Index: Python-3.3.0/Makefile.pre.in +=================================================================== +--- Python-3.3.0.orig/Makefile.pre.in ++++ Python-3.3.0/Makefile.pre.in +@@ -1123,7 +1123,6 @@ + echo $(INSTALL_DATA) $$i $(INCLUDEPY); \ + $(INSTALL_DATA) $$i $(DESTDIR)$(INCLUDEPY); \ + done +- $(INSTALL_DATA) pyconfig.h $(DESTDIR)$(CONFINCLUDEPY)/pyconfig.h + + # Install the library and miscellaneous stuff needed for extending/embedding + # This goes into $(exec_prefix) +@@ -1157,6 +1156,8 @@ + $(INSTALL_DATA) Modules/python.o $(DESTDIR)$(LIBPL)/python.o + $(INSTALL_DATA) $(srcdir)/Modules/config.c.in $(DESTDIR)$(LIBPL)/config.c.in + $(INSTALL_DATA) Makefile $(DESTDIR)$(LIBPL)/Makefile ++ $(INSTALL_DATA) pyconfig.h $(DESTDIR)$(LIBPL)/pyconfig.h ++ $(INSTALL_DATA) pyconfig.h $(DESTDIR)$(CONFINCLUDEPY)/pyconfig.h + $(INSTALL_DATA) Modules/Setup $(DESTDIR)$(LIBPL)/Setup + $(INSTALL_DATA) Modules/Setup.local $(DESTDIR)$(LIBPL)/Setup.local + $(INSTALL_DATA) Modules/Setup.config $(DESTDIR)$(LIBPL)/Setup.config diff --git a/package/python3/python3-008-no-rpath.patch b/package/python3/python3-008-no-rpath.patch new file mode 100644 index 0000000000..cdeec22ce9 --- /dev/null +++ b/package/python3/python3-008-no-rpath.patch @@ -0,0 +1,51 @@ +Remove runtime library paths + +For some extensions (sqlite and dbm), Python setup.py script +hardcode a runtime path (rpath) into the extension. However, this +runtime path is incorrect (because it points to the location of the +library directory on the development machine) and useless (because on +the target, all useful libraries are in a standard directory searched +by the dynamic loader). For those reasons, we just get rid of the +runtime paths in cross-compilation mode. + +Signed-off-by: Thomas Petazzoni +--- + setup.py | 12 ++++++++++-- + 1 file changed, 10 insertions(+), 2 deletions(-) + +Index: Python-3.3.0/setup.py +=================================================================== +--- Python-3.3.0.orig/setup.py ++++ Python-3.3.0/setup.py +@@ -1134,11 +1134,15 @@ + # can end up with a bad search path order. + if sqlite_incdir not in self.compiler.include_dirs: + include_dirs.append(sqlite_incdir) ++ if cross_compiling: ++ sqlite_runtime_libdir = None ++ else: ++ sqlite_runtime_libdir = sqlite_libdir + exts.append(Extension('_sqlite3', sqlite_srcs, + define_macros=sqlite_defines, + include_dirs=include_dirs, + library_dirs=sqlite_libdir, +- runtime_library_dirs=sqlite_libdir, ++ runtime_library_dirs=sqlite_runtime_libdir, + extra_link_args=sqlite_extra_link_args, + libraries=["sqlite3",])) + else: +@@ -1205,9 +1209,13 @@ + elif cand == "bdb": + if db_incs is not None: + if dbm_setup_debug: print("building dbm using bdb") ++ if cross_compiling: ++ dblib_runtime_libdir = None ++ else: ++ dblib_runtime_libdir = dblib_dir + dbmext = Extension('_dbm', ['_dbmmodule.c'], + library_dirs=dblib_dir, +- runtime_library_dirs=dblib_dir, ++ runtime_library_dirs=dblib_runtime_libdir, + include_dirs=db_incs, + define_macros=[ + ('HAVE_BERKDB_H', None), diff --git a/package/python3/python3-009-verbose-module-build.patch b/package/python3/python3-009-verbose-module-build.patch new file mode 100644 index 0000000000..60b6d797d3 --- /dev/null +++ b/package/python3/python3-009-verbose-module-build.patch @@ -0,0 +1,26 @@ +Enables verbose output when building modules + +Patch borrowed from OpenBricks. + +Signed-off-by: Thomas Petazzoni + +--- + Makefile.pre.in | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +Index: Python-3.3.0/Makefile.pre.in +=================================================================== +--- Python-3.3.0.orig/Makefile.pre.in ++++ Python-3.3.0/Makefile.pre.in +@@ -476,10 +476,9 @@ + + # Build the shared modules + sharedmods: $(BUILDPYTHON) pybuilddir.txt +- case $$MAKEFLAGS in *s*) quiet=-q; esac; \ + $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \ + CONFIG_ARGS="$(CONFIG_ARGS)" \ +- $(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build ++ $(PYTHON_FOR_BUILD) $(srcdir)/setup.py build + + # Build static library + # avoid long command lines, same as LIBRARY_OBJS diff --git a/package/python3/python3-010-distutils-cross-compilation-support.patch b/package/python3/python3-010-distutils-cross-compilation-support.patch new file mode 100644 index 0000000000..0a51400bf5 --- /dev/null +++ b/package/python3/python3-010-distutils-cross-compilation-support.patch @@ -0,0 +1,71 @@ +Add some cross-compilation fixes to distutils + +Inspired by work done by Marc Kleine-Budde in +PTXdist. + +Signed-off-by: Thomas Petazzoni +--- + Lib/distutils/sysconfig.py | 17 +++++++++++++---- + configure.ac | 8 +++++++- + 2 files changed, 20 insertions(+), 5 deletions(-) + +Index: Python-3.3.0/Lib/distutils/sysconfig.py +=================================================================== +--- Python-3.3.0.orig/Lib/distutils/sysconfig.py ++++ Python-3.3.0/Lib/distutils/sysconfig.py +@@ -16,15 +16,24 @@ + 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) ++EXECUTABLE_DIRNAME = os.path.dirname(os.path.realpath(sys.executable)) ++if os.environ.get('CROSS_COMPILING') == 'yes': ++ _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')) ++ if '_python_srcdir' in os.environ: ++ EXECUTABLE_DIRNAME = os.path.normpath(os.environ['_python_srcdir']) ++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, + # it'll live in project/PCbuild/amd64. +-project_base = os.path.dirname(os.path.abspath(sys.executable)) ++project_base = EXECUTABLE_DIRNAME + if os.name == "nt" and "pcbuild" in project_base[-8:].lower(): + project_base = os.path.abspath(os.path.join(project_base, os.path.pardir)) + # PC/VS7.1 +@@ -98,7 +107,7 @@ + # the build directory may not be the source directory, we + # must use "srcdir" from the makefile to find the "Include" + # directory. +- base = _sys_home or os.path.dirname(os.path.abspath(sys.executable)) ++ base = _sys_home or EXECUTABLE_DIRNAME + if plat_specific: + return base + if _sys_home: +Index: Python-3.3.0/configure.ac +=================================================================== +--- Python-3.3.0.orig/configure.ac ++++ Python-3.3.0/configure.ac +@@ -963,7 +963,13 @@ + fi + + if test "$cross_compiling" = yes; then +- RUNSHARED= ++ RUNSHARED=" \ ++ CROSS_COMPILING=yes \ ++ _python_cross_host=${ac_cv_host} \ ++ _python_sysroot=\"\$(sysroot)\" \ ++ _python_srcdir=\"\$(srcdir)\" \ ++ _python_prefix=\"\$(prefix)\" \ ++ _python_exec_prefix=\"\$(exec_prefix)\"" + fi + + AC_MSG_RESULT($LDLIBRARY) diff --git a/package/python3/python3-011-cross-compile-getaddrinfo.patch b/package/python3/python3-011-cross-compile-getaddrinfo.patch new file mode 100644 index 0000000000..33286ce391 --- /dev/null +++ b/package/python3/python3-011-cross-compile-getaddrinfo.patch @@ -0,0 +1,21 @@ +Disable buggy_getaddrinfo configure test when cross-compiling with IPv6 support + +Signed-off-by: Vanya Sergeev + +--- + configure.ac | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +Index: Python-3.3.0/configure.ac +=================================================================== +--- Python-3.3.0.orig/configure.ac ++++ Python-3.3.0/configure.ac +@@ -3204,7 +3204,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 diff --git a/package/python3/python3-012-disable-extensions.patch b/package/python3/python3-012-disable-extensions.patch new file mode 100644 index 0000000000..ed1d1e2d93 --- /dev/null +++ b/package/python3/python3-012-disable-extensions.patch @@ -0,0 +1,98 @@ +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 , and +then extended by Thomas Petazzoni +. + +Signed-off-by: Thomas Petazzoni +--- + Makefile.pre.in | 4 ++++ + configure.ac | 2 ++ + setup.py | 5 ++++- + 3 files changed, 10 insertions(+), 1 deletion(-) + +Index: cpython/Makefile.pre.in +=================================================================== +--- cpython.orig/Makefile.pre.in ++++ cpython/Makefile.pre.in +@@ -155,6 +155,8 @@ + # configure script arguments + CONFIG_ARGS= @CONFIG_ARGS@ + ++# disabled extensions ++DISABLED_EXTENSIONS= @DISABLED_EXTENSIONS@ + + # Subdirectories with code + SRCDIRS= @SRCDIRS@ +@@ -478,6 +480,7 @@ + sharedmods: $(BUILDPYTHON) pybuilddir.txt + $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \ + CONFIG_ARGS="$(CONFIG_ARGS)" \ ++ DISABLED_EXTENSIONS="$(DISABLED_EXTENSIONS)" \ + $(PYTHON_FOR_BUILD) $(srcdir)/setup.py build + + # Build static library +@@ -1185,6 +1188,7 @@ + # This goes into $(exec_prefix) + sharedinstall: sharedmods + $(RUNSHARED) CONFIG_ARGS="$(CONFIG_ARGS)" \ ++ DISABLED_EXTENSIONS="$(DISABLED_EXTENSIONS)" \ + $(PYTHON_FOR_BUILD) $(srcdir)/setup.py install \ + --prefix=$(prefix) \ + --install-scripts=$(BINDIR) \ +Index: cpython/configure.ac +=================================================================== +--- cpython.orig/configure.ac ++++ cpython/configure.ac +@@ -2175,6 +2175,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: cpython/setup.py +=================================================================== +--- cpython.orig/setup.py ++++ cpython/setup.py +@@ -34,7 +34,10 @@ + sysconfig._CONFIG_VARS.update(os.environ) + + # 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 diff --git a/package/python3/python3-100-optional-test-modules.patch b/package/python3/python3-100-optional-test-modules.patch new file mode 100644 index 0000000000..13e73a7ed9 --- /dev/null +++ b/package/python3/python3-100-optional-test-modules.patch @@ -0,0 +1,102 @@ +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 +Signed-off-by: Samuel Martin + +--- + Makefile.pre.in | 50 ++++++++++++++++++++++++++++++++------------------ + configure.ac | 6 ++++++ + 2 files changed, 38 insertions(+), 18 deletions(-) + +Index: cpython/Makefile.pre.in +=================================================================== +--- cpython.orig/Makefile.pre.in ++++ cpython/Makefile.pre.in +@@ -976,8 +976,26 @@ + 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 \ ++ collections concurrent concurrent/futures encodings \ ++ email email/mime \ ++ 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) ++ ++ifeq (@TEST_MODULES@,yes) ++LIBSUBDIRS += tkinter/test tkinter/test/test_tkinter \ ++ tkinter/test/test_ttk test \ + test/capath test/data \ + test/cjkencodings test/decimaltestdata test/xmltestdata \ + test/subprocessdata test/sndhdrdata \ +@@ -1000,26 +1018,22 @@ + test/namespace_pkgs/project3 \ + test/namespace_pkgs/project3/parent \ + test/namespace_pkgs/project3/parent/child \ +- test/namespace_pkgs/module_and_namespace_package \ +- test/namespace_pkgs/module_and_namespace_package/a_test \ +- collections concurrent concurrent/futures encodings \ +- email email/mime test/test_email test/test_email/data \ +- html json test/json_tests http dbm xmlrpc \ +- sqlite3 sqlite3/test \ +- logging csv wsgiref urllib \ +- lib2to3 lib2to3/fixes lib2to3/pgen2 lib2to3/tests \ ++ test/namespace_pkgs/module_and_namespace_package \ ++ test/namespace_pkgs/module_and_namespace_package/a_test \ ++ test/test_email test/test_email/data \ ++ test/json_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 \ +- distutils distutils/command distutils/tests $(XMLLIBSUBDIRS) \ +- importlib test/test_importlib test/test_importlib/builtin \ ++ ctypes/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 unittest/test unittest/test/testmock ++endif ++ + libinstall: build_all $(srcdir)/Lib/$(PLATDIR) $(srcdir)/Modules/xxmodule.c + @for i in $(SCRIPTDIR) $(LIBDEST); \ + do \ +Index: cpython/configure.ac +=================================================================== +--- cpython.orig/configure.ac ++++ cpython/configure.ac +@@ -2449,6 +2449,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]) diff --git a/package/python3/python3-101-optional-pydoc.patch b/package/python3/python3-101-optional-pydoc.patch new file mode 100644 index 0000000000..ac50ac39ea --- /dev/null +++ b/package/python3/python3-101-optional-pydoc.patch @@ -0,0 +1,91 @@ +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 +Signed-off-by: Samuel Martin + +--- + Makefile.pre.in | 8 +++++++- + configure.ac | 5 +++++ + setup.py | 9 +++++++-- + 3 files changed, 19 insertions(+), 3 deletions(-) + +Index: cpython/Makefile.pre.in +=================================================================== +--- cpython.orig/Makefile.pre.in ++++ cpython/Makefile.pre.in +@@ -952,7 +952,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 +@@ -991,7 +993,7 @@ + multiprocessing multiprocessing/dummy \ + unittest \ + venv venv/scripts venv/scripts/posix \ +- curses pydoc_data $(MACHDEPS) ++ curses $(MACHDEPS) + + ifeq (@TEST_MODULES@,yes) + LIBSUBDIRS += tkinter/test tkinter/test/test_tkinter \ +@@ -1034,6 +1036,10 @@ + unittest unittest/test unittest/test/testmock + endif + ++ifeq (@PYDOC@,yes) ++LIBSUBDIRS += pydoc_data ++endif ++ + libinstall: build_all $(srcdir)/Lib/$(PLATDIR) $(srcdir)/Modules/xxmodule.c + @for i in $(SCRIPTDIR) $(LIBDEST); \ + do \ +Index: cpython/configure.ac +=================================================================== +--- cpython.orig/configure.ac ++++ cpython/configure.ac +@@ -2448,6 +2448,11 @@ + esac]) + fi + ++AC_SUBST(PYDOC) ++ ++AC_ARG_ENABLE(pydoc, ++ AS_HELP_STRING([--disable-pydoc], [disable pydoc]), ++ [ PYDOC="${enableval}" ], [ PYDOC=yes ]) + + AC_SUBST(TEST_MODULES) + +Index: cpython/setup.py +=================================================================== +--- cpython.orig/setup.py ++++ cpython/setup.py +@@ -2123,6 +2123,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], +@@ -2147,8 +2153,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 diff --git a/package/python3/python3-102-optional-2to3.patch b/package/python3/python3-102-optional-2to3.patch new file mode 100644 index 0000000000..f5e821ae6b --- /dev/null +++ b/package/python3/python3-102-optional-2to3.patch @@ -0,0 +1,111 @@ +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 +Signed-off-by: Samuel Martin + +--- + Makefile.pre.in | 18 ++++++++++++++---- + configure.ac | 6 ++++++ + setup.py | 5 +++-- + 3 files changed, 23 insertions(+), 6 deletions(-) + +Index: cpython/Makefile.pre.in +=================================================================== +--- cpython.orig/Makefile.pre.in ++++ cpython/Makefile.pre.in +@@ -956,7 +956,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) + +@@ -985,7 +987,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) \ + importlib \ +@@ -1025,9 +1026,6 @@ + test/test_email test/test_email/data \ + test/json_tests \ + sqlite3/test \ +- lib2to3/tests \ +- lib2to3/tests/data lib2to3/tests/data/fixers \ +- lib2to3/tests/data/fixers/myfixes \ + ctypes/test \ + distutils/tests \ + test/test_importlib test/test_importlib/builtin \ +@@ -1040,6 +1038,16 @@ + LIBSUBDIRS += pydoc_data + endif + ++ifeq (@LIB2TO3@,yes) ++LIBSUBDIRS += lib2to3 lib2to3/fixes lib2to3/pgen2 ++ifeq (@TEST_MODULES@,yes) ++LIBSUBDIRS += lib2to3/tests \ ++ lib2to3/tests/data \ ++ lib2to3/tests/data/fixers \ ++ lib2to3/tests/data/fixers/myfixes ++endif ++endif ++ + libinstall: build_all $(srcdir)/Lib/$(PLATDIR) $(srcdir)/Modules/xxmodule.c + @for i in $(SCRIPTDIR) $(LIBDEST); \ + do \ +@@ -1109,10 +1117,12 @@ + $(PYTHON_FOR_BUILD) -Wi $(DESTDIR)$(LIBDEST)/compileall.py \ + -d $(LIBDEST)/site-packages -f \ + -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages ++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: cpython/setup.py +=================================================================== +--- cpython.orig/setup.py ++++ cpython/setup.py +@@ -2124,10 +2124,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: cpython/configure.ac +=================================================================== +--- cpython.orig/configure.ac ++++ cpython/configure.ac +@@ -2460,6 +2460,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]) diff --git a/package/python3/python3-103-optional-sqlite.patch b/package/python3/python3-103-optional-sqlite.patch new file mode 100644 index 0000000000..e3a63c3e02 --- /dev/null +++ b/package/python3/python3-103-optional-sqlite.patch @@ -0,0 +1,64 @@ +Add option to disable the sqlite3 module + +Signed-off-by: Thomas Petazzoni +Signed-off-by: Samuel Martin + +--- + Makefile.pre.in | 9 +++++++-- + configure.ac | 9 +++++++++ + 2 files changed, 16 insertions(+), 2 deletions(-) + +Index: cpython/configure.ac +=================================================================== +--- cpython.orig/configure.ac ++++ cpython/configure.ac +@@ -2448,6 +2448,15 @@ + esac]) + 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: cpython/Makefile.pre.in +=================================================================== +--- cpython.orig/Makefile.pre.in ++++ cpython/Makefile.pre.in +@@ -985,7 +985,6 @@ + collections concurrent concurrent/futures encodings \ + email email/mime \ + html json http dbm xmlrpc \ +- sqlite3 \ + logging csv wsgiref urllib \ + ctypes ctypes/macholib idlelib idlelib/Icons \ + distutils distutils/command $(XMLLIBSUBDIRS) \ +@@ -1025,7 +1024,6 @@ + test/namespace_pkgs/module_and_namespace_package/a_test \ + test/test_email test/test_email/data \ + test/json_tests \ +- sqlite3/test \ + ctypes/test \ + distutils/tests \ + test/test_importlib test/test_importlib/builtin \ +@@ -1048,6 +1046,13 @@ + endif + endif + ++ifeq (@SQLITE3@,yes) ++LIBSUBDIRS += sqlite3 ++ifeq (@TEST_MODULES@,yes) ++LIBSUBDIRS += sqlite3/test ++endif ++endif ++ + libinstall: build_all $(srcdir)/Lib/$(PLATDIR) $(srcdir)/Modules/xxmodule.c + @for i in $(SCRIPTDIR) $(LIBDEST); \ + do \ diff --git a/package/python3/python3-104-optional-tk.patch b/package/python3/python3-104-optional-tk.patch new file mode 100644 index 0000000000..2f89fe014f --- /dev/null +++ b/package/python3/python3-104-optional-tk.patch @@ -0,0 +1,69 @@ +Add an option to disable the tk module + +Signed-off-by: Thomas Petazzoni +Signed-off-by: Samuel Martin + +--- + Makefile.pre.in | 14 +++++++++++--- + configure.ac | 9 +++++++++ + 2 files changed, 20 insertions(+), 3 deletions(-) + +Index: cpython/Makefile.pre.in +=================================================================== +--- cpython.orig/Makefile.pre.in ++++ cpython/Makefile.pre.in +@@ -980,7 +980,7 @@ + EXTRAPLATDIR= @EXTRAPLATDIR@ + MACHDEPS= $(PLATDIR) $(EXTRAPLATDIR) + XMLLIBSUBDIRS= xml xml/dom xml/etree xml/parsers xml/sax +-LIBSUBDIRS= tkinter \ ++LIBSUBDIRS= \ + site-packages \ + collections concurrent concurrent/futures encodings \ + email email/mime \ +@@ -996,8 +996,7 @@ + curses $(MACHDEPS) + + ifeq (@TEST_MODULES@,yes) +-LIBSUBDIRS += tkinter/test tkinter/test/test_tkinter \ +- tkinter/test/test_ttk test \ ++LIBSUBDIRS += test \ + test/capath test/data \ + test/cjkencodings test/decimaltestdata test/xmltestdata \ + test/subprocessdata test/sndhdrdata \ +@@ -1053,6 +1052,15 @@ + endif + endif + ++ifeq (@TK@,yes) ++LIBSUBDIRS += tkinter ++ifeq (@TEST_MODULES@,yes) ++LIBSUBDIRS += \ ++ tkinter/test tkinter/test/test_tkinter \ ++ tkinter/test/test_ttk ++endif ++endif ++ + libinstall: build_all $(srcdir)/Lib/$(PLATDIR) $(srcdir)/Modules/xxmodule.c + @for i in $(SCRIPTDIR) $(LIBDEST); \ + do \ +Index: cpython/configure.ac +=================================================================== +--- cpython.orig/configure.ac ++++ cpython/configure.ac +@@ -2457,6 +2457,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, diff --git a/package/python3/python3-105-optional-curses.patch b/package/python3/python3-105-optional-curses.patch new file mode 100644 index 0000000000..adb31836fd --- /dev/null +++ b/package/python3/python3-105-optional-curses.patch @@ -0,0 +1,54 @@ +Add an option to disable the curses module + +Signed-off-by: Thomas Petazzoni +Signed-off-by: Samuel Martin + +--- + Makefile.pre.in | 6 +++++- + configure.ac | 9 +++++++++ + 2 files changed, 14 insertions(+), 1 deletion(-) + +Index: cpython/Makefile.pre.in +=================================================================== +--- cpython.orig/Makefile.pre.in ++++ cpython/Makefile.pre.in +@@ -993,7 +993,7 @@ + multiprocessing multiprocessing/dummy \ + unittest \ + venv venv/scripts venv/scripts/posix \ +- curses $(MACHDEPS) ++ $(MACHDEPS) + + ifeq (@TEST_MODULES@,yes) + LIBSUBDIRS += test \ +@@ -1061,6 +1061,10 @@ + endif + endif + ++ifeq (@CURSES@,yes) ++LIBSUBDIRS += curses ++endif ++ + libinstall: build_all $(srcdir)/Lib/$(PLATDIR) $(srcdir)/Modules/xxmodule.c + @for i in $(SCRIPTDIR) $(LIBDEST); \ + do \ +Index: cpython/configure.ac +=================================================================== +--- cpython.orig/configure.ac ++++ cpython/configure.ac +@@ -2466,6 +2466,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, diff --git a/package/python3/python3-106-optional-expat.patch b/package/python3/python3-106-optional-expat.patch new file mode 100644 index 0000000000..d171b79ef7 --- /dev/null +++ b/package/python3/python3-106-optional-expat.patch @@ -0,0 +1,85 @@ +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 +Signed-off-by: Samuel Martin + +--- + Makefile.pre.in | 6 +++++- + configure.ac | 18 +++++++++++++----- + setup.py | 2 +- + 3 files changed, 19 insertions(+), 7 deletions(-) + +Index: cpython/Makefile.pre.in +=================================================================== +--- cpython.orig/Makefile.pre.in ++++ cpython/Makefile.pre.in +@@ -987,7 +987,7 @@ + html json http dbm xmlrpc \ + logging csv wsgiref urllib \ + ctypes ctypes/macholib idlelib idlelib/Icons \ +- distutils distutils/command $(XMLLIBSUBDIRS) \ ++ distutils distutils/command \ + importlib \ + turtledemo \ + multiprocessing multiprocessing/dummy \ +@@ -1065,6 +1065,10 @@ + LIBSUBDIRS += curses + endif + ++ifeq (@EXPAT@,yes) ++LIBSUBDIRS += $(XMLLIBSUBDIRS) ++endif ++ + libinstall: build_all $(srcdir)/Lib/$(PLATDIR) $(srcdir)/Modules/xxmodule.c + @for i in $(SCRIPTDIR) $(LIBDEST); \ + do \ +Index: cpython/configure.ac +=================================================================== +--- cpython.orig/configure.ac ++++ cpython/configure.ac +@@ -2178,13 +2178,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: cpython/setup.py +=================================================================== +--- cpython.orig/setup.py ++++ cpython/setup.py +@@ -1404,7 +1404,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'] diff --git a/package/python3/python3-107-optional-codecs-cjk.patch b/package/python3/python3-107-optional-codecs-cjk.patch new file mode 100644 index 0000000000..de7f9109a4 --- /dev/null +++ b/package/python3/python3-107-optional-codecs-cjk.patch @@ -0,0 +1,25 @@ +Add an option to disable CJK codecs + +Signed-off-by: Thomas Petazzoni + +--- + configure.ac | 6 ++++++ + 1 file changed, 6 insertions(+) + +Index: cpython/configure.ac +=================================================================== +--- cpython.orig/configure.ac ++++ cpython/configure.ac +@@ -2465,6 +2465,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]), diff --git a/package/python3/python3-108-optional-nis.patch b/package/python3/python3-108-optional-nis.patch new file mode 100644 index 0000000000..3c9149769c --- /dev/null +++ b/package/python3/python3-108-optional-nis.patch @@ -0,0 +1,28 @@ +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 + +--- + configure.ac | 6 ++++++ + 1 file changed, 6 insertions(+) + +Index: cpython/configure.ac +=================================================================== +--- cpython.orig/configure.ac ++++ cpython/configure.ac +@@ -2471,6 +2471,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]), diff --git a/package/python3/python3-109-optional-unicodedata.patch b/package/python3/python3-109-optional-unicodedata.patch new file mode 100644 index 0000000000..c75ee27c74 --- /dev/null +++ b/package/python3/python3-109-optional-unicodedata.patch @@ -0,0 +1,25 @@ +Add an option to disable unicodedata + +Signed-off-by: Thomas Petazzoni + +--- + configure.ac | 6 ++++++ + 1 file changed, 6 insertions(+) + +Index: cpython/configure.ac +=================================================================== +--- cpython.orig/configure.ac ++++ cpython/configure.ac +@@ -2477,6 +2477,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]), diff --git a/package/python3/python3-110-optional-idle.patch b/package/python3/python3-110-optional-idle.patch new file mode 100644 index 0000000000..1a7fa65623 --- /dev/null +++ b/package/python3/python3-110-optional-idle.patch @@ -0,0 +1,83 @@ +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 + +--- + Makefile.pre.in | 8 +++++++- + configure.ac | 6 ++++++ + setup.py | 4 +++- + 3 files changed, 16 insertions(+), 2 deletions(-) + +Index: cpython/Makefile.pre.in +=================================================================== +--- cpython.orig/Makefile.pre.in ++++ cpython/Makefile.pre.in +@@ -950,7 +950,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) +@@ -986,7 +988,7 @@ + email email/mime \ + html json http dbm xmlrpc \ + logging csv wsgiref urllib \ +- ctypes ctypes/macholib idlelib idlelib/Icons \ ++ ctypes ctypes/macholib \ + distutils distutils/command \ + importlib \ + turtledemo \ +@@ -1069,6 +1071,10 @@ + LIBSUBDIRS += $(XMLLIBSUBDIRS) + endif + ++ifeq (@IDLE@,yes) ++LIBSUBDIRS += idlelib idlelib/Icons ++endif ++ + libinstall: build_all $(srcdir)/Lib/$(PLATDIR) $(srcdir)/Modules/xxmodule.c + @for i in $(SCRIPTDIR) $(LIBDEST); \ + do \ +Index: cpython/configure.ac +=================================================================== +--- cpython.orig/configure.ac ++++ cpython/configure.ac +@@ -2519,6 +2519,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: cpython/setup.py +=================================================================== +--- cpython.orig/setup.py ++++ cpython/setup.py +@@ -2124,11 +2124,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", diff --git a/package/python3/python3-3.3-000-generate-sysconfigdata-buildir.patch b/package/python3/python3-3.3-000-generate-sysconfigdata-buildir.patch deleted file mode 100644 index a29aa0ffc8..0000000000 --- a/package/python3/python3-3.3-000-generate-sysconfigdata-buildir.patch +++ /dev/null @@ -1,158 +0,0 @@ -changeset: 79745:f85c3f4d9b98 -parent: 79743:36b2ca7dc893 -parent: 79744:24d52d3060e8 -user: Trent Nelson -date: Tue Oct 16 08:17:11 2012 -0400 -summary: Merge issue #15298: ensure _sysconfigdata is generated in build directory, - -Taken from upstream. - ---- - Lib/sysconfig.py | 11 ++++++++++- - Makefile.pre.in | 24 +++++++++++++----------- - setup.py | 14 -------------- - 3 files changed, 23 insertions(+), 26 deletions(-) - -Index: Python-3.3.0/Lib/sysconfig.py -=================================================================== ---- Python-3.3.0.orig/Lib/sysconfig.py -+++ Python-3.3.0/Lib/sysconfig.py -@@ -390,13 +390,22 @@ - if _PYTHON_BUILD: - vars['LDSHARED'] = vars['BLDSHARED'] - -- destfile = os.path.join(os.path.dirname(__file__), '_sysconfigdata.py') -+ pybuilddir = 'build/lib.%s-%s' % (get_platform(), sys.version[:3]) -+ if hasattr(sys, "gettotalrefcount"): -+ pybuilddir += '-pydebug' -+ os.makedirs(pybuilddir, exist_ok=True) -+ destfile = os.path.join(pybuilddir, '_sysconfigdata.py') -+ - with open(destfile, 'w', encoding='utf8') as f: - f.write('# system configuration generated and used by' - ' the sysconfig module\n') - f.write('build_time_vars = ') - pprint.pprint(vars, stream=f) - -+ # Create file used for sys.path fixup -- see Modules/getpath.c -+ with open('pybuilddir.txt', 'w', encoding='ascii') as f: -+ f.write(pybuilddir) -+ - def _init_posix(vars): - """Initialize the module as appropriate for POSIX systems.""" - # _sysconfigdata is generated at build time, see _generate_posix_vars() -Index: Python-3.3.0/Makefile.pre.in -=================================================================== ---- Python-3.3.0.orig/Makefile.pre.in -+++ Python-3.3.0/Makefile.pre.in -@@ -410,8 +410,6 @@ - Objects/unicodectype.o \ - Objects/weakrefobject.o - --SYSCONFIGDATA=$(srcdir)/Lib/_sysconfigdata.py -- - ########################################################################## - # objects that get linked into the Python library - LIBRARY_OBJS_OMIT_FROZEN= \ -@@ -432,7 +430,7 @@ - - # Default target - all: build_all --build_all: $(BUILDPYTHON) $(SYSCONFIGDATA) oldsharedmods sharedmods gdbhooks Modules/_testembed -+build_all: $(BUILDPYTHON) oldsharedmods sharedmods gdbhooks Modules/_testembed - - # Compile a binary with gcc profile guided optimization. - profile-opt: -@@ -466,15 +464,17 @@ - $(BUILDPYTHON): Modules/python.o $(LIBRARY) $(LDLIBRARY) $(PY3LIBRARY) - $(LINKCC) $(PY_LDFLAGS) $(LINKFORSHARED) -o $@ Modules/python.o $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST) - --platform: $(BUILDPYTHON) $(SYSCONFIGDATA) -+platform: $(BUILDPYTHON) - $(RUNSHARED) $(PYTHON_FOR_BUILD) -c 'import sys ; from sysconfig import get_platform ; print(get_platform()+"-"+sys.version[0:3])' >platform - --# Generate the sysconfig build-time data --$(SYSCONFIGDATA): $(BUILDPYTHON) -+# Create build directory and generate the sysconfig build-time data there. -+# pybuilddir.txt contains the name of the build dir and is used for -+# sys.path fixup -- see Modules/getpath.c. -+pybuilddir.txt: $(BUILDPYTHON) - $(RUNSHARED) $(PYTHON_FOR_BUILD) -S -m sysconfig --generate-posix-vars - - # Build the shared modules --sharedmods: $(BUILDPYTHON) $(SYSCONFIGDATA) -+sharedmods: $(BUILDPYTHON) pybuilddir.txt - case $$MAKEFLAGS in *s*) quiet=-q; esac; \ - $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \ - $(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build -@@ -1036,7 +1036,7 @@ - else true; \ - fi; \ - done -- @for i in $(srcdir)/Lib/*.py ; \ -+ @for i in $(srcdir)/Lib/*.py `cat pybuilddir.txt`/_sysconfigdata.py; \ - do \ - if test -x $$i; then \ - $(INSTALL_SCRIPT) $$i $(DESTDIR)$(LIBDEST); \ -@@ -1196,6 +1196,8 @@ - --install-scripts=$(BINDIR) \ - --install-platlib=$(DESTSHARED) \ - --root=$(DESTDIR)/ -+ -rm $(DESTDIR)$(DESTSHARED)/_sysconfigdata.py -+ -rm -r $(DESTDIR)$(DESTSHARED)/__pycache__ - - # Here are a couple of targets for MacOSX again, to install a full - # framework-based Python. frameworkinstall installs everything, the -@@ -1341,9 +1343,10 @@ - find . -name '*.s[ol]' -exec rm -f {} ';' - find . -name '*.so.[0-9]*.[0-9]*' -exec rm -f {} ';' - find build -name 'fficonfig.h' -exec rm -f {} ';' || true -- find build -name 'fficonfig.py' -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 Lib/lib2to3/*Grammar*.pickle -- -rm -f $(SYSCONFIGDATA) - -rm -f Modules/_testembed Modules/_freeze_importlib - - profile-removal: -@@ -1367,7 +1370,6 @@ - Modules/Setup Modules/Setup.local Modules/Setup.config \ - Modules/ld_so_aix Modules/python.exp Misc/python.pc - -rm -f python*-gdb.py -- -rm -f pybuilddir.txt - find $(srcdir) '(' -name '*.fdc' -o -name '*~' \ - -o -name '[@,#]*' -o -name '*.old' \ - -o -name '*.orig' -o -name '*.rej' \ -Index: Python-3.3.0/setup.py -=================================================================== ---- Python-3.3.0.orig/setup.py -+++ Python-3.3.0/setup.py -@@ -33,10 +33,6 @@ - # This global variable is used to hold the list of modules to be disabled. - disabled_module_list = [] - --# File which contains the directory for shared mods (for sys.path fixup --# when running from the build dir, see Modules/getpath.c) --_BUILDDIR_COOKIE = "pybuilddir.txt" -- - def add_dir_to_list(dirlist, dir): - """Add the directory 'dir' to the list 'dirlist' (after any relative - directories) if: -@@ -252,16 +248,6 @@ - args['compiler_so'] = compiler + ' ' + ccshared + ' ' + cflags - self.compiler.set_executables(**args) - -- # Not only do we write the builddir cookie, but we manually install -- # the shared modules directory if it isn't already in sys.path. -- # Otherwise trying to import the extensions after building them -- # will fail. -- with open(_BUILDDIR_COOKIE, "wb") as f: -- f.write(self.build_lib.encode('utf-8', 'surrogateescape')) -- abs_build_lib = os.path.join(os.getcwd(), self.build_lib) -- if abs_build_lib not in sys.path: -- sys.path.append(abs_build_lib) -- - build_ext.build_extensions(self) - - longest = max([len(e.name) for e in self.extensions]) diff --git a/package/python3/python3-3.3-001-support-for-build.patch b/package/python3/python3-3.3-001-support-for-build.patch deleted file mode 100644 index 8c57cfb9cc..0000000000 --- a/package/python3/python3-3.3-001-support-for-build.patch +++ /dev/null @@ -1,68 +0,0 @@ -Add support in Python build system to specify host pgen - -Python needs a "pgen" program to build itself. Unfortunately, the -Python build system assumes that it can use the pgen program it has -just built to build itself. Obviously, this cannot work in -cross-compilation mode since the pgen program have been built for the -target. - -Therefore, this patch adds support in the Python build system for the -new PGEN_FOR_BUILD variable, so that we can point Python ./configure -script to the pgen program that have been previously built for the -host. - -Patch ported to python2.7 by Maxime Ripard , and -later significantly reworked by Thomas Petazzoni -, with some inspiration taken -from the Python patches of the PTXdist project, and then ported to -python3.3 by Maxime Ripard - -Signed-off-by: Maxime Ripard ---- - Makefile.pre.in | 5 +++-- - configure.ac | 5 +++++ - 2 files changed, 8 insertions(+), 2 deletions(-) - -Index: Python-3.3.0/Makefile.pre.in -=================================================================== ---- Python-3.3.0.orig/Makefile.pre.in -+++ Python-3.3.0/Makefile.pre.in -@@ -239,6 +239,7 @@ - ########################################################################## - # Parser - PGEN= Parser/pgen$(EXE) -+PGEN_FOR_BUILD=@PGEN_FOR_BUILD@ - - PSRCS= \ - Parser/acceler.c \ -@@ -639,8 +640,8 @@ - - $(GRAMMAR_H): $(GRAMMAR_INPUT) $(PGENSRCS) - @$(MKDIR_P) Include -- $(MAKE) $(PGEN) -- $(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C) -+ $(MAKE) $(PGEN_FOR_BUILD) -+ $(PGEN_FOR_BUILD) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C) - $(GRAMMAR_C): $(GRAMMAR_H) $(GRAMMAR_INPUT) $(PGENSRCS) - $(MAKE) $(GRAMMAR_H) - touch $(GRAMMAR_C) -Index: Python-3.3.0/configure.ac -=================================================================== ---- Python-3.3.0.orig/configure.ac -+++ Python-3.3.0/configure.ac -@@ -51,10 +51,15 @@ - AC_MSG_RESULT($interp) - PYTHON_FOR_BUILD="_PYTHON_PROJECT_BASE=$srcdir"' _PYTHON_HOST_PLATFORM=$(_PYTHON_HOST_PLATFORM) PYTHONPATH=$(srcdir)/Lib:$(srcdir)/Lib/plat-$(MACHDEP) '$interp - fi -+ AC_MSG_CHECKING(pgen for build) -+ PGEN_FOR_BUILD="${PGEN_FOR_BUILD}" -+ AC_MSG_RESULT($PGEN_FOR_BUILD) - else - PYTHON_FOR_BUILD='./$(BUILDPYTHON) -E' -+ PGEN_FOR_BUILD='./$(PGEN)' - fi - AC_SUBST(PYTHON_FOR_BUILD) -+AC_SUBST(PGEN_FOR_BUILD) - - dnl Ensure that if prefix is specified, it does not end in a slash. If - dnl it does, we get path names containing '//' which is both ugly and diff --git a/package/python3/python3-3.3-002-no-host-headers-libs.patch b/package/python3/python3-3.3-002-no-host-headers-libs.patch deleted file mode 100644 index 9783f28ade..0000000000 --- a/package/python3/python3-3.3-002-no-host-headers-libs.patch +++ /dev/null @@ -1,72 +0,0 @@ -Do not look at host headers/libraries in cross-compile mode - -When we are cross-compiling, setup.py should never look in /usr or -/usr/local to find headers or libraries. A later patch adds a -mechanism to tell setup.py to look in a specific directory for headers -and libraries. - -Patch first written by Thomas Petazzoni - for python2.7, and then ported -to python3.3 by Maxime Ripard - -Signed-off-by: Maxime Ripard ---- - setup.py | 23 +++++------------------ - 1 file changed, 5 insertions(+), 18 deletions(-) - -Index: Python-3.3.0/setup.py -=================================================================== ---- Python-3.3.0.orig/setup.py -+++ Python-3.3.0/setup.py -@@ -447,10 +447,8 @@ - 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') -- # only change this for cross builds for 3.3, issues on Mageia -- if cross_compiling: - self.add_gcc_paths() -- self.add_multiarch_paths() -+ self.add_multiarch_paths() - - # Add paths specified in the environment variables LDFLAGS and - # CPPFLAGS for header and library files. -@@ -458,10 +456,7 @@ - # directly since an inconsistently reproducible issue comes up where - # the environment variable is not set even though the value were passed - # into configure and stored in the Makefile (issue found on OS X 10.3). -- for env_var, arg_name, dir_list in ( -- ('LDFLAGS', '-R', self.compiler.runtime_library_dirs), -- ('LDFLAGS', '-L', self.compiler.library_dirs), -- ('CPPFLAGS', '-I', self.compiler.include_dirs)): -+ for env_var, arg_name, dir_list in (): - env_val = sysconfig.get_config_var(env_var) - if env_val: - # To prevent optparse from raising an exception about any -@@ -486,17 +481,6 @@ - for directory in reversed(options.dirs): - add_dir_to_list(dir_list, directory) - -- if os.path.normpath(sys.base_prefix) != '/usr' \ -- and not sysconfig.get_config_var('PYTHONFRAMEWORK'): -- # 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 -- # the one that is currently installed (issue #7473) -- add_dir_to_list(self.compiler.library_dirs, -- sysconfig.get_config_var("LIBDIR")) -- add_dir_to_list(self.compiler.include_dirs, -- sysconfig.get_config_var("INCLUDEDIR")) -- - # lib_dirs and inc_dirs are used to search for files; - # if a file is found in one of those directories, it can - # be assumed that no additional -I,-L directives are needed. -@@ -506,6 +490,9 @@ - '/lib', '/usr/lib', - ] - inc_dirs = self.compiler.include_dirs + ['/usr/include'] -+ else: -+ lib_dirs = self.compiler.library_dirs -+ inc_dirs = self.compiler.include_dirs - exts = [] - missing = [] - diff --git a/package/python3/python3-3.3-003-staging-header-libs.patch b/package/python3/python3-3.3-003-staging-header-libs.patch deleted file mode 100644 index b0efe29614..0000000000 --- a/package/python3/python3-3.3-003-staging-header-libs.patch +++ /dev/null @@ -1,41 +0,0 @@ -Tell setup.py the location of headers/libraries - -Allow the libraries detection routine to look for headers and libs in -other directories than /usr/include or /usr/lib through the -environment variables PYTHON_MODULES_INCLUDE and PYTHON_MODULES_LIB. - -We can then use it to look for libraries in the buildroot staging -directory. - -Ported to python3.3 by Maxime Ripard based -on the work by Thomas Petazzoni - -Signed-off-by: Maxime Ripard ---- - setup.py | 13 +++++++++++++ - 1 file changed, 13 insertions(+) - -Index: Python-3.3.0/setup.py -=================================================================== ---- Python-3.3.0.orig/setup.py -+++ Python-3.3.0/setup.py -@@ -441,6 +441,19 @@ - os.unlink(tmpfile) - - def detect_modules(self): -+ try: -+ modules_include_dirs = os.environ["PYTHON_MODULES_INCLUDE"].split() -+ except KeyError: -+ modules_include_dirs = ['/usr/include'] -+ try: -+ modules_lib_dirs = os.environ["PYTHON_MODULES_LIB"].split() -+ except KeyError: -+ modules_lib_dirs = ['/usr/lib'] -+ for dir in modules_include_dirs: -+ add_dir_to_list(self.compiler.include_dirs, dir) -+ for dir in modules_lib_dirs: -+ add_dir_to_list(self.compiler.library_dirs, dir) -+ - # Ensure that /usr/local is always used, but the local build - # directories (i.e. '.' and 'Include') must be first. See issue - # 10520. diff --git a/package/python3/python3-3.3-004-no-import-when-cross-compiling.patch b/package/python3/python3-3.3-004-no-import-when-cross-compiling.patch deleted file mode 100644 index cd5a437472..0000000000 --- a/package/python3/python3-3.3-004-no-import-when-cross-compiling.patch +++ /dev/null @@ -1,27 +0,0 @@ -Disable import check when cross-compiling - -Once Python has compiled an extension (i.e some C code, potentially -linked to a library), it tries to import it. This cannot work in -cross-compilation mode, so we just disable this check. - -Signed-off-by: Thomas Petazzoni -Signed-off-by: Maxime Ripard ---- - setup.py | 4 ++++ - 1 file changed, 4 insertions(+) - -Index: Python-3.3.0/setup.py -=================================================================== ---- Python-3.3.0.orig/setup.py -+++ Python-3.3.0/setup.py -@@ -318,6 +318,10 @@ - self.announce('WARNING: skipping import check for Cygwin-based "%s"' - % ext.name) - return -+ if os.environ.get('CROSS_COMPILING') == 'yes': -+ self.announce('WARNING: skipping import check for cross compiled "%s"' -+ % ext.name) -+ return - ext_filename = os.path.join( - self.build_lib, - self.get_ext_filename(self.get_ext_fullname(ext.name))) diff --git a/package/python3/python3-3.3-005-do-not-generate-pyo-files.patch b/package/python3/python3-3.3-005-do-not-generate-pyo-files.patch deleted file mode 100644 index 983d546473..0000000000 --- a/package/python3/python3-3.3-005-do-not-generate-pyo-files.patch +++ /dev/null @@ -1,40 +0,0 @@ -Do not generate .pyo files - -By default, the Python installation byte-compiles all modules in two -forms: the normal bytecode (.pyc) and an optimized bytecode (.pyo). - -According to -http://www.network-theory.co.uk/docs/pytut/CompiledPythonfiles.html, -the optimization do not do anything useful, and generating both the -"non-optimized" and "optimized" bytecode variants takes time. - -Signed-off-by: Thomas Petazzoni ---- - Makefile.pre.in | 9 --------- - 1 file changed, 9 deletions(-) - -Index: Python-3.3.0/Makefile.pre.in -=================================================================== ---- Python-3.3.0.orig/Makefile.pre.in -+++ Python-3.3.0/Makefile.pre.in -@@ -1082,20 +1082,11 @@ - -d $(LIBDEST) -f \ - -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 \ -- -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 \ - -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages - -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ -- $(PYTHON_FOR_BUILD) -Wi -O $(DESTDIR)$(LIBDEST)/compileall.py \ -- -d $(LIBDEST)/site-packages -f \ -- -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages -- -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 diff --git a/package/python3/python3-3.3-006-reread-environment.patch b/package/python3/python3-3.3-006-reread-environment.patch deleted file mode 100644 index 752b15a4e2..0000000000 --- a/package/python3/python3-3.3-006-reread-environment.patch +++ /dev/null @@ -1,63 +0,0 @@ -Make sure setup.py reads the correct CONFIG_ARGS - -The setup.py script that builds and installs all the Python modules -shipped with the interpreter looks at the CONFIG_ARGS variable stored -in the "sysconfig" module to look at the ./configure options and -adjust its behaviour accordingly. - -Unfortunately, when cross-compiling, the value of CONFIG_ARGS returned -by the sysconfig are the one passed to the ./configure script of the -*host* Python and not the one we're currently building for the target. - -In order to avoid that, we re-initialize the values in the sysconfig -module by re-reading the environment at the beginning of the setup.py -script, and we make sure that the CONFIG_ARGS variable is actually -part of the environment of setup.py. - -See the beginning of -http://article.gmane.org/gmane.comp.python.devel/99772 for the -inspiration. - -Signed-off-by: Thomas Petazzoni - ---- - Makefile.pre.in | 4 +++- - setup.py | 3 +++ - 2 files changed, 6 insertions(+), 1 deletion(-) - -Index: Python-3.3.0/setup.py -=================================================================== ---- Python-3.3.0.orig/setup.py -+++ Python-3.3.0/setup.py -@@ -30,6 +30,9 @@ - # Were we compiled --with-pydebug or with #define Py_DEBUG? - COMPILED_WITH_PYDEBUG = ('--with-pydebug' in sysconfig.get_config_var("CONFIG_ARGS")) - -+sysconfig.get_config_vars() -+sysconfig._CONFIG_VARS.update(os.environ) -+ - # This global variable is used to hold the list of modules to be disabled. - disabled_module_list = [] - -Index: Python-3.3.0/Makefile.pre.in -=================================================================== ---- Python-3.3.0.orig/Makefile.pre.in -+++ Python-3.3.0/Makefile.pre.in -@@ -478,6 +478,7 @@ - sharedmods: $(BUILDPYTHON) pybuilddir.txt - case $$MAKEFLAGS in *s*) quiet=-q; esac; \ - $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \ -+ CONFIG_ARGS="$(CONFIG_ARGS)" \ - $(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build - - # Build static library -@@ -1183,7 +1184,8 @@ - # Install the dynamically loadable modules - # This goes into $(exec_prefix) - sharedinstall: sharedmods -- $(RUNSHARED) $(PYTHON_FOR_BUILD) $(srcdir)/setup.py install \ -+ $(RUNSHARED) CONFIG_ARGS="$(CONFIG_ARGS)" \ -+ $(PYTHON_FOR_BUILD) $(srcdir)/setup.py install \ - --prefix=$(prefix) \ - --install-scripts=$(BINDIR) \ - --install-platlib=$(DESTSHARED) \ diff --git a/package/python3/python3-3.3-007-change-pyconfig-h-location.patch b/package/python3/python3-3.3-007-change-pyconfig-h-location.patch deleted file mode 100644 index 8d45daef4d..0000000000 --- a/package/python3/python3-3.3-007-change-pyconfig-h-location.patch +++ /dev/null @@ -1,76 +0,0 @@ -Change the location of pyconfig.h - -The Python interpreter has a really strange behaviour: at *runtime*, -it reads a Makefile and a header file named pyconfig.h to get some -information about the configuration. - -The Makefile is located in usr/lib/python3.3/config-3.3m, which is fine -since this location is kept on the target. - -However, by default, the pyconfig.h is installed in -usr/include/python3.3m, but we completely remove the usr/include -directory for the target. Since making an exception just for -pyconfig.h is annoying, this patch also installs pyconfig.h to -usr/lib/python3.3/config-3.3m, and modifies the sysconfig module so that it -looks in this location instead of usr/include. - -The pyconfig.h is still kept in usr/include/python3.3m, because it is -needed in the $(STAGING_DIR) when building third-party Python -extensions that contain C code. - -Signed-off-by: Thomas Petazzoni - ---- - Lib/distutils/sysconfig.py | 3 ++- - Lib/sysconfig.py | 2 +- - Makefile.pre.in | 3 ++- - 3 files changed, 5 insertions(+), 3 deletions(-) - -Index: Python-3.3.0/Lib/distutils/sysconfig.py -=================================================================== ---- Python-3.3.0.orig/Lib/distutils/sysconfig.py -+++ Python-3.3.0/Lib/distutils/sysconfig.py -@@ -239,7 +239,8 @@ - else: - inc_dir = _sys_home or project_base - else: -- inc_dir = get_python_inc(plat_specific=1) -+ lib_dir = get_python_lib(plat_specific=1, standard_lib=1) -+ inc_dir = os.path.join(lib_dir, "config") - if get_python_version() < '2.2': - config_h = 'config.h' - else: -Index: Python-3.3.0/Lib/sysconfig.py -=================================================================== ---- Python-3.3.0.orig/Lib/sysconfig.py -+++ Python-3.3.0/Lib/sysconfig.py -@@ -467,7 +467,7 @@ - else: - inc_dir = _sys_home or _PROJECT_BASE - else: -- inc_dir = get_path('platinclude') -+ inc_dir = os.path.join(get_path('stdlib'), "config") - return os.path.join(inc_dir, 'pyconfig.h') - - -Index: Python-3.3.0/Makefile.pre.in -=================================================================== ---- Python-3.3.0.orig/Makefile.pre.in -+++ Python-3.3.0/Makefile.pre.in -@@ -1123,7 +1123,6 @@ - echo $(INSTALL_DATA) $$i $(INCLUDEPY); \ - $(INSTALL_DATA) $$i $(DESTDIR)$(INCLUDEPY); \ - done -- $(INSTALL_DATA) pyconfig.h $(DESTDIR)$(CONFINCLUDEPY)/pyconfig.h - - # Install the library and miscellaneous stuff needed for extending/embedding - # This goes into $(exec_prefix) -@@ -1157,6 +1156,8 @@ - $(INSTALL_DATA) Modules/python.o $(DESTDIR)$(LIBPL)/python.o - $(INSTALL_DATA) $(srcdir)/Modules/config.c.in $(DESTDIR)$(LIBPL)/config.c.in - $(INSTALL_DATA) Makefile $(DESTDIR)$(LIBPL)/Makefile -+ $(INSTALL_DATA) pyconfig.h $(DESTDIR)$(LIBPL)/pyconfig.h -+ $(INSTALL_DATA) pyconfig.h $(DESTDIR)$(CONFINCLUDEPY)/pyconfig.h - $(INSTALL_DATA) Modules/Setup $(DESTDIR)$(LIBPL)/Setup - $(INSTALL_DATA) Modules/Setup.local $(DESTDIR)$(LIBPL)/Setup.local - $(INSTALL_DATA) Modules/Setup.config $(DESTDIR)$(LIBPL)/Setup.config diff --git a/package/python3/python3-3.3-008-no-rpath.patch b/package/python3/python3-3.3-008-no-rpath.patch deleted file mode 100644 index cdeec22ce9..0000000000 --- a/package/python3/python3-3.3-008-no-rpath.patch +++ /dev/null @@ -1,51 +0,0 @@ -Remove runtime library paths - -For some extensions (sqlite and dbm), Python setup.py script -hardcode a runtime path (rpath) into the extension. However, this -runtime path is incorrect (because it points to the location of the -library directory on the development machine) and useless (because on -the target, all useful libraries are in a standard directory searched -by the dynamic loader). For those reasons, we just get rid of the -runtime paths in cross-compilation mode. - -Signed-off-by: Thomas Petazzoni ---- - setup.py | 12 ++++++++++-- - 1 file changed, 10 insertions(+), 2 deletions(-) - -Index: Python-3.3.0/setup.py -=================================================================== ---- Python-3.3.0.orig/setup.py -+++ Python-3.3.0/setup.py -@@ -1134,11 +1134,15 @@ - # can end up with a bad search path order. - if sqlite_incdir not in self.compiler.include_dirs: - include_dirs.append(sqlite_incdir) -+ if cross_compiling: -+ sqlite_runtime_libdir = None -+ else: -+ sqlite_runtime_libdir = sqlite_libdir - exts.append(Extension('_sqlite3', sqlite_srcs, - define_macros=sqlite_defines, - include_dirs=include_dirs, - library_dirs=sqlite_libdir, -- runtime_library_dirs=sqlite_libdir, -+ runtime_library_dirs=sqlite_runtime_libdir, - extra_link_args=sqlite_extra_link_args, - libraries=["sqlite3",])) - else: -@@ -1205,9 +1209,13 @@ - elif cand == "bdb": - if db_incs is not None: - if dbm_setup_debug: print("building dbm using bdb") -+ if cross_compiling: -+ dblib_runtime_libdir = None -+ else: -+ dblib_runtime_libdir = dblib_dir - dbmext = Extension('_dbm', ['_dbmmodule.c'], - library_dirs=dblib_dir, -- runtime_library_dirs=dblib_dir, -+ runtime_library_dirs=dblib_runtime_libdir, - include_dirs=db_incs, - define_macros=[ - ('HAVE_BERKDB_H', None), diff --git a/package/python3/python3-3.3-009-verbose-module-build.patch b/package/python3/python3-3.3-009-verbose-module-build.patch deleted file mode 100644 index 60b6d797d3..0000000000 --- a/package/python3/python3-3.3-009-verbose-module-build.patch +++ /dev/null @@ -1,26 +0,0 @@ -Enables verbose output when building modules - -Patch borrowed from OpenBricks. - -Signed-off-by: Thomas Petazzoni - ---- - Makefile.pre.in | 3 +-- - 1 file changed, 1 insertion(+), 2 deletions(-) - -Index: Python-3.3.0/Makefile.pre.in -=================================================================== ---- Python-3.3.0.orig/Makefile.pre.in -+++ Python-3.3.0/Makefile.pre.in -@@ -476,10 +476,9 @@ - - # Build the shared modules - sharedmods: $(BUILDPYTHON) pybuilddir.txt -- case $$MAKEFLAGS in *s*) quiet=-q; esac; \ - $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \ - CONFIG_ARGS="$(CONFIG_ARGS)" \ -- $(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build -+ $(PYTHON_FOR_BUILD) $(srcdir)/setup.py build - - # Build static library - # avoid long command lines, same as LIBRARY_OBJS diff --git a/package/python3/python3-3.3-010-distutils-cross-compilation-support.patch b/package/python3/python3-3.3-010-distutils-cross-compilation-support.patch deleted file mode 100644 index 0a51400bf5..0000000000 --- a/package/python3/python3-3.3-010-distutils-cross-compilation-support.patch +++ /dev/null @@ -1,71 +0,0 @@ -Add some cross-compilation fixes to distutils - -Inspired by work done by Marc Kleine-Budde in -PTXdist. - -Signed-off-by: Thomas Petazzoni ---- - Lib/distutils/sysconfig.py | 17 +++++++++++++---- - configure.ac | 8 +++++++- - 2 files changed, 20 insertions(+), 5 deletions(-) - -Index: Python-3.3.0/Lib/distutils/sysconfig.py -=================================================================== ---- Python-3.3.0.orig/Lib/distutils/sysconfig.py -+++ Python-3.3.0/Lib/distutils/sysconfig.py -@@ -16,15 +16,24 @@ - 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) -+EXECUTABLE_DIRNAME = os.path.dirname(os.path.realpath(sys.executable)) -+if os.environ.get('CROSS_COMPILING') == 'yes': -+ _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')) -+ if '_python_srcdir' in os.environ: -+ EXECUTABLE_DIRNAME = os.path.normpath(os.environ['_python_srcdir']) -+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, - # it'll live in project/PCbuild/amd64. --project_base = os.path.dirname(os.path.abspath(sys.executable)) -+project_base = EXECUTABLE_DIRNAME - if os.name == "nt" and "pcbuild" in project_base[-8:].lower(): - project_base = os.path.abspath(os.path.join(project_base, os.path.pardir)) - # PC/VS7.1 -@@ -98,7 +107,7 @@ - # the build directory may not be the source directory, we - # must use "srcdir" from the makefile to find the "Include" - # directory. -- base = _sys_home or os.path.dirname(os.path.abspath(sys.executable)) -+ base = _sys_home or EXECUTABLE_DIRNAME - if plat_specific: - return base - if _sys_home: -Index: Python-3.3.0/configure.ac -=================================================================== ---- Python-3.3.0.orig/configure.ac -+++ Python-3.3.0/configure.ac -@@ -963,7 +963,13 @@ - fi - - if test "$cross_compiling" = yes; then -- RUNSHARED= -+ RUNSHARED=" \ -+ CROSS_COMPILING=yes \ -+ _python_cross_host=${ac_cv_host} \ -+ _python_sysroot=\"\$(sysroot)\" \ -+ _python_srcdir=\"\$(srcdir)\" \ -+ _python_prefix=\"\$(prefix)\" \ -+ _python_exec_prefix=\"\$(exec_prefix)\"" - fi - - AC_MSG_RESULT($LDLIBRARY) diff --git a/package/python3/python3-3.3-011-cross-compile-getaddrinfo.patch b/package/python3/python3-3.3-011-cross-compile-getaddrinfo.patch deleted file mode 100644 index 33286ce391..0000000000 --- a/package/python3/python3-3.3-011-cross-compile-getaddrinfo.patch +++ /dev/null @@ -1,21 +0,0 @@ -Disable buggy_getaddrinfo configure test when cross-compiling with IPv6 support - -Signed-off-by: Vanya Sergeev - ---- - configure.ac | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -Index: Python-3.3.0/configure.ac -=================================================================== ---- Python-3.3.0.orig/configure.ac -+++ Python-3.3.0/configure.ac -@@ -3204,7 +3204,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 diff --git a/package/python3/python3.mk b/package/python3/python3.mk index 11ffe61b84..39202ff1b7 100644 --- a/package/python3/python3.mk +++ b/package/python3/python3.mk @@ -24,12 +24,8 @@ HOST_PYTHON3_CONF_OPT += \ --disable-codecs-cjk \ --disable-nis \ --disable-unicodedata \ - --disable-dbm \ - --disable-gdbm \ - --disable-bsddb \ --disable-test-modules \ - --disable-bz2 \ - --disable-ssl + --disable-idle3 HOST_PYTHON3_MAKE_ENV = \ PYTHON_MODULES_INCLUDE=$(HOST_DIR)/usr/include \ @@ -62,6 +58,8 @@ endif ifeq ($(BR2_PACKAGE_PYTHON3_CURSES),y) PYTHON3_DEPENDENCIES += ncurses +else +PYTHON3_CONF_OPT += --disable-curses endif ifeq ($(BR2_PACKAGE_PYTHON3_PYEXPAT),y) @@ -77,14 +75,24 @@ endif ifeq ($(BR2_PACKAGE_PYTHON3_SQLITE),y) PYTHON3_DEPENDENCIES += sqlite +else +PYTHON3_CONF_OPT += --disable-sqlite3 endif ifeq ($(BR2_PACKAGE_PYTHON3_SSL),y) -PYTHON_DEPENDENCIES += openssl +PYTHON3_DEPENDENCIES += openssl +endif + +ifneq ($(BR2_PACKAGE_PYTHON3_CODECSCJK),y) +PYTHON3_CONF_OPT += --disable-codecs-cjk +endif + +ifneq ($(BR2_PACKAGE_PYTHON3_UNICODEDATA),y) +PYTHON3_CONF_OPT += --disable-unicodedata endif ifeq ($(BR2_PACKAGE_PYTHON3_BZIP2),y) -PYTHON_DEPENDENCIES += bzip2 +PYTHON3_DEPENDENCIES += bzip2 endif ifeq ($(BR2_PACKAGE_PYTHON3_ZLIB),y) @@ -106,10 +114,9 @@ PYTHON3_CONF_OPT += \ --disable-pydoc \ --disable-test-modules \ --disable-lib2to3 \ - --disable-gdbm \ --disable-tk \ --disable-nis \ - --disable-dbm + --disable-idle3 PYTHON3_MAKE_ENV = \ _PROJECT_BASE=$(PYTHON3_DIR) \