]> rtime.felk.cvut.cz Git - coffee/buildroot.git/commitdiff
python, python3: convert py/pyc removal to TARGET_FINALIZE_HOOKS
authorThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Tue, 30 Sep 2014 21:39:01 +0000 (23:39 +0200)
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Sun, 5 Oct 2014 12:32:41 +0000 (14:32 +0200)
Since the removal of py/pyc files is Python-specific, this commit
moves the logic removing those files to python.mk and python3.mk
respectively.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Makefile
package/python/python.mk
package/python3/python3.mk

index 53f8ad59922f888bdc373c374bcf4aa55ab556cd..6068e7f901afe8f3dd6d63bd2ee9f45ca75bc838 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -573,12 +573,6 @@ endif
        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
-ifeq ($(BR2_PACKAGE_PYTHON_PY_ONLY)$(BR2_PACKAGE_PYTHON3_PY_ONLY),y)
-       find $(TARGET_DIR)/usr/lib/ -name '*.pyc' -print0 | xargs -0 rm -f
-endif
-ifeq ($(BR2_PACKAGE_PYTHON_PYC_ONLY)$(BR2_PACKAGE_PYTHON3_PYC_ONLY),y)
-       find $(TARGET_DIR)/usr/lib/ -name '*.py' -print0 | xargs -0 rm -f
-endif
        $(STRIP_FIND_CMD) | xargs $(STRIPCMD) 2>/dev/null || true
        if test -d $(TARGET_DIR)/lib/modules; then \
                find $(TARGET_DIR)/lib/modules -type f -name '*.ko' | \
index f9968ca89579aa98972ef7f103a23784af8d618b..24367a375caebd99ed345e55fa4adaf759602e32 100644 (file)
@@ -208,3 +208,17 @@ PYTHON_PATH = $(TARGET_DIR)/usr/lib/python$(PYTHON_VERSION_MAJOR)/sysconfigdata/
 
 $(eval $(autotools-package))
 $(eval $(host-autotools-package))
+
+ifeq ($(BR2_PACKAGE_PYTHON_PYC_ONLY),y)
+define PYTHON_FINALIZE_TARGET
+       find $(TARGET_DIR)/usr/lib/python$(PYTHON_VERSION_MAJOR) -name '*.py' -print0 | xargs -0 rm -f
+endef
+endif
+
+ifeq ($(BR2_PACKAGE_PYTHON_PY_ONLY),y)
+define PYTHON_FINALIZE_TARGET
+       find $(TARGET_DIR)/usr/lib/python$(PYTHON_VERSION_MAJOR) -name '*.pyc' -print0 | xargs -0 rm -f
+endef
+endif
+
+TARGET_FINALIZE_HOOKS += PYTHON_FINALIZE_TARGET
index 3b0155079df2422e04a551b47bc8f5550677a700..d952323fbdc9bc59d2b6c6ebf2360d3631441bcb 100644 (file)
@@ -187,3 +187,17 @@ PYTHON3_PATH = $(TARGET_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR)/sysconfigdat
 
 $(eval $(autotools-package))
 $(eval $(host-autotools-package))
+
+ifeq ($(BR2_PACKAGE_PYTHON3_PYC_ONLY),y)
+define PYTHON3_FINALIZE_TARGET
+       find $(TARGET_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR) -name '*.py' -print0 | xargs -0 rm -f
+endef
+endif
+
+ifeq ($(BR2_PACKAGE_PYTHON3_PY_ONLY),y)
+define PYTHON3_FINALIZE_TARGET
+       find $(TARGET_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR) -name '*.pyc' -print0 | xargs -0 rm -f
+endef
+endif
+
+TARGET_FINALIZE_HOOKS += PYTHON3_FINALIZE_TARGET