[Buildroot] [PATCH 08/10] Remove .py or .pyc depending on Python configuration

Thomas Petazzoni thomas.petazzoni at free-electrons.com
Mon Jan 24 11:01:36 UTC 2011


We do this at a global level since several packages can install
Python modules.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni at free-electrons.com>
---
 Makefile |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/Makefile b/Makefile
index 7e08cf3..1f37a1f 100644
--- a/Makefile
+++ b/Makefile
@@ -438,6 +438,14 @@ ifneq ($(BR2_HAVE_DOCUMENTATION),y)
 	rm -rf $(TARGET_DIR)/usr/share/gtk-doc
 	-rmdir $(TARGET_DIR)/usr/share 2>/dev/null
 endif
+ifeq ($(BR2_PACKAGE_PYTHON),y)
+ifeq ($(BR2_PACKAGE_PYTHON_PY_ONLY),y)
+	find $(TARGET_DIR)/usr/lib/ -name '*.pyc' -print0 | xargs -0 rm -f
+endif
+ifeq ($(BR2_PACKAGE_PYTHON_PYC_ONLY),y)
+	find $(TARGET_DIR)/usr/lib/ -name '*.py' -print0 | xargs -0 rm -f
+endif
+endif
 	find $(TARGET_DIR) -type f -perm +111 '!' -name 'libthread_db*.so*' | \
 		xargs $(STRIPCMD) 2>/dev/null || true
 	find $(TARGET_DIR)/lib/modules -type f -name '*.ko' | \
-- 
1.7.0.4



More information about the buildroot mailing list