From a20742104dcd1e42cc9c5776cdcd1bfb462519d0 Mon Sep 17 00:00:00 2001 From: "Jose R. Gonzalez" Date: Thu, 12 Oct 2023 15:34:23 -0500 Subject: [PATCH] Add default target and remove configurable venv paths Signed-off-by: Jose R. Gonzalez --- scripts/Makefile | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/scripts/Makefile b/scripts/Makefile index b280f647..eed6497c 100644 --- a/scripts/Makefile +++ b/scripts/Makefile @@ -1,14 +1,19 @@ PY_BIN ?= python3 -VENV_CODESTYLE ?= venv.codestyle +# The virtualenv containing code style tools. +VENV_CODESTYLE = venv.codestyle VENV_CODESTYLE_BIN = $(VENV_CODESTYLE)/bin -VENV_TOOLS ?= venv.tools +# The virtualenv containing our CI scripts +VENV_TOOLS = venv.tools VENV_TOOLS_BIN = $(VENV_TOOLS)/bin # This is what we pass to git ls-files. LS_FILES_INPUT_STR ?= 'src/*.py' +.PHONY: default +default: format lint + # The same as format, but will throw a non-zero exit code # if the formatter had to make changes. .PHONY: ci.format @@ -16,6 +21,12 @@ ci.format: format git diff --exit-code venv.codestyle: + $(MAKE) venv.codestyle.always-reinstall + +# This target will always install the codestyle venv. +# Useful for development cases. +.PHONY: venv.codestyle.always-reinstall +venv.codestyle.always-reinstall: $(PY_BIN) -m venv $(VENV_CODESTYLE) ./$(VENV_CODESTYLE_BIN)/pip install --upgrade \ black \ @@ -34,6 +45,12 @@ lint: venv.codestyle $$(git ls-files $(LS_FILES_INPUT_STR)) venv.tools: + $(MAKE) venv.tools.always-reinstall + +# This target will always install the tools at the venv. +# Useful for development cases. +.PHONY: venv.tools.always-reinstall +venv.tools.always-reinstall: $(PY_BIN) -m venv $(VENV_TOOLS) ./$(VENV_TOOLS_BIN)/pip install -r requirements.txt - ./$(VENV_TOOLS_BIN)/python setup.py install \ No newline at end of file + ./$(VENV_TOOLS_BIN)/python setup.py install