python3-setuptools,python3-pip: Use more predictable pycache cleanup
authorJeffery To <redacted>
Wed, 29 May 2019 14:42:02 +0000 (22:42 +0800)
committerJeffery To <redacted>
Wed, 29 May 2019 14:42:02 +0000 (22:42 +0800)
This uses two find commands to delete __pycache__ contents then the
__pycache__ directories, rather than a for loop.

The second command omits a -empty test, so that if the first command
doesn't remove all directory contents for some reason, the second
command will return an error (find will not delete a non-empty
directory).

Signed-off-by: Jeffery To <redacted>
lang/python/python3/files/python3-package-pip.mk
lang/python/python3/files/python3-package-setuptools.mk

index 33f30abfa660a9564c6457d21c78f6695d19bfcf..a27d40a4e504dae7535afaa5bc504ab0106675e4 100644 (file)
@@ -22,10 +22,8 @@ define Py3Package/python3-pip/install
                $(PKG_BUILD_DIR)/install-pip/usr/lib/python$(PYTHON3_VERSION)/site-packages/pip \
                $(PKG_BUILD_DIR)/install-pip/usr/lib/python$(PYTHON3_VERSION)/site-packages/pip-$(PYTHON3_PIP_VERSION).dist-info \
                $(1)/usr/lib/python$(PYTHON3_VERSION)/site-packages/
-       for _ in \$(seq 1 10) ; do \
-               find $(1)/usr/lib/python$(PYTHON3_VERSION)/site-packages/ -name __pycache__ -exec rm -rf {} \; || continue ; \
-               break ; \
-       done
+       find $(1)/usr/lib/python$(PYTHON3_VERSION)/site-packages/ -path '*/__pycache__/*' -delete
+       find $(1)/usr/lib/python$(PYTHON3_VERSION)/site-packages/ -type d -name __pycache__ -delete
 endef
 
 $(eval $(call Py3BasePackage,python3-pip, \
index ead95100681a35829e2bd7ed84eb28de992b8441..b3ccce895c4df483b7c410b6c354e24c9b45f98a 100644 (file)
@@ -25,10 +25,8 @@ define Py3Package/python3-setuptools/install
                $(PKG_BUILD_DIR)/install-setuptools/usr/lib/python$(PYTHON3_VERSION)/site-packages/setuptools-$(PYTHON3_SETUPTOOLS_VERSION).dist-info \
                $(PKG_BUILD_DIR)/install-setuptools/usr/lib/python$(PYTHON3_VERSION)/site-packages/easy_install.py \
                $(1)/usr/lib/python$(PYTHON3_VERSION)/site-packages
-       for _ in \$(seq 1 10) ; do \
-               find $(1)/usr/lib/python$(PYTHON3_VERSION)/site-packages/ -name __pycache__ -exec rm -rf {} \; || continue ; \
-               break ; \
-       done
+       find $(1)/usr/lib/python$(PYTHON3_VERSION)/site-packages/ -path '*/__pycache__/*' -delete
+       find $(1)/usr/lib/python$(PYTHON3_VERSION)/site-packages/ -type d -name __pycache__ -delete
 endef
 
 $(eval $(call Py3BasePackage,python3-setuptools, \
git clone https://git.99rst.org/PROJECT