From 416b93e31a09ceb688683024818fe9196d53fb8a Mon Sep 17 00:00:00 2001 From: Jose Tomas Robles Hahn Date: Wed, 8 Jan 2025 18:21:33 -0300 Subject: [PATCH] chore: Improve Make tasks `clean-build`, `clean-pyc`, and `clean-test` This commit includes changes to the `Makefile` to improve the consistency and maintainability of the clean commands by using the `RM` variable instead of hardcoding the `rm` command. The most important changes include updates to the `clean-build`, `clean-pyc`, and `clean-test` targets. Improvements to clean commands: - `clean-build`: Replaced hardcoded `rm` commands with `${RM}` variable and adjusted `find` commands to use `-iname` for case-insensitive matching and `-prune` for directory handling. - `clean-pyc`: Simplified `find` commands by using `-delete` for file removal and `${RM}` variable for consistency. - `clean-test`: Replaced hardcoded `rm` commands with `${RM}` variable for consistency. --- Makefile | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/Makefile b/Makefile index 14542897..a753ff71 100644 --- a/Makefile +++ b/Makefile @@ -45,25 +45,24 @@ help: clean: clean-build clean-pyc clean-test ## remove all build, test, lint, coverage and Python artifacts clean-build: ## remove build artifacts - rm -rf .eggs/ - rm -rf build/ - rm -rf dist/ - find . -name '*.egg-info' -exec rm -rf {} + - find . -name '*.egg' -exec rm -f {} + + ${RM} -r .eggs/ + ${RM} -r build/ + ${RM} -r dist/ + find . -iname '*.egg-info' -type d -prune -exec ${RM} -r {} \; + find . -iname '*.egg' -prune -exec ${RM} -r {} \; clean-pyc: ## remove Python file artifacts - find . -name '*.pyc' -exec rm -f {} + - find . -name '*.pyo' -exec rm -f {} + - find . -name '*~' -exec rm -f {} + - find . -name '__pycache__' -exec rm -rf {} + + find . -iname '*.py[cod]' -delete + find . -iname '*~' -exec ${RM} {} + + find . -iname __pycache__ -type d -prune -exec ${RM} -r {} \; clean-test: ## remove test, lint and coverage artifacts - rm -rf .cache/ - rm -rf .tox/ - rm -f .coverage - rm -rf htmlcov/ - rm -rf test-reports/ - rm -rf .mypy_cache/ + ${RM} -r .cache/ + ${RM} -r .tox/ + ${RM} .coverage + ${RM} -r htmlcov/ + ${RM} -r test-reports/ + ${RM} -r .mypy_cache/ install-dev: install-deps-dev install-dev: ## Install for development