-
Notifications
You must be signed in to change notification settings - Fork 5
/
Makefile
150 lines (132 loc) · 3.6 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
PYTHON_INTERPRETER=python3
VENV_PATH=.venv
PIP=$(VENV_PATH)/bin/pip
FLAKE=$(VENV_PATH)/bin/flake8
PYTEST=$(VENV_PATH)/bin/pytest
TOX=$(VENV_PATH)/bin/tox
TWINE=$(VENV_PATH)/bin/twine
SPHINX_RELOAD=$(VENV_PATH)/bin/python sphinx_reload.py
PACKAGE_NAME=boussole
PACKAGE_SLUG=boussole
APPLICATION_NAME=boussole
help:
@echo "Please use \`make <target>' where <target> is one of"
@echo
@echo " install -- to install this project with virtualenv and Pip"
@echo ""
@echo " clean -- to clean EVERYTHING (Warning)"
@echo " clean-doc -- to remove documentation builds"
@echo " clean-install -- to clean Python side installation"
@echo " clean-pycache -- to remove all __pycache__, this is recursive from current directory"
@echo ""
@echo " docs -- to build documentation"
@echo " livedocs -- to run livereload server to rebuild documentation on source changes"
@echo ""
@echo " flake -- to launch Flake8 checking"
@echo " tests -- to launch tests using Pytest"
@echo " tox -- to launch tests for every Tox environments"
@echo " quality -- to launch Flake8, tests, check package and build documentation"
@echo ""
@echo " freeze-dependencies -- to write a frozen.txt file with installed dependencies versions"
@echo " release -- to release package for latest version on PyPi (once release has been pushed to repository)"
@echo
clean-pycache:
@echo ""
@echo "==== Clear Python cache ===="
@echo ""
find . -type d -name "__pycache__"|xargs rm -Rf
find . -name "*\.pyc"|xargs rm -f
rm -Rf .pytest_cache
rm -Rf .tox
.PHONY: clean-pycache
clean-install:
@echo ""
@echo "==== Clear installation ===="
@echo ""
rm -Rf $(VENV_PATH)
rm -Rf dist
rm -Rf $(PACKAGE_SLUG).egg-info
.PHONY: clean-install
clean-doc:
@echo ""
@echo "==== Clear documentation ===="
@echo ""
rm -Rf docs/_build
.PHONY: clean-doc
clean: clean-doc clean-install clean-pycache
.PHONY: clean
venv:
@echo ""
@echo "==== Install virtual environment ===="
@echo ""
virtualenv -p $(PYTHON_INTERPRETER) $(VENV_PATH)
# This is required for those ones using ubuntu<16.04
$(PIP) install --upgrade pip
$(PIP) install --upgrade setuptools
.PHONY: venv
install: venv
@echo ""
@echo "==== Install everything for development ===="
@echo ""
$(PIP) install -e .[dev,quality,doc]
.PHONY: install
docs:
@echo ""
@echo "==== Build documentation ===="
@echo ""
cd docs && make html
.PHONY: docs
livedocs:
@echo ""
@echo "==== Watching documentation sources ===="
@echo ""
$(SPHINX_RELOAD)
.PHONY: livedocs
flake:
@echo ""
@echo "==== Flake ===="
@echo ""
$(FLAKE) --statistics --show-source $(APPLICATION_NAME) tests
.PHONY: flake
tests:
@echo ""
@echo "==== Tests ===="
@echo ""
$(PYTEST) -vv tests/
.PHONY: tests
tox:
@echo ""
@echo "==== Launching tests with Tox environments ===="
@echo ""
$(TOX)
.PHONY: tox
build-package:
@echo ""
@echo "==== Build package ===="
@echo ""
rm -Rf dist
$(VENV_PATH)/bin/python setup.py sdist
.PHONY: build-package
freeze-dependencies:
@echo ""
@echo "==== Freeze dependencies versions ===="
@echo ""
$(VENV_PATH)/bin/python freezer.py
.PHONY: freeze-dependencies
release: build-package
@echo ""
@echo "==== Release ===="
@echo ""
$(TWINE) upload dist/*
.PHONY: release
check-release: build-package
@echo ""
@echo "==== Check package ===="
@echo ""
$(TWINE) check dist/*
.PHONY: check-release
quality: tests flake docs freeze-dependencies check-release
@echo ""
@echo "♥ ♥ Everything should be fine ♥ ♥"
@echo ""
.PHONY: quality