Patchwork [3/3] python3: Handle properly the pyc and py files on the target

login
register
mail settings
Submitter Maxime Ripard
Date Jan. 18, 2013, 2:06 p.m.
Message ID <1358517974-30956-3-git-send-email-maxime.ripard@free-electrons.com>
Download mbox | patch
Permalink /patch/213614/
State Accepted
Commit 6ffab129a3ebc76caf7ae40caf1f6b0185f3e114
Headers show

Comments

Maxime Ripard - Jan. 18, 2013, 2:06 p.m.
Fixes #5690

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
---
 package/python3/python3.mk |   22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
Samuel Martin - Jan. 19, 2013, 2:52 p.m.
Hi Maxime, all,

2013/1/18 Maxime Ripard <maxime.ripard@free-electrons.com>:
> Fixes #5690
>
> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Samuel Martin <s.martin49@gmail.com>

Regards,
Peter Korsgaard - Jan. 20, 2013, 8:38 p.m.
>>>>> "Maxime" == Maxime Ripard <maxime.ripard@free-electrons.com> writes:

 Maxime> Fixes #5690
 Maxime> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>

Committed, thanks.

Patch

diff --git a/package/python3/python3.mk b/package/python3/python3.mk
index c7e70f6..f62ed43 100644
--- a/package/python3/python3.mk
+++ b/package/python3/python3.mk
@@ -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))