From patchwork Sun Jan 27 22:42:55 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: Fix PYC-only installation for Python3 X-Patchwork-Submitter: Arnout Vandecappelle X-Patchwork-Id: 216076 Message-Id: <5105AD6F.4070105@mind.be> To: Daniel Nelson Cc: buildroot@busybox.net Date: Sun, 27 Jan 2013 23:42:55 +0100 From: Arnout Vandecappelle List-Id: Discussion and development of buildroot On 27/01/13 20:03, Daniel Nelson wrote: > All, > > This is my first buildroot/open source submission. I'd appreciate some feedback. > > Python3 changes the behavior of .pyc caching, breaking the PYC-only option in buildroot. The details are inhttp://www.python.org/dev/peps/pep-3147 > > I've added a configure flag to Python3, and corresponding logic in buildroot. Hasn't this been fixed in git 6ffab129 ? Regards, Arnout commit 6ffab129a3ebc76caf7ae40caf1f6b0185f3e114 Author: Maxime Ripard Date: Fri Jan 18 04:06:14 2013 +0000 python3: Handle properly the pyc and py files on the target Fixes #5690 Signed-off-by: Maxime Ripard Acked-by: Samuel Martin Signed-off-by: Peter Korsgaard diff --git a/package/python3/python3.mk b/package/python3/python3.mk index 0d54162..e7c0983 100644 --- a/package/python3/python3.mk +++ b/package/python3/python3.mk @@ -155,5 +155,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))