Skip to contentSkip to conversation

python3: Point /usr/bin/python to python3 if python is not selected

PATCH New Maxime Ripard 4 participants 14 messages Jan 18, 2013 – Jan 23, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 python3: Point /usr/bin/python to python3 if python is not selected

Fixes #5702

---
 package/python3/python3.mk |    7 +++++++
 1 file changed, 7 insertions(+)
package/python3/python3.mk +7 -0
index bcd83ea..0d54162 100644
@@ -148,5 +148,12 @@ PYTHON3_POST_INSTALL_TARGET_HOOKS += PYTHON3_REMOVE_USELESS_FILES
 
 PYTHON3_AUTORECONF = YES
 
+define PYTHON3_INSTALL_SYMLINK
+	ln -fs python3 $(TARGET_DIR)/usr/bin/python
+endef
+
+ifneq ($(BR2_PACKAGE_PYTHON),y)
+PYTHON3_POST_INSTALL_TARGET_HOOKS += PYTHON3_INSTALL_SYMLINK
+endif
 $(eval $(autotools-package))
 $(eval $(host-autotools-package))
Signature · 1 line
1.7.10.4
#1 lore raw

PATCH 2/3 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

---
 package/python3/Config.in                          |   11 ++
 .../python3-3.3-012-disable-extensions.patch       |   98 +++++++++++++++++
 .../python3-3.3-100-optional-test-modules.patch    |  112 ++++++++++++++++++++
 .../python3/python3-3.3-101-optional-pydoc.patch   |   91 ++++++++++++++++
 .../python3/python3-3.3-102-optional-2to3.patch    |   98 +++++++++++++++++
 .../python3/python3-3.3-103-optional-sqlite.patch  |   64 +++++++++++
 package/python3/python3-3.3-104-optional-tk.patch  |   69 ++++++++++++
 .../python3/python3-3.3-105-optional-curses.patch  |   54 ++++++++++
 .../python3/python3-3.3-106-optional-expat.patch   |   85 +++++++++++++++
 .../python3-3.3-107-optional-codecs-cjk.patch      |   25 +++++
 package/python3/python3-3.3-108-optional-nis.patch |   28 +++++
 .../python3-3.3-109-optional-unicodedata.patch     |   25 +++++
 .../python3/python3-3.3-110-optional-idle.patch    |   76 +++++++++++++
 package/python3/python3.mk                         |   25 +++--
 14 files changed, 852 insertions(+), 9 deletions(-)
 create mode 100644 package/python3/python3-3.3-012-disable-extensions.patch
 create mode 100644 package/python3/python3-3.3-100-optional-test-modules.patch
 create mode 100644 package/python3/python3-3.3-101-optional-pydoc.patch
 create mode 100644 package/python3/python3-3.3-102-optional-2to3.patch
 create mode 100644 package/python3/python3-3.3-103-optional-sqlite.patch
 create mode 100644 package/python3/python3-3.3-104-optional-tk.patch
 create mode 100644 package/python3/python3-3.3-105-optional-curses.patch
 create mode 100644 package/python3/python3-3.3-106-optional-expat.patch
 create mode 100644 package/python3/python3-3.3-107-optional-codecs-cjk.patch
 create mode 100644 package/python3/python3-3.3-108-optional-nis.patch
 create mode 100644 package/python3/python3-3.3-109-optional-unicodedata.patch
 create mode 100644 package/python3/python3-3.3-110-optional-idle.patch
package/python3/Config.in +11 -0
index 5959d31..4a70b5e 100644
@@ -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
package/python3/python3-3.3-012-disable-extensions.patch new file +98 -0

98 lines not on this page · raw message

package/python3/python3-3.3-100-optional-test-modules.patch new file +112 -0

112 lines not on this page · raw message

package/python3/python3-3.3-101-optional-pydoc.patch new file +91 -0

91 lines not on this page · raw message

package/python3/python3-3.3-102-optional-2to3.patch new file +98 -0

98 lines not on this page · raw message

package/python3/python3-3.3-103-optional-sqlite.patch new file +64 -0

64 lines not on this page · raw message

package/python3/python3-3.3-104-optional-tk.patch new file +69 -0

69 lines not on this page · raw message

package/python3/python3-3.3-105-optional-curses.patch new file +54 -0

54 lines not on this page · raw message

package/python3/python3-3.3-106-optional-expat.patch new file +85 -0

85 lines not on this page · raw message

