-
Notifications
You must be signed in to change notification settings - Fork 18
/
Makefile
132 lines (98 loc) · 3.11 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
PROJECT=aiocouchdb
PYTHON=`which python3`
PIP=`which pip`
NOSE=`which nosetests`
PYLINT=`which pylint`
FLAKE8=`which flake8`
SPHINX=`which sphinx-build`
.PHONY: help
# target: help - Prints this help
help:
@egrep "^# target:" Makefile | sed -e 's/^# target: //g' | sort
.PHONY: venv
# target: venv - Setups virtual environment
venv:
${PYTHON} -m venv venv
@echo "Virtuanenv has been created. Don't forget to run . venv/bin/active"
.PHONY: dev
# target: dev - Setups developer environment
dev:
${PIP} install nose coverage pylint flake8 sphinx
${PYTHON} setup.py develop
.PHONY: install
# target: install - Installs aiocouchdb package
install:
${PYTHON} setup.py install
.PHONY: clean
# target: clean - Removes intermediate and generated files
clean:
rm -rf `find . -name __pycache__`
rm -f `find . -type f -name '*.py[co]' `
rm -f `find . -type f -name '*.orig' `
rm -f `find . -type f -name '*.rej' `
rm -f .coverage
rm -rf coverage
rm -rf build
rm -rf cover
make -C docs clean
python setup.py clean
.PHONY: purge
# target: purge - Removes all unversioned files and resets repository
purge:
git reset --hard HEAD
git clean -xdff
.PHONY: check
# target: check - Runs test suite against mocked environment
check: flake pylint-errors
${NOSE} --with-doctest ${PROJECT}
.PHONY: check-couchdb
# target: check-couchdb - Runs test suite against real CouchDB instance (AIOCOUCHDB_URL="http://localhost:5984")
check-couchdb: flake
AIOCOUCHDB_URL="http://localhost:5984" AIOCOUCHDB_TARGET="couchdb" \
${NOSE} --with-doctest ${PROJECT}
.PHONY: distcheck
# target: distcheck - Checks if project is ready to ship
distcheck: distcheck-clean distcheck-33 distcheck-34
distcheck-clean:
rm -rf distcheck
distcheck-33:
mkdir -p distcheck
virtualenv --python=python3.3 distcheck/venv-3.3
distcheck/venv-3.3/bin/python setup.py install
distcheck/venv-3.3/bin/python setup.py test
AIOCOUCHDB_URL="http://localhost:5984" AIOCOUCHDB_TARGET="couchdb" \
distcheck/venv-3.3/bin/python setup.py test
distcheck-34:
mkdir -p distcheck
python3.4 -m venv distcheck/venv-3.4
distcheck/venv-3.4/bin/python setup.py install
distcheck/venv-3.4/bin/python setup.py test
AIOCOUCHDB_URL="http://localhost:5984" AIOCOUCHDB_TARGET="couchdb" \
distcheck/venv-3.4/bin/python setup.py test
flake:
${FLAKE8} --max-line-length=80 --statistics --exclude=tests --ignore=E501,F403 ${PROJECT}
.PHONY: cover
# target: cover - Generates coverage report
cover:
${NOSE} --with-coverage --cover-html --cover-erase --cover-package=${PROJECT}
.PHONY: pylint
# target: pylint - Runs pylint checks
pylint:
${PYLINT} --rcfile=.pylintrc ${PROJECT}
.PHONY: pylint-errors
# target: pylint-errors - Reports about pylint errors
pylint-errors:
${PYLINT} --rcfile=.pylintrc -E ${PROJECT}
.PHONY: docs
# target: docs - Builds Sphinx html docs
docs:
${SPHINX} -b html -d docs/_build/doctrees docs/ docs/_build/html
.PHONY: release
# target: release - Yay new release!
release: ${PROJECT}/version.py
sed -i s/\'dev\'/\'\'/ $<
git commit -m "Release `${PYTHON} $<` version" $<
.PHONY: pypi
# target: pypi - Uploads package on PyPI
pypi:
${PYTHON} setup.py sdist register upload