From f06f58f8fd443968942e100e3c70a29248b2f368 Mon Sep 17 00:00:00 2001 From: Thomas Petazzoni Date: Tue, 17 May 2016 23:19:13 +0200 Subject: python/python3: use --no-run-if-empty xargs option As suggested by Samuel Martin, this commit adds the option --no-run-if-empty xargs option to the "find ... | xargs ..." logic used in the python and python3 target-finalize hooks to remove py/pyc/pyo files. This ensures that the command doesn't fail if there are no files matching the pattern. Signed-off-by: Thomas Petazzoni Reviewed-by: Samuel Martin Signed-off-by: Thomas Petazzoni --- package/python3/python3.mk | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'package/python3/python3.mk') diff --git a/package/python3/python3.mk b/package/python3/python3.mk index fddbf1bf49..3089c03b7b 100644 --- a/package/python3/python3.mk +++ b/package/python3/python3.mk @@ -214,14 +214,16 @@ $(eval $(host-autotools-package)) ifeq ($(BR2_PACKAGE_PYTHON3_PYC_ONLY),y) define PYTHON3_REMOVE_PY_FILES - find $(TARGET_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR) -name '*.py' -print0 | xargs -0 rm -f + find $(TARGET_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR) -name '*.py' -print0 | \ + xargs -0 --no-run-if-empty rm -f endef TARGET_FINALIZE_HOOKS += PYTHON3_REMOVE_PY_FILES endif ifeq ($(BR2_PACKAGE_PYTHON3_PY_ONLY),y) define PYTHON3_REMOVE_PYC_FILES - find $(TARGET_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR) -name '*.pyc' -print0 | xargs -0 rm -f + find $(TARGET_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR) -name '*.pyc' -print0 | \ + xargs -0 --no-run-if-empty rm -f endef TARGET_FINALIZE_HOOKS += PYTHON3_REMOVE_PYC_FILES endif @@ -231,7 +233,8 @@ endif # variant. ifeq ($(BR2_PACKAGE_PYTHON3),y) define PYTHON3_REMOVE_OPTIMIZED_PYC_FILES - find $(TARGET_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR) -name '*.opt-1.pyc' -print0 -o -name '*.opt-2.pyc' -print0 | xargs -0 rm -f + find $(TARGET_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR) -name '*.opt-1.pyc' -print0 -o -name '*.opt-2.pyc' -print0 | \ + xargs -0 --no-run-if-empty rm -f endef TARGET_FINALIZE_HOOKS += PYTHON3_REMOVE_OPTIMIZED_PYC_FILES endif -- cgit v1.2.3