package/python3/python3-3.3-107-optional-codecs-cjk.patch new file +25 -0
new file mode 100644
index 0000000..de7f910
@@ -0,0 +1,25 @@
+Add an option to disable CJK codecs
+
+Signed-off-by: Thomas Petazzoni <[email protected]>
+
+---
+ 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]),
package/python3/python3-3.3-108-optional-nis.patch new file +28 -0
new file mode 100644
index 0000000..3c91497
@@ -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 <[email protected]>
+
+---
+ 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]),
package/python3/python3-3.3-109-optional-unicodedata.patch new file +25 -0
new file mode 100644
index 0000000..c75ee27
@@ -0,0 +1,25 @@
+Add an option to disable unicodedata
+
+Signed-off-by: Thomas Petazzoni <[email protected]>
+
+---
+ 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]),
package/python3/python3-3.3-110-optional-idle.patch new file +76 -0

76 lines not on this page · raw message

package/python3/python3.mk +16 -9
index 0d54162..c7e70f6 100644
@@ -23,12 +23,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 \
@@ -61,6 +57,8 @@ endif
 
 ifeq ($(BR2_PACKAGE_PYTHON3_CURSES),y)
 PYTHON3_DEPENDENCIES += ncurses
+else
+PYTHON3_CONF_OPT += --disable-curses
 endif
 
 ifeq ($(BR2_PACKAGE_PYTHON3_PYEXPAT),y)
@@ -72,14 +70,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)
@@ -101,10 +109,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) \
Signature · 1 line
1.7.10.4
#2 lore raw

PATCH 2/3 python3: Port python2 patches to reduce the interpreter size

Hi Maxime, all,

2013/1/18 Maxime Ripard <[email protected]>:

Quoted 42 lines

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

---
 package/python3/Config.in                          |   11 ++
 .../python3-3.3-012-disable-extensions.patch       |   98 +++++++++++++++++
 .../python3-3.3-100-optional-test-modules.patch    |  112 ++++++++++++++++++++
 .../python3/python3-3.3-101-optional-pydoc.patch   |   91 ++++++++++++++++
 .../python3/python3-3.3-102-optional-2to3.patch    |   98 +++++++++++++++++
 .../python3/python3-3.3-103-optional-sqlite.patch  |   64 +++++++++++
 package/python3/python3-3.3-104-optional-tk.patch  |   69 ++++++++++++
 .../python3/python3-3.3-105-optional-curses.patch  |   54 ++++++++++
 .../python3/python3-3.3-106-optional-expat.patch   |   85 +++++++++++++++
 .../python3-3.3-107-optional-codecs-cjk.patch      |   25 +++++
 package/python3/python3-3.3-108-optional-nis.patch |   28 +++++
 .../python3-3.3-109-optional-unicodedata.patch     |   25 +++++
 .../python3/python3-3.3-110-optional-idle.patch    |   76 +++++++++++++
 package/python3/python3.mk                         |   25 +++--
 14 files changed, 852 insertions(+), 9 deletions(-)
 create mode 100644 package/python3/python3-3.3-012-disable-extensions.patch
 create mode 100644 package/python3/python3-3.3-100-optional-test-modules.patch
 create mode 100644 package/python3/python3-3.3-101-optional-pydoc.patch
 create mode 100644 package/python3/python3-3.3-102-optional-2to3.patch
 create mode 100644 package/python3/python3-3.3-103-optional-sqlite.patch
 create mode 100644 package/python3/python3-3.3-104-optional-tk.patch
 create mode 100644 package/python3/python3-3.3-105-optional-curses.patch
 create mode 100644 package/python3/python3-3.3-106-optional-expat.patch
 create mode 100644 package/python3/python3-3.3-107-optional-codecs-cjk.patch
 create mode 100644 package/python3/python3-3.3-108-optional-nis.patch
 create mode 100644 package/python3/python3-3.3-109-optional-unicodedata.patch
 create mode 100644 package/python3/python3-3.3-110-optional-idle.patch

[...]

Quoted 15 lines
package/python3/python3-3.3-100-optional-test-modules.patch new file +9 -0
new file mode 100644
index 0000000..bfe7be2
@@ -0,0 +1,112 @@
+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 <[email protected]>
+Signed-off-by: Samuel Martin <[email protected]>
+
+---

package/python3/python3-3.3-100-optional-test-modules.patch line 19

Quoted 10 lines
package/python3/python3-3.3-100-optional-test-modules.patch new file +10 -0
+
+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 <[email protected]>
+Signed-off-by: Samuel Martin <[email protected]>
+
+---

