backup-tool/Makefile

51 lines
1.0 KiB
Makefile

# =====CONFIG=====
PYTHON := python3.6
VENV := .venv
# =====RECIPES=====
# Create the virtual environment
$(VENV)/bin/activate: setup.py
'$(PYTHON)' -m venv '$(VENV)'
'$(VENV)/bin/pip' install -e .[develop]
venv: $(VENV)/bin/activate
.PHONY: venv
# Format the codebase using Black
format: venv
@ '$(VENV)/bin/black' setup.py app
.PHONY: format
# Remove any temporary files
clean:
@ rm -rf '$(VENV)' .tox backup_tool
.PHONY: clean
# Pack the package into a zipfile
backup_tool:
@ cd app && \
zip -r ../app.zip * \
-x "__pycache__/*" "**/__pycache__/*" ".vim/*" "**/.vim/*"
@ echo "#!/usr/bin/env python3" | cat - app.zip > backup_tool
@ chmod a+x backup_tool
@ rm app.zip
app: backup_tool
.PHONY: app
# Install the app
install: app
cp backup_tool /usr/local/bin
.PHONY: install
# We can't force the develop to have all the versions locally, so
# the local tests only include python3.6
test: venv tox.ini
@ '$(VENV)/bin/tox' -e py36
.PHONY: test
lint: venv
@ '$(VENV)/bin/tox' -e lint
.PHONY: lint