2012-06-20 19:58:13 +00:00
|
|
|
# This Makefile is only used by developers.
|
2014-01-24 21:53:35 +00:00
|
|
|
# See doc/install.txt on how to install dosage
|
2013-02-15 06:20:55 +00:00
|
|
|
PYTHON:=python
|
2012-06-20 19:58:13 +00:00
|
|
|
VERSION:=$(shell $(PYTHON) setup.py --version)
|
2012-12-17 20:28:20 +00:00
|
|
|
MAINTAINER:=$(shell $(PYTHON) setup.py --maintainer)
|
|
|
|
AUTHOR:=$(shell $(PYTHON) setup.py --author)
|
|
|
|
APPNAME:=$(shell $(PYTHON) setup.py --name)
|
|
|
|
LAPPNAME:=$(shell echo $(APPNAME)|tr "[A-Z]" "[a-z]")
|
2013-01-23 18:46:39 +00:00
|
|
|
ARCHIVE_SOURCE:=$(LAPPNAME)-$(VERSION).tar.gz
|
2012-12-17 20:28:20 +00:00
|
|
|
ARCHIVE_WIN32:=$(LAPPNAME)-$(VERSION).exe
|
|
|
|
GITUSER:=wummel
|
|
|
|
GITREPO:=$(LAPPNAME)
|
2014-06-08 19:58:14 +00:00
|
|
|
HOMEPAGE:=$(HOME)/public_html/dosage-webpage.git
|
2013-07-18 21:56:34 +00:00
|
|
|
WEBMETA:=doc/web/app.yaml
|
2013-01-28 20:13:06 +00:00
|
|
|
DEBUILDDIR:=$(HOME)/projects/debian/official
|
2013-01-23 18:46:39 +00:00
|
|
|
DEBORIGFILE:=$(DEBUILDDIR)/$(LAPPNAME)_$(VERSION).orig.tar.gz
|
2012-12-17 20:28:20 +00:00
|
|
|
DEBPACKAGEDIR:=$(DEBUILDDIR)/$(LAPPNAME)-$(VERSION)
|
2013-02-10 17:24:05 +00:00
|
|
|
# Default pytest options
|
|
|
|
# Note that using -n silently swallows test creation exceptions like
|
2012-12-12 16:41:29 +00:00
|
|
|
# import errors.
|
2013-02-28 20:07:42 +00:00
|
|
|
PYTESTOPTS?=--resultlog=testresults.txt --tb=short -n10
|
2012-06-20 19:58:13 +00:00
|
|
|
CHMODMINUSMINUS:=--
|
2012-09-26 12:42:11 +00:00
|
|
|
# directory or file with tests to run
|
|
|
|
TESTS ?= tests
|
|
|
|
# set test options, eg. to "--verbose"
|
2012-06-20 19:58:13 +00:00
|
|
|
TESTOPTS=
|
|
|
|
|
|
|
|
all:
|
|
|
|
|
|
|
|
chmod:
|
|
|
|
-chmod -R a+rX,u+w,go-w $(CHMODMINUSMINUS) *
|
|
|
|
find . -type d -exec chmod 755 {} \;
|
|
|
|
|
|
|
|
dist:
|
2012-12-17 20:28:20 +00:00
|
|
|
[ -d dist ] || mkdir dist
|
2013-01-23 18:46:39 +00:00
|
|
|
git archive --format=tar --prefix=$(LAPPNAME)-$(VERSION)/ HEAD | gzip -9 > dist/$(ARCHIVE_SOURCE)
|
2012-12-17 20:28:20 +00:00
|
|
|
[ ! -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)
|
|
|
|
|
2014-06-08 19:58:14 +00:00
|
|
|
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
|
2012-12-17 20:28:20 +00:00
|
|
|
|
|
|
|
homepage:
|
|
|
|
# update metadata
|
2013-07-18 21:56:34 +00:00
|
|
|
@echo "version: \"$(VERSION)\"" > $(WEBMETA)
|
|
|
|
@echo "name: \"$(APPNAME)\"" >> $(WEBMETA)
|
|
|
|
@echo "lname: \"$(LAPPNAME)\"" >> $(WEBMETA)
|
|
|
|
@echo "maintainer: \"$(MAINTAINER)\"" >> $(WEBMETA)
|
|
|
|
@echo "author: \"$(AUTHOR)\"" >> $(WEBMETA)
|
2014-03-05 19:52:24 +00:00
|
|
|
git add $(WEBMETA)
|
2013-11-12 19:48:52 +00:00
|
|
|
-git commit -m "Updated webpage meta info"
|
2013-03-29 10:01:04 +00:00
|
|
|
# update documentation and release website
|
2012-12-17 20:28:20 +00:00
|
|
|
$(MAKE) -C doc
|
2013-03-29 10:01:04 +00:00
|
|
|
$(MAKE) -C doc/web release
|
2012-12-17 20:28:20 +00:00
|
|
|
|
2012-12-18 17:54:24 +00:00
|
|
|
release: distclean releasecheck
|
2013-04-11 16:27:44 +00:00
|
|
|
$(MAKE) dist sign upload homepage tag register changelog deb
|
2012-12-17 20:28:20 +00:00
|
|
|
|
|
|
|
tag:
|
|
|
|
git tag upstream/$(VERSION)
|
|
|
|
git push --tags origin upstream/$(VERSION)
|
|
|
|
|
|
|
|
register:
|
2012-11-28 17:15:12 +00:00
|
|
|
@echo "Register at Python Package Index..."
|
|
|
|
$(PYTHON) setup.py register
|
2012-12-20 13:19:32 +00:00
|
|
|
@echo "Submit to freecode..."
|
|
|
|
freecode-submit < $(LAPPNAME).freecode
|
2012-06-20 19:58:13 +00:00
|
|
|
|
2013-04-12 19:22:46 +00:00
|
|
|
releasecheck:
|
2013-02-11 18:43:17 +00:00
|
|
|
git checkout master
|
2013-04-12 19:22:46 +00:00
|
|
|
$(MAKE) check test
|
|
|
|
# test console output (behaves differently than redirected output)
|
|
|
|
$(MAKE) test PYTESTOPTS="-s" TESTS=tests/test_dosage.py
|
2012-06-20 19:58:13 +00:00
|
|
|
@if egrep -i "xx\.|xxxx|\.xx" doc/changelog.txt > /dev/null; then \
|
|
|
|
echo "Could not release: edit doc/changelog.txt release date"; false; \
|
|
|
|
fi
|
2012-12-18 17:54:24 +00:00
|
|
|
@if [ ! -f ../$(ARCHIVE_WIN32) ]; then \
|
|
|
|
echo "Missing WIN32 distribution archive at ../$(ARCHIVE_WIN32)"; \
|
|
|
|
false; \
|
|
|
|
fi
|
2012-12-17 20:28:20 +00:00
|
|
|
@if ! grep "Version: $(VERSION)" $(LAPPNAME).freecode > /dev/null; then \
|
|
|
|
echo "Could not release: edit $(LAPPNAME).freecode version"; false; \
|
|
|
|
fi
|
2012-12-18 17:54:24 +00:00
|
|
|
$(PYTHON) setup.py check --restructuredtext
|
2013-02-11 18:43:17 +00:00
|
|
|
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
|
2012-06-20 19:58:13 +00:00
|
|
|
|
|
|
|
# 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
|
2013-04-14 05:58:57 +00:00
|
|
|
check-py-encoding patoolib tests
|
2012-06-20 19:58:13 +00:00
|
|
|
check-pofiles -v
|
|
|
|
py-tabdaddy
|
|
|
|
py-unittest2-compat tests/
|
2012-09-25 19:03:05 +00:00
|
|
|
$(MAKE) doccheck
|
|
|
|
|
|
|
|
doccheck:
|
|
|
|
py-check-docstrings --force \
|
2012-10-11 16:02:34 +00:00
|
|
|
dosagelib/*.py \
|
2012-09-25 19:03:05 +00:00
|
|
|
dosage \
|
2013-01-09 21:26:00 +00:00
|
|
|
scripts \
|
2012-09-25 19:03:05 +00:00
|
|
|
*.py
|
2012-06-20 19:58:13 +00:00
|
|
|
|
|
|
|
pyflakes:
|
2013-03-29 10:01:04 +00:00
|
|
|
pyflakes dosage dosagelib scripts tests doc/web
|
2012-06-20 19:58:13 +00:00
|
|
|
|
|
|
|
count:
|
2013-03-04 18:11:23 +00:00
|
|
|
@sloccount dosage dosagelib/*.py
|
2012-06-20 19:58:13 +00:00
|
|
|
|
|
|
|
clean:
|
|
|
|
find . -name \*.pyc -delete
|
|
|
|
find . -name \*.pyo -delete
|
|
|
|
rm -rf build dist
|
|
|
|
|
|
|
|
distclean: clean
|
2013-04-11 18:37:24 +00:00
|
|
|
rm -rf $(APPNAME).egg-info $(LAPPNAME).prof test.sh Comics
|
2012-12-17 20:28:20 +00:00
|
|
|
rm -f _$(APPNAME)_configdata.py MANIFEST
|
2012-06-20 19:58:13 +00:00
|
|
|
|
2012-10-10 19:13:31 +00:00
|
|
|
localbuild:
|
|
|
|
$(PYTHON) setup.py build
|
|
|
|
|
|
|
|
test: localbuild
|
2012-12-12 16:41:29 +00:00
|
|
|
env LANG=en_US.utf-8 http_proxy="" $(PYTHON) -m pytest $(PYTESTOPTS) $(TESTOPTS) $(TESTS)
|
2012-06-20 19:58:13 +00:00
|
|
|
|
2013-03-26 16:27:34 +00:00
|
|
|
testall: localbuild
|
2013-04-11 05:47:19 +00:00
|
|
|
env LANG=en_UR.utf-8 http_proxy="" TESTALL=1 $(PYTHON) -m pytest $(PYTESTOPTS) $(TESTOPTS) $(TESTS)
|
2013-03-26 16:27:34 +00:00
|
|
|
|
2012-06-20 19:58:13 +00:00
|
|
|
deb:
|
2013-02-27 18:40:06 +00:00
|
|
|
# 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
|
2012-12-18 17:54:24 +00:00
|
|
|
[ -f $(DEBORIGFILE) ] || cp dist/$(ARCHIVE_SOURCE) $(DEBORIGFILE)
|
|
|
|
sed -i -e 's/VERSION_$(LAPPNAME):=.*/VERSION_$(LAPPNAME):=$(VERSION)/' $(DEBUILDDIR)/$(LAPPNAME).mak
|
2012-12-17 20:28:20 +00:00
|
|
|
[ -d $(DEBPACKAGEDIR) ] || (cd $(DEBUILDDIR); \
|
|
|
|
patool extract $(DEBORIGFILE); \
|
|
|
|
cd $(CURDIR); \
|
|
|
|
git checkout debian; \
|
|
|
|
cp -r debian $(DEBPACKAGEDIR); \
|
2013-02-22 17:29:31 +00:00
|
|
|
rm -f $(DEBPACKAGEDIR)/debian/.gitignore; \
|
2012-12-17 20:28:20 +00:00
|
|
|
git checkout master)
|
2012-12-18 17:54:24 +00:00
|
|
|
$(MAKE) -C $(DEBUILDDIR) $(LAPPNAME)_clean $(LAPPNAME)
|
2012-06-20 19:58:13 +00:00
|
|
|
|
2012-06-20 20:41:04 +00:00
|
|
|
update-copyright:
|
2012-12-17 20:28:20 +00:00
|
|
|
# update-copyright is a local tool which updates the copyright year for each
|
|
|
|
# modified file.
|
|
|
|
update-copyright --holder="$(MAINTAINER)"
|
|
|
|
|
2013-07-10 16:43:30 +00:00
|
|
|
update-comics:
|
|
|
|
# update all scripted comic plugins (takes ca. one hour on my computer)
|
|
|
|
scripts/generate_json.sh
|
|
|
|
scripts/update_plugins.sh
|
|
|
|
|
|
|
|
|
2012-12-17 20:28:20 +00:00
|
|
|
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
|
2012-10-10 19:13:31 +00:00
|
|
|
|
2012-12-17 20:28:20 +00:00
|
|
|
.PHONY: update-copyright deb test clean distclean count pyflakes changelog
|
2013-03-29 10:01:04 +00:00
|
|
|
.PHONY: doccheck check releasecheck release dist chmod localbuild sign
|
|
|
|
.PHONY: register tag homepage
|