ahem... duplicated commit message no needed ;-)

[...]

Quoted 59 lines
package/python3/python3-3.3-102-optional-2to3.patch new file +53 -0
new file mode 100644
index 0000000..b47619b
@@ -0,0 +1,98 @@
+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 <[email protected]>
+Signed-off-by: Samuel Martin <[email protected]>
+
+---
+ Makefile.pre.in |   16 ++++++++++++----
+ configure.ac    |    6 ++++++
+ setup.py        |    5 +++--
+ 3 files changed, 21 insertions(+), 6 deletions(-)
+
+Index: cpython/Makefile.pre.in
+===================================================================
+--- cpython.orig/Makefile.pre.in
++++ cpython/Makefile.pre.in
+@@ -953,7 +953,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)
+
+@@ -982,7 +984,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 \
+@@ -1022,9 +1023,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 \
+@@ -1037,6 +1035,16 @@
+ LIBSUBDIRS += pydoc_data
+ endif
+
++ifeq (@LIB2TO3@,yes)
++LIBSUBDIRS += lib2to3 lib2to3/fixes lib2to3/pgen2
++ifeq (@TEST_MODULES@,yes)

package/python3/python3-3.3-102-optional-2to3.patch line 63

Quoted 10 lines
package/python3/python3-3.3-102-optional-2to3.patch new file +10 -0
++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 \

This little patch:
http://code.bulix.org/77k6za-82864
prevents from building some 2to3 stuff when disabled:

-- snip -- PYTHONPATH=/home/samuel/data/workspace/src/buildroot/output/qemu_arm_versatile/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/python3.3
CROSS_COMPILING=yes

	_python_cross_host=arm-buildroot-linux-uclibcgnueabi
		_python_sysroot="" 		_python_srcdir="." 		_python_prefix="/usr"
		_python_exec_prefix="/usr" \
	/home/samuel/data/workspace/src/buildroot/output/qemu_arm_versatile/build/host-python3-3.3.0/python
-Wi /home/samuel/data/workspace/src/buildroot/output/qemu_arm_versatile/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/python3.3/compileall.py
\
	-d /usr/lib/python3.3/site-packages -f \
	-x badsyntax /home/samuel/data/workspace/src/buildroot/output/qemu_arm_versatile/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/python3.3/site-packages
Listing '/home/samuel/data/workspace/src/buildroot/output/qemu_arm_versatile/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/python3.3/site-packages'...
PYTHONPATH=/home/samuel/data/workspace/src/buildroot/output/qemu_arm_versatile/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/python3.3
CROSS_COMPILING=yes
	_python_cross_host=arm-buildroot-linux-uclibcgnueabi
		_python_sysroot="" 		_python_srcdir="." 		_python_prefix="/usr"
		_python_exec_prefix="/usr" \
	/home/samuel/data/workspace/src/buildroot/output/qemu_arm_versatile/build/host-python3-3.3.0/python

-m lib2to3.pgen2.driver /home/samuel/data/workspace/src/buildroot/output/qemu_arm_versatile/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/python3.3/lib2to3/Grammar.txt Generating grammar tables from /home/samuel/data/workspace/src/buildroot/output/qemu_arm_versatile/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/python3.3/lib2to3/Grammar.txt Traceback (most recent call last):
File "/home/samuel/data/workspace/src/buildroot/output/qemu_arm_versatile/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/python3.3/runpy.py",
line 160, in _run_module_as_main

    "__main__", fname, loader, pkg_name)

File "/home/samuel/data/workspace/src/buildroot/output/qemu_arm_versatile/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/python3.3/runpy.py",
line 73, in _run_code
exec(code, run_globals)
File "/home/samuel/data/workspace/src/buildroot/output/qemu_arm_versatile/build/host-python3-3.3.0/Lib/lib2to3/pgen2/driver.py",
line 157, in <module>

    sys.exit(int(not main()))

