diff options
author | Thomas Petazzoni <thomas.petazzoni@free-electrons.com> | 2016-05-01 22:15:14 +0200 |
---|---|---|
committer | Thomas Petazzoni <thomas.petazzoni@free-electrons.com> | 2016-05-17 22:47:33 +0200 |
commit | 59972daa39fe90de7c353eaa79834571efb4cd08 (patch) | |
tree | 4847a5c38ef0a835aeb9a001e0d180b54808d1d4 /package/python | |
parent | f76543601ff21af23e2828fcb9b3262378120d78 (diff) |
python: remove *.pyo files
Even though we disable the build of .pyo files in the interpreter,
nothing prevents other packages to install them. Since we only want to
keep either .py or .pyc or both, let's add a target finalize hooks
that removes all .pyo files.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
[Thomas: add --no-run-if-empty option to xargs, as suggested by Samuel.]
Reviewed-by: Samuel Martin <s.martin49@gmail.com>
Diffstat (limited to 'package/python')
-rw-r--r-- | package/python/python.mk | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/package/python/python.mk b/package/python/python.mk index 819d32b9d..c96d21897 100644 --- a/package/python/python.mk +++ b/package/python/python.mk @@ -230,3 +230,11 @@ define PYTHON_REMOVE_PYC_FILES endef TARGET_FINALIZE_HOOKS += PYTHON_REMOVE_PYC_FILES 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 +endef +TARGET_FINALIZE_HOOKS += PYTHON_REMOVE_PYO_FILES +endif |