mirror of
https://github.com/godotengine/buildroot.git
synced 2026-01-01 13:49:03 +03:00
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>
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user