File "/home/samuel/data/workspace/src/buildroot/output/qemu_arm_versatile/build/host-python3-3.3.0/Lib/lib2to3/pgen2/driver.py",
line 153, in main
load_grammar(gt, save=True, force=True)
File "/home/samuel/data/workspace/src/buildroot/output/qemu_arm_versatile/build/host-python3-3.3.0/Lib/lib2to3/pgen2/driver.py",
line 121, in load_grammar
g = pgen.generate_grammar(gt)
File "/home/samuel/data/workspace/src/buildroot/output/qemu_arm_versatile/build/host-python3-3.3.0/Lib/lib2to3/pgen2/pgen.py",
line 385, in generate_grammar
p = ParserGenerator(filename)
File "/home/samuel/data/workspace/src/buildroot/output/qemu_arm_versatile/build/host-python3-3.3.0/Lib/lib2to3/pgen2/pgen.py",
line 15, in __init__
stream = open(filename)
FileNotFoundError: [Errno 2] No such file or directory:
'/home/samuel/data/workspace/src/buildroot/output/qemu_arm_versatile/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/python3.3/lib2to3/Grammar.txt' make[1]: [libinstall] Error 1 (ignored) PYTHONPATH=/home/samuel/data/workspace/src/buildroot/output/qemu_arm_versatile/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/python3.3 CROSS_COMPILING=yes

	_python_cross_host=arm-buildroot-linux-uclibcgnueabi
		_python_sysroot="" 		_python_srcdir="." 		_python_prefix="/usr"
		_python_exec_prefix="/usr" \
	/home/samuel/data/workspace/src/buildroot/output/qemu_arm_versatile/build/host-python3-3.3.0/python

-m lib2to3.pgen2.driver /home/samuel/data/workspace/src/buildroot/output/qemu_arm_versatile/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/python3.3/lib2to3/PatternGrammar.txt Generating grammar tables from /home/samuel/data/workspace/src/buildroot/output/qemu_arm_versatile/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/python3.3/lib2to3/PatternGrammar.txt Traceback (most recent call last):
File "/home/samuel/data/workspace/src/buildroot/output/qemu_arm_versatile/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/python3.3/runpy.py",
line 160, in _run_module_as_main

    "__main__", fname, loader, pkg_name)

File "/home/samuel/data/workspace/src/buildroot/output/qemu_arm_versatile/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/python3.3/runpy.py",
line 73, in _run_code
exec(code, run_globals)
File "/home/samuel/data/workspace/src/buildroot/output/qemu_arm_versatile/build/host-python3-3.3.0/Lib/lib2to3/pgen2/driver.py",
line 157, in <module>

    sys.exit(int(not main()))

