forked from wummel/dosage
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
173 lines (145 loc) · 5.27 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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
# This Makefile is only used by developers.
# See doc/install.txt on how to install dosage
PYTHON:=python
VERSION:=$(shell $(PYTHON) setup.py --version)
MAINTAINER:=$(shell $(PYTHON) setup.py --maintainer)
AUTHOR:=$(shell $(PYTHON) setup.py --author)
APPNAME:=$(shell $(PYTHON) setup.py --name)
ARCHIVE_SOURCE:=$(APPNAME)-$(VERSION).tar.gz
ARCHIVE_WIN32:=$(APPNAME)-$(VERSION).exe
GITUSER:=wummel
GITREPO:=$(APPNAME)
HOMEPAGE:=$(HOME)/public_html/dosage-webpage.git
WEBMETA:=doc/web/app.yaml
DEBUILDDIR:=$(HOME)/projects/debian/official
DEBORIGFILE:=$(DEBUILDDIR)/$(APPNAME)_$(VERSION).orig.tar.gz
DEBPACKAGEDIR:=$(DEBUILDDIR)/$(APPNAME)-$(VERSION)
# Default pytest options
# Note that using -n silently swallows test creation exceptions like
# import errors.
PYTESTOPTS?=--resultlog=testresults.txt --tb=short -n10
CHMODMINUSMINUS:=--
# directory or file with tests to run
TESTS ?= tests
# set test options, eg. to "--verbose"
TESTOPTS=
all:
chmod:
-chmod -R a+rX,u+w,go-w $(CHMODMINUSMINUS) *
find . -type d -exec chmod 755 {} \;
dist:
[ -d dist ] || mkdir dist
$(PYTHON) setup.py sdist --formats=tar
gzip --best dist/$(APPNAME)-$(VERSION).tar
[ ! -f ../$(ARCHIVE_WIN32) ] || cp ../$(ARCHIVE_WIN32) dist
sign:
[ -f dist/$(ARCHIVE_SOURCE).asc ] || gpg --detach-sign --armor dist/$(ARCHIVE_SOURCE)
[ -f dist/$(ARCHIVE_WIN32).asc ] || gpg --detach-sign --armor dist/$(ARCHIVE_WIN32)
upload: upload_source upload_binary
upload_source:
twine upload dist/$(ARCHIVE_SOURCE) dist/$(ARCHIVE_SOURCE).asc
upload_binary:
cp dist/$(ARCHIVE_WIN32) dist/$(ARCHIVE_WIN32).asc \
$(HOMEPAGE)/dist
update_webmeta:
# update metadata
@echo "version: \"$(VERSION)\"" > $(WEBMETA)
@echo "name: \"$(APPNAME)\"" >> $(WEBMETA)
@echo "maintainer: \"$(MAINTAINER)\"" >> $(WEBMETA)
@echo "author: \"$(AUTHOR)\"" >> $(WEBMETA)
git add $(WEBMETA)
-git commit -m "Updated webpage meta info"
homepage: update_webmeta
# update documentation and release website
$(MAKE) -C doc
$(MAKE) -C doc/web release
release: distclean releasecheck
$(MAKE) dist sign upload homepage tag register changelog deb
tag:
git tag upstream/$(VERSION)
git push --tags origin upstream/$(VERSION)
register:
@echo "Register at Python Package Index..."
$(PYTHON) setup.py register
releasecheck:
git checkout master
$(MAKE) check test
# test console output (behaves differently than redirected output)
$(MAKE) test PYTESTOPTS="-s" TESTS=tests/test_dosage.py
@if egrep -i "xx\.|xxxx|\.xx" doc/changelog.txt > /dev/null; then \
echo "Could not release: edit doc/changelog.txt release date"; false; \
fi
@if [ ! -f ../$(ARCHIVE_WIN32) ]; then \
echo "Missing WIN32 distribution archive at ../$(ARCHIVE_WIN32)"; \
false; \
fi
# $(PYTHON) setup.py check --restructuredtext
git checkout debian
@if ! head -1 debian/changelog | grep "$(VERSION)" > /dev/null; then \
echo "Could not release: update debian/changelog version"; false; \
fi
@if head -1 debian/changelog | grep UNRELEASED >/dev/null; then \
echo "Could not release: set debian/changelog release name"; false; \
fi
git checkout master
# The check programs used here are mostly local scripts on my private system.
# So for other developers there is no need to execute this target.
check:
check-copyright
check-py-encoding patoolib tests
check-pofiles -v
py-tabdaddy
py-unittest2-compat tests/
$(MAKE) doccheck
doccheck:
py-check-docstrings --force \
dosagelib/*.py \
dosage \
scripts \
*.py
pyflakes:
pyflakes dosage dosagelib scripts tests doc/web
count:
@sloccount dosage dosagelib/*.py
clean:
find . -name \*.pyc -delete
find . -name \*.pyo -delete
rm -rf build dist
distclean: clean
rm -rf $(APPNAME).egg-info $(APPNAME).prof test.sh Comics
rm -f _$(APPNAME)_configdata.py MANIFEST
localbuild:
$(PYTHON) setup.py build
test: localbuild
env LANG=en_US.utf-8 http_proxy="" $(PYTHON) -m pytest $(PYTESTOPTS) $(TESTOPTS) $(TESTS)
testall: localbuild
env LANG=en_UR.utf-8 http_proxy="" TESTALL=1 $(PYTHON) -m pytest $(PYTESTOPTS) $(TESTOPTS) $(TESTS)
deb:
# Build an official .deb package; only useful for Debian maintainers.
# To build a local .deb package, use:
# $ sudo apt-get build-dep dosage; apt-get source dosage; cd dosage-*; debuild binary
[ -f $(DEBORIGFILE) ] || cp dist/$(ARCHIVE_SOURCE) $(DEBORIGFILE)
sed -i -e 's/VERSION_$(APPNAME):=.*/VERSION_$(APPNAME):=$(VERSION)/' $(DEBUILDDIR)/$(APPNAME).mak
[ -d $(DEBPACKAGEDIR) ] || (cd $(DEBUILDDIR); \
patool extract $(DEBORIGFILE); \
cd $(CURDIR); \
git checkout debian; \
cp -r debian $(DEBPACKAGEDIR); \
rm -f $(DEBPACKAGEDIR)/debian/.gitignore; \
git checkout master)
$(MAKE) -C $(DEBUILDDIR) $(APPNAME)_clean $(APPNAME)
update-copyright:
# update-copyright is a local tool which updates the copyright year for each
# modified file.
update-copyright --holder="$(MAINTAINER)"
update-comics:
# update all scripted comic plugins (takes ca. one hour on my computer)
scripts/generate_json.sh
scripts/update_plugins.sh
changelog:
# github-changelog is a local tool which parses the changelog and automatically
# closes issues mentioned in the changelog entries.
github-changelog $(DRYRUN) $(GITUSER) $(GITREPO) doc/changelog.txt
.PHONY: update-copyright deb test clean distclean count pyflakes changelog
.PHONY: doccheck check releasecheck release dist chmod localbuild sign
.PHONY: register tag homepage