-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
136 lines (105 loc) · 3.32 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
# Note: "make test" won't halt if linting and coverage fail.
# Note: .egg and .egg-info folders aren't removed on "clean"
# This is so that many make commands don't download
# dependencies over and over again.
# Note: All these tasks are simply _recommendations_ meant to
# make your life easier. Change what you will but please
# *keep the names of the tasks the same*!
# Nikhil Anand <[email protected]>
# Mon Jun 13 16:00:12 CDT 2016
.PHONY: help
help:
@echo ""
@echo " help"
@echo " Display this message"
@echo " all"
@echo " Clean build artifacts, run tests, build wheel & documentation"
@echo " build"
@echo " Run tests and build a wheel"
@echo " bump"
@echo " Increment patch number and push tags to remote"
@echo " clean"
@echo " Remove all build artifacts"
@echo " coverage"
@echo " Run and display coverage report"
@echo " dev_install"
@echo " Install editable version of package into virtualenv"
@echo " doc"
@echo " Build HTML documentation"
@echo " doc_serve"
@echo " Serve documentation on localhost:8888 and watch source for changes"
@echo " install"
@echo " Install package into virtualenv"
@echo " lint"
@echo " Run linter and display report"
@echo " publish"
@echo " Run tests, make wheel, push to PyPI"
@echo " sdist"
@echo " Build source distribution"
@echo " test"
@echo " Run linter, coverage reporter, and all tests"
@echo ""
@echo " > To bootstrap dependencies, run 'make dev_install'"
@echo ""
.PHONY: check_venv
check_venv:
ifndef VIRTUAL_ENV
$(error "! You don't appear to be in a virtual environment.")
endif
.PHONY: all
all: check_venv clean test build doc
.PHONY: build
build: check_venv test
python setup.py sdist
python setup.py bdist_wheel
python setup.py bdist_egg
.PHONY: bump
bump:
ifneq ($(shell bash -c 'bumpversion' >/dev/null 2>&1; echo $$?), 1)
$(warning "! Could not find bumpversion; attempting install")
pip install bumpversion
endif
bumpversion patch
git push --follow-tags
.PHONY: clean
clean: check_venv
rm -rf dist build .cache*
rm -rf docs/build
find . -type f -iname "*.pyc" | xargs rm -rf {}
find . -type d -iname "__pycache__" | xargs rm -rf {}
.PHONY: coverage
coverage: check_venv
-python setup.py -q test --addopts --cov=laueagle
.PHONY: dev_install
dev_install: check_venv
pip install -e .
.PHONY: doc
doc: check_venv
ifneq ($(shell bash -c 'sphinx-build' >/dev/null 2>&1; echo $$?), 1)
$(warning "! Could not find Sphinx; attempting install")
pip install sphinx sphinx_rtd_theme
endif
cd docs && make clean && make html
.PHONY: doc_serve
doc_serve: doc
ifneq ($(shell bash -c 'livereload --version' >/dev/null 2>&1; echo $$?), 2)
$(warning "! Could not find live-reloader; attempting install")
pip install livereload
endif
python -c "from livereload import Server, shell; server = Server(); server.watch('docs/source/*.rst', shell('make html', cwd='docs')); server.serve(port=8888, host='localhost', root='docs/build/html')"
.PHONY: install
install: check_venv
pip install .
.PHONY: lint
lint: check_venv
-python setup.py -q test --addopts --flake8
.PHONY: publish
publish: check_venv build
python setup.py sdist upload
python setup.py bdist_wheel upload
.PHONY: sdist
sdist: check_venv
python setup.py sdist
.PHONY: test
test: check_venv clean lint coverage
python setup.py -q test