Remove .py or .pyc depending on Python configuration
authorThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Tue, 11 Jan 2011 20:44:29 +0000 (21:44 +0100)
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Tue, 25 Jan 2011 07:59:57 +0000 (08:59 +0100)
We do this at a global level since several packages can install
Python modules.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Makefile

index cf2a7dcf6a15853d89900d878d796c4bc100e794..a5a37a1eecc663a43a3f4ba5cf39fd2345c081f4 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -437,6 +437,12 @@ ifneq ($(BR2_HAVE_DOCUMENTATION),y)
        rm -rf $(TARGET_DIR)/usr/doc $(TARGET_DIR)/usr/share/doc
        rm -rf $(TARGET_DIR)/usr/share/gtk-doc
        -rmdir $(TARGET_DIR)/usr/share 2>/dev/null
+endif
+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
        find $(TARGET_DIR) -type f -perm +111 '!' -name 'libthread_db*.so*' | \
                xargs $(STRIPCMD) 2>/dev/null || true