backup-tool/Makefile

51 lines
1.0 KiB
Makefile
Raw Permalink Normal View History

2021-01-15 14:14:13 +01:00
# =====CONFIG=====
2021-04-28 16:19:53 +02:00
PYTHON := python3.6
VENV := .venv
2021-01-15 14:14:13 +01:00
# =====RECIPES=====
2021-04-28 16:19:53 +02:00
# Create the virtual environment
$(VENV)/bin/activate: setup.py
'$(PYTHON)' -m venv '$(VENV)'
'$(VENV)/bin/pip' install -e .[develop]
2021-01-15 14:14:13 +01:00
2021-04-28 16:19:53 +02:00
venv: $(VENV)/bin/activate
2021-01-15 14:14:13 +01:00
.PHONY: venv
2021-04-28 16:19:53 +02:00
# Format the codebase using Black
2021-01-15 14:14:13 +01:00
format: venv
2021-05-15 13:40:11 +02:00
@ '$(VENV)/bin/black' setup.py app
2021-01-15 14:14:13 +01:00
.PHONY: format
2021-04-28 16:19:53 +02:00
# Remove any temporary files
2021-01-15 14:14:13 +01:00
clean:
2021-04-28 16:19:53 +02:00
@ rm -rf '$(VENV)' .tox backup_tool
2021-01-15 14:14:13 +01:00
.PHONY: clean
2021-04-28 16:19:53 +02:00
# Pack the package into a zipfile
2021-01-15 14:14:13 +01:00
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
2021-04-28 16:19:53 +02:00
# Install the app
2021-01-15 14:14:13 +01:00
install: app
cp backup_tool /usr/local/bin
2021-04-24 19:27:33 +02:00
.PHONY: install
2021-04-24 19:38:03 +02:00
2021-04-24 23:09:13 +02:00
# We can't force the develop to have all the versions locally, so
# the local tests only include python3.6
2021-04-24 19:38:03 +02:00
test: venv tox.ini
2021-04-28 16:19:53 +02:00
@ '$(VENV)/bin/tox' -e py36
2021-04-24 19:38:03 +02:00
.PHONY: test
2021-04-24 22:22:12 +02:00
lint: venv
2021-04-28 16:19:53 +02:00
@ '$(VENV)/bin/tox' -e lint
2021-04-24 22:22:12 +02:00
.PHONY: lint