summaryrefslogtreecommitdiffstats
path: root/package/python/python.mk
diff options
context:
space:
mode:
authorThomas Petazzoni <thomas.petazzoni@free-electrons.com>2016-05-17 23:19:13 +0200
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>2016-05-26 22:07:11 +0200
commitf06f58f8fd443968942e100e3c70a29248b2f368 (patch)
tree081650694c71eec144e6431b85d576b24feff434 /package/python/python.mk
parent7c7fe54ec2a3247f0e3a8fb8080dde06691c8fc9 (diff)
downloadbuildroot-f06f58f8fd443968942e100e3c70a29248b2f368.tar.gz
buildroot-f06f58f8fd443968942e100e3c70a29248b2f368.zip
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 <thomas.petazzoni@free-electrons.com> Reviewed-by: Samuel Martin <s.martin49@gmail.com> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Diffstat (limited to 'package/python/python.mk')
-rw-r--r--package/python/python.mk9
1 files changed, 6 insertions, 3 deletions
diff --git a/package/python/python.mk b/package/python/python.mk
index c96d21897e..4e927660a8 100644
--- a/package/python/python.mk
+++ b/package/python/python.mk
@@ -219,14 +219,16 @@ $(eval $(host-autotools-package))
ifeq ($(BR2_PACKAGE_PYTHON_PYC_ONLY),y)
define PYTHON_REMOVE_PY_FILES
- find $(TARGET_DIR)/usr/lib/python$(PYTHON_VERSION_MAJOR) -name '*.py' -print0 | xargs -0 rm -f
+ find $(TARGET_DIR)/usr/lib/python$(PYTHON_VERSION_MAJOR) -name '*.py' -print0 | \
+ xargs -0 --no-run-if-empty rm -f
endef
TARGET_FINALIZE_HOOKS += PYTHON_REMOVE_PY_FILES
endif
ifeq ($(BR2_PACKAGE_PYTHON_PY_ONLY),y)
define PYTHON_REMOVE_PYC_FILES
- find $(TARGET_DIR)/usr/lib/python$(PYTHON_VERSION_MAJOR) -name '*.pyc' -print0 | xargs -0 rm -f
+ find $(TARGET_DIR)/usr/lib/python$(PYTHON_VERSION_MAJOR) -name '*.pyc' -print0 | \
+ xargs -0 --no-run-if-empty rm -f
endef
TARGET_FINALIZE_HOOKS += PYTHON_REMOVE_PYC_FILES
endif
@@ -234,7 +236,8 @@ endif
# In all cases, we don't want to keep the optimized .pyo files
ifeq ($(BR2_PACKAGE_PYTHON),y)
define PYTHON_REMOVE_PYO_FILES
- find $(TARGET_DIR)/usr/lib/python$(PYTHON_VERSION_MAJOR) -name '*.pyo' -print0 | xargs -0 --no-run-if-empty rm -f
+ find $(TARGET_DIR)/usr/lib/python$(PYTHON_VERSION_MAJOR) -name '*.pyo' -print0 | \
+ xargs -0 --no-run-if-empty rm -f
endef
TARGET_FINALIZE_HOOKS += PYTHON_REMOVE_PYO_FILES
endif
OpenPOWER on IntegriCloud