-
Notifications
You must be signed in to change notification settings - Fork 14
/
Makefile
60 lines (44 loc) · 1.19 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
.PHONY: clean
PACKAGE_NAME=nitrokeyapp
PYTHON=python3
VENV=$(shell poetry env info --path)
VENV_BIN=$(VENV)/bin
VENV_PYTHON=$(VENV_BIN)/$(PYTHON)
PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring
ALL: init build
# setup environment
init: update-venv
update-venv:
ifeq (, $(shell which poetry))
$(error "No poetry in $(PATH)")
endif
poetry env use $(PYTHON)
poetry install --sync --without=deploy
# clean environment
semi-clean:
rm -rf **/__pycache__
rm -rf build/
rm -rf dist/
clean: semi-clean
rm -rf $(VENV)
rm -rf .mypy_cache
# build
build:
poetry build
build-pyinstaller-onefile:
$(VENV_BIN)/pyinstaller ci-scripts/linux/pyinstaller/nitrokey-app-onefile.spec
build-pyinstaller-onedir:
$(VENV_BIN)/pyinstaller ci-scripts/linux/pyinstaller/nitrokey-app-onedir.spec
# code checks
check-format:
$(VENV_PYTHON) -m black --check $(PACKAGE_NAME)/
check-import-sorting:
$(VENV_PYTHON) -m isort --check-only $(PACKAGE_NAME)/
check-style:
$(VENV_PYTHON) -m flake8 $(PACKAGE_NAME)/
check-typing:
$(VENV_PYTHON) -m mypy $(PACKAGE_NAME)/
check: check-format check-import-sorting check-style check-typing
fix:
$(VENV_PYTHON) -m black $(PACKAGE_NAME)/
$(VENV_PYTHON) -m isort $(PACKAGE_NAME)/