python3: Handle properly the pyc and py files on the target
authorMaxime Ripard <maxime.ripard@free-electrons.com>
Fri, 18 Jan 2013 04:06:14 +0000 (04:06 +0000)
committerPeter Korsgaard <jacmet@sunsite.dk>
Sun, 20 Jan 2013 20:37:40 +0000 (21:37 +0100)
Fixes #5690

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Samuel Martin <s.martin49@gmail.com>
Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
package/python3/python3.mk

index 0d54162e8563037910d0fac1b58d06f68931af17..e7c09837ef2b2bb47916f175bac9feb46edd50f6 100644 (file)
@@ -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))