-
Notifications
You must be signed in to change notification settings - Fork 26
/
Makefile
80 lines (58 loc) · 1.56 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#
# == Paths & Directories ==
#
VENV_DIR := .virtualenv
PYTHON3 := $(shell command -v python3 2> /dev/null)
PYTHON_REQUIREMENTS := requirements.txt
PYTHON_FROZEN_REQUIREMENTS := requirements.frozen.txt
#
# == Configuration ==
#
UNAME := $(shell uname)
#
# == Commands ==
#
PIP := $(VENV_DIR)/bin/pip
PYTEST := $(VENV_DIR)/bin/pytest
FLAKE8 := $(VENV_DIR)/bin/flake8
MYPY := $(VENV_DIR)/bin/mypy
SPHINX_BUILD := $(VENV_DIR)/bin/sphinx-build
#
# == Targets ==
#
default: dependencies
docs:
$(SPHINX_BUILD) -c docs hermit docs/_build
clean:
$(RM) -rf docs/_build/* build/* dist/* hermit.egg-info build.info
freeze:
$(PIP) freeze -l > $(PYTHON_FROZEN_REQUIREMENTS)
dependencies: system-dependencies python-dependencies
system-dependencies:
ifeq ($(UNAME),Darwin)
brew ls --versions zbar || brew install zbar
else
sudo apt install libzbar0
endif
python-dependencies: $(VENV_DIR)
$(PIP) install wheel
ifdef UNFREEZE
$(PIP) install -r $(PYTHON_REQUIREMENTS)
else
$(PIP) install -r $(PYTHON_FROZEN_REQUIREMENTS)
endif
build.info:
echo ${BUILD_NUMBER} > build.info
package: python-dependencies build.info
python setup.py sdist bdist_wheel
upload: python-dependencies package
#twine upload -u ${PYPI_USERNAME} -p ${PYPI_PASSWORD} --repository-url https://test.pypi.org/legacy/ dist/*
twine upload dist/*
$(VENV_DIR):
$(PYTHON3) -m venv --prompt='hermit' $(VENV_DIR)
test:
$(PYTEST) --cov=hermit --cov-config=tests/.coveragerc --ignore=vendor
lint:
-$(FLAKE8) hermit --exclude=__init__.py
-$(MYPY) hermit/
.PHONY: test docs