forked from techservicesillinois/awscli-login
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
77 lines (58 loc) · 1.44 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
PACKAGE_NAME := awscli-login
PKG := src/awscli_login
TPKG := src/tests
export TSTS := $(wildcard $(TPKG)/*.py $(TPKG)/*/*.py)
export SRCS := $(wildcard $(PKG)/*.py)
OBJS := $(patsubst %.py,%.pyc,$(SRCS))
VENV := venv
HTML = htmlcov/index.html
.PHONY: all install test clean test-all docs coverage doctest
all: build test docs doctest coverage
install: build
pip install -e .
build: $(OBJS) setup.py
python setup.py build
%.pyc: %.py
python -m compileall -b $<
.python-version:
pyenv install -s 3.5.2
pyenv install -s 3.6.5
pyenv local 3.5.2 3.6.5
tox: .python-version
tox
test: .report
@cat $?
.report: .coverage
@coverage report > $@
.coverage: $(SRCS) $(TSTS)
flake8 $^
mypy $^
@coverage run setup.py test || rm $@
# @coverage combine
coverage: $(HTML)
docs: $(SRCS) $(TSTS)
make -C docs html
doctest: $(SRCS) $(TSTS)
make -C docs doctest
$(HTML): .coverage
@coverage html
test-all: $(VENV)/bin/awscli-login
(\
source $(VENV)/bin/activate; \
python setup.py test; \
)
$(VENV): build
virtualenv $@
$(VENV)/bin/awscli-login: $(VENV)
(\
source $(VENV)/bin/activate; \
pip install -r requirements.txt; \
python setup.py install; \
)
clean:
-pip uninstall -y $(PACKAGE_NAME)
rm -rf .coverage .report .summary __pycache__ htmlcov .mypy_cache .tox
rm -rf $(TPKG)/__pycache__ $(PKG)/__pycache__ $(TPKG)/config/__pycache__
rm -rf $(TPKG)/*.pyc $(PKG)/*.pyc
rm -rf build dist venv src/*.egg-info .eggs
make -C docs clean