-
-
Notifications
You must be signed in to change notification settings - Fork 73
/
Copy pathMakefile
122 lines (99 loc) · 3.36 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
PYTHON = python3
FILE_WITH_VERSION = objgraph.py
FILE_WITH_CHANGELOG = CHANGES.rst
VCS_DIFF_IMAGES = git diff docs/*.png
SPHINXOPTS = -Wn
SPHINXBUILD = sphinx-build
SPHINXBUILDDIR = docs/_build
ALLSPHINXOPTS = -d $(SPHINXBUILDDIR)/doctrees $(SPHINXOPTS) docs/
.PHONY: all
all:
@echo "Nothing to build here"
.PHONY: images
images: ##: regenerate graphs used in documentation
$(PYTHON) setup.py --build-images
.PHONY: docs
docs: ##: build HTML documentation
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(SPHINXBUILDDIR)/html
@echo
@echo "Now look at $(SPHINXBUILDDIR)/html/index.html"
.PHONY: clean
clean: ##: remove build artifacts
-rm -rf $(SPHINXBUILDDIR)/* build
.PHONY: test
test: ##: run tests
tox -p auto
.PHONY:
check:
# 'make check' is defined in release.mk and here's how you can override it
define check_recipe =
@$(MAKE) coverage
endef
.PHONY: coverage
coverage: ##: measure test coverage
tox -e coverage
.PHONY: flake8
flake8: ##: check for style problems
tox -e flake8
# Make sure $(VCS_DIFF_IMAGES) can work
.PHONY: config-imgdiff
config-imgdiff:
@test -z "`git config diff.imgdiff.command`" && git config diff.imgdiff.command 'f() { imgdiff --eog -H $$1 $$2; }; f' || true
.PHONY: imgdiff
imgdiff: config-imgdiff ##: compare differences in generated images
$(VCS_DIFF_IMAGES)
.PHONY: releasechecklist
releasechecklist: check-date # also release.mk will add other checks
include release.mk
.PHONY: check-date
check-date:
@date_line="__date__ = '`date +%Y-%m-%d`'" && \
grep -q "^$$date_line$$" $(FILE_WITH_VERSION) || { \
echo "$(FILE_WITH_VERSION) doesn't specify $$date_line"; \
echo "Please run make update-date"; exit 1; }
.PHONY: update-date
update-date: ##: set release date in source code to today
sed -i -e "s/^__date__ = '.*'/__date__ = '`date +%Y-%m-%d`'/" $(FILE_WITH_VERSION)
.PHONY: do-release
do-release: config-imgdiff
# override the release recipe in release.mk
define release_recipe =
# I'm chicken so I won't actually do these things yet
@echo "It is a good idea to run"
@echo
@echo " make clean images docs"
@echo
@echo "about now. Then review the images for unexpected differences with"
@echo
@echo " make imgdiff"
@echo
@echo "then either revert or commit the new images and run"
@echo
@echo " $(PYPI_PUBLISH)"
@echo " $(VCS_TAG)"
@echo " make publish-docs"
@echo
@echo "Please increment the version number in $(FILE_WITH_VERSION)"
@echo "and add a new empty entry at the top of the changelog in $(FILE_WITH_CHANGELOG), then"
@echo
@echo ' $(VCS_COMMIT_AND_PUSH)'
@echo
@echo "then create a GitHub release with"
@echo
@echo " gh release create"
@echo
endef
# XXX: I should switch to readthedocs.org
.PHONY: publish-docs
publish-docs: ##: publish documentation on the website
test -d ~/www/objgraph || { \
echo "There's no ~/www/objgraph, do you have the website checked out?"; exit 1; }
make clean docs
cp -r docs/_build/html/* ~/www/objgraph/
cd ~/www/objgraph && git add . && git status
@echo
@echo "If everything looks fine, please run"
@echo
@echo " cd ~/www/ && git commit -m \"Released objgraph `$(PYTHON) setup.py --version`\" && git push"
@echo " ssh fridge 'cd www && git pull'"
@echo