Skip to content

Commit

Permalink
Add default target and remove configurable venv paths
Browse files Browse the repository at this point in the history
Signed-off-by: Jose R. Gonzalez <komish@flutes.dev>
  • Loading branch information
komish committed Oct 12, 2023
1 parent 1629bd1 commit a207421
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions scripts/Makefile
Original file line number Diff line number Diff line change
@@ -1,21 +1,32 @@
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
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 \
Expand All @@ -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
./$(VENV_TOOLS_BIN)/python setup.py install

0 comments on commit a207421

Please sign in to comment.