File "/home/samuel/data/workspace/src/buildroot/output/qemu_arm_versatile/build/host-python3-3.3.0/Lib/lib2to3/pgen2/driver.py",
line 153, in main
load_grammar(gt, save=True, force=True)
File "/home/samuel/data/workspace/src/buildroot/output/qemu_arm_versatile/build/host-python3-3.3.0/Lib/lib2to3/pgen2/driver.py",
line 121, in load_grammar
g = pgen.generate_grammar(gt)
File "/home/samuel/data/workspace/src/buildroot/output/qemu_arm_versatile/build/host-python3-3.3.0/Lib/lib2to3/pgen2/pgen.py",
line 385, in generate_grammar
p = ParserGenerator(filename)
File "/home/samuel/data/workspace/src/buildroot/output/qemu_arm_versatile/build/host-python3-3.3.0/Lib/lib2to3/pgen2/pgen.py",
line 15, in __init__
stream = open(filename)
FileNotFoundError: [Errno 2] No such file or directory:
'/home/samuel/data/workspace/src/buildroot/output/qemu_arm_versatile/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/python3.3/lib2to3/PatternGrammar.txt' make[1]: [libinstall] Error 1 (ignored)
make[1]: Leaving directory
`/home/samuel/data/workspace/src/buildroot/output/qemu_arm_versatile/build/python3-3.3.0'
-- snip --

[...]

package/python3/python3-3.3-110-optional-idle.patch line 6

Quoted 12 lines
package/python3/python3-3.3-110-optional-idle.patch new file +6 -0
new file mode 100644
index 0000000..7489653
@@ -0,0 +1,76 @@
+---
+ Makefile.pre.in |    8 +++++++-
+ configure.ac    |    6 ++++++
+ setup.py        |    4 +++-
+ 3 files changed, 16 insertions(+), 2 deletions(-)
+

No commit message nor sob line here. :-(

BTW, here is a build log: http://code.bulix.org/8rjnsp-82865, in which the _decimal module fails to be built.

See near the end of the log, it seems the build script of python3 for the target does some mix up between the host and the target build config of the package :-/

It also fails if this python patch series is not applied.

Regards,

Signature · 1 line
Samuel
#3 lore raw

PATCH 2/3 python3: Port python2 patches to reduce the interpreter size

Hi Maxime, all,

2013/1/19 Samuel Martin <[email protected]>:
[...]

Quoted 7 lines

BTW, here is a build log: http://code.bulix.org/8rjnsp-82865, in which the _decimal module fails to be built.

See near the end of the log, it seems the build script of python3 for the target does some mix up between the host and the target build config of the package :-/

After some investigation, here is a patch fixing the build of the _decimal module:
http://code.bulix.org/p4cp5i-82866

However, source for host-python3 are still used...

Regards,

Signature · 1 line
Samuel
#4 lore raw

PATCH 2/3 python3: Port python2 patches to reduce the interpreter size

Quoted 12 lines · Samuel Martin

Hi Maxime, all,

2013/1/19 Samuel Martin <[email protected]>:
[...]

Quoted 7 lines

BTW, here is a build log: http://code.bulix.org/8rjnsp-82865, in which the _decimal module fails to be built.

See near the end of the log, it seems the build script of python3 for the target does some mix up between the host and the target build config of the package :-/

Quoted 5 lines

After some investigation, here is a patch fixing the build of the _decimal module:
http://code.bulix.org/p4cp5i-82866

However, source for host-python3 are still used...

Maybe this can come as a separate patch, since it's not really related to this bug that was reported?

Thanks,
Maxime

Signature · 4 lines
Maxime Ripard, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#5 lore raw

PATCH 2/3 python3: Port python2 patches to reduce the interpreter size

In reply to Samuel Martin

Hi Samuel,

Quoted 64 lines · Samuel Martin

Hi Maxime, all,

2013/1/18 Maxime Ripard <[email protected]>:

Quoted 42 lines

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

---
 package/python3/Config.in                          |   11 ++
 .../python3-3.3-012-disable-extensions.patch       |   98 +++++++++++++++++
 .../python3-3.3-100-optional-test-modules.patch    |  112 ++++++++++++++++++++
 .../python3/python3-3.3-101-optional-pydoc.patch   |   91 ++++++++++++++++
 .../python3/python3-3.3-102-optional-2to3.patch    |   98 +++++++++++++++++
 .../python3/python3-3.3-103-optional-sqlite.patch  |   64 +++++++++++
 package/python3/python3-3.3-104-optional-tk.patch  |   69 ++++++++++++
 .../python3/python3-3.3-105-optional-curses.patch  |   54 ++++++++++
 .../python3/python3-3.3-106-optional-expat.patch   |   85 +++++++++++++++
 .../python3-3.3-107-optional-codecs-cjk.patch      |   25 +++++
 package/python3/python3-3.3-108-optional-nis.patch |   28 +++++
 .../python3-3.3-109-optional-unicodedata.patch     |   25 +++++
 .../python3/python3-3.3-110-optional-idle.patch    |   76 +++++++++++++
 package/python3/python3.mk                         |   25 +++--
 14 files changed, 852 insertions(+), 9 deletions(-)
 create mode 100644 package/python3/python3-3.3-012-disable-extensions.patch
 create mode 100644 package/python3/python3-3.3-100-optional-test-modules.patch
 create mode 100644 package/python3/python3-3.3-101-optional-pydoc.patch
 create mode 100644 package/python3/python3-3.3-102-optional-2to3.patch
 create mode 100644 package/python3/python3-3.3-103-optional-sqlite.patch
 create mode 100644 package/python3/python3-3.3-104-optional-tk.patch
 create mode 100644 package/python3/python3-3.3-105-optional-curses.patch
 create mode 100644 package/python3/python3-3.3-106-optional-expat.patch
 create mode 100644 package/python3/python3-3.3-107-optional-codecs-cjk.patch
 create mode 100644 package/python3/python3-3.3-108-optional-nis.patch
 create mode 100644 package/python3/python3-3.3-109-optional-unicodedata.patch
 create mode 100644 package/python3/python3-3.3-110-optional-idle.patch

[...]

Quoted 18 lines
package/python3/python3-3.3-100-optional-test-modules.patch new file +12 -0
new file mode 100644
index 0000000..bfe7be2
@@ -0,0 +1,112 @@
+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 <[email protected]>
+Signed-off-by: Samuel Martin <[email protected]>
+
+---
+
+Add an option to disable installation of test modules
+
Quoted 8 lines

package/python3/python3-3.3-100-optional-test-modules.patch line 9

Quoted 7 lines
package/python3/python3-3.3-100-optional-test-modules.patch new file +7 -0
+The Python standard distribution comes with many test modules, that
+are not necessarly useful on embedded targets.
+
+Signed-off-by: Thomas Petazzoni <[email protected]>
+Signed-off-by: Samuel Martin <[email protected]>
+
+---

ahem... duplicated commit message no needed ;-)

Oops :)

Quoted 3 lines

This little patch:
http://code.bulix.org/77k6za-82864
prevents from building some 2to3 stuff when disabled:

Ah yes, sorry. Are you ok with me merging this patch with the one I submitted?

Quoted 5 lines
Quoted 5 lines
package/python3/python3-3.3-110-optional-idle.patch new file +0 -0
new file mode 100644
index 0000000..7489653
Quoted 8 lines

package/python3/python3-3.3-110-optional-idle.patch line 6

Quoted 7 lines
package/python3/python3-3.3-110-optional-idle.patch new file +6 -0
@@ -0,0 +1,76 @@
+---
+ Makefile.pre.in |    8 +++++++-
+ configure.ac    |    6 ++++++
+ setup.py        |    4 +++-
+ 3 files changed, 16 insertions(+), 2 deletions(-)
+

No commit message nor sob line here. :-(

Erf, forgot it obviously, sorry...

Thanks!
Maxime

Signature · 4 lines
Maxime Ripard, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#6 lore raw

PATCH 2/3 python3: Port python2 patches to reduce the interpreter size

2013/1/23 Maxime Ripard <[email protected]>:

Quoted 4 lines

Hi Samuel,

Quoted 1 line · Samuel Martin

Hi Maxime, all,

[...]

Quoted 6 lines
Quoted 3 lines

This little patch:
http://code.bulix.org/77k6za-82864
prevents from building some 2to3 stuff when disabled:

Ah yes, sorry. Are you ok with me merging this patch with the one I submitted?

of course!

Regards,

Signature · 1 line
Samuel
#7 lore raw

PATCH 2/3 python3: Port python2 patches to reduce the interpreter size

In reply to Maxime Ripard
Quoted 10 lines · Maxime Ripard

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.

Quoted 6 lines

Fixes #5696

---
  package/python3/Config.in                          |   11 ++
  .../python3-3.3-012-disable-extensions.patch       |   98 +++++++++++++++++

You should remove the -3.3- from the patch names. I know they're there
in the old package, but this is a good opportunity to get rid of that legacy.

BTW, do these patches have a chance of getting upstreamed?

Regards,
Arnout

Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
#8 lore raw

PATCH 2/3 python3: Port python2 patches to reduce the interpreter size

Hi Arnout,

Quoted 19 lines · Arnout Vandecappelle
Quoted 10 lines · Maxime Ripard

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.

Quoted 7 lines

Fixes #5696

---
  package/python3/Config.in                          |   11 ++
  .../python3-3.3-012-disable-extensions.patch       |   98

+++++++++++++++++

Quoted 3 lines

You should remove the -3.3- from the patch names. I know they're there
in the old package, but this is a good opportunity to get rid of that legacy.

Right. Will do.

Quoted 1 line

BTW, do these patches have a chance of getting upstreamed?

I don't think so, since most of them breaks (on purpose) the python standard modules...

Maxime

Signature · 4 lines
Maxime Ripard, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#9 lore raw

PATCH 3/3 python3: Handle properly the pyc and py files on the target

In reply to Maxime Ripard

Fixes #5690

---
 package/python3/python3.mk |   22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
package/python3/python3.mk +22 -0
index c7e70f6..f62ed43 100644
@@ -162,5 +162,27 @@ endef
 ifneq ($(BR2_PACKAGE_PYTHON),y)
 PYTHON3_POST_INSTALL_TARGET_HOOKS += PYTHON3_INSTALL_SYMLINK
 endif
+
+ifeq ($(BR2_PACKAGE_PYTHON3_PY_ONLY),y)
+define PYTHON3_REMOVE_MODULES_FILES
+	for i in `find $(TARGET_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR) \
+		 -name __pycache__` ; do \
+		rm -rf $$i ; \
+	done
+endef
+endif
+
+ifeq ($(BR2_PACKAGE_PYTHON3_PYC_ONLY),y)
+define PYTHON3_REMOVE_MODULES_FILES
+	for i in `find $(TARGET_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR) \
+		 -name *.py` ; do \
+		rm -f $$i ; \
+	done
+endef
+endif
+
+PYTHON3_POST_INSTALL_TARGET_HOOKS += PYTHON3_REMOVE_MODULES_FILES
+
+
 $(eval $(autotools-package))
 $(eval $(host-autotools-package))
Signature · 1 line
1.7.10.4