2012-06-20 19:58:13 +00:00
|
|
|
# This Makefile is only used by developers.
|
|
|
|
PYVER:=2.7
|
|
|
|
PYTHON:=python$(PYVER)
|
|
|
|
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]")
|
|
|
|
ARCHIVE_SOURCE:=$(LAPPNAME)-$(VERSION).tar.gz
|
|
|
|
ARCHIVE_WIN32:=$(LAPPNAME)-$(VERSION).exe
|
|
|
|
GITUSER:=wummel
|
|
|
|
GITREPO:=$(LAPPNAME)
|
|
|
|
HOMEPAGE:=$(HOME)/public_html/$(LAPPNAME).git
|
|
|
|
DEBUILDDIR:=$(HOME)/projects/debian/unofficial
|
|
|
|
DEBORIGFILE:=$(DEBUILDDIR)/$(LAPPNAME)_$(VERSION).orig.tar.gz
|
|
|
|
DEBPACKAGEDIR:=$(DEBUILDDIR)/$(LAPPNAME)-$(VERSION)
|
2012-12-12 16:41:29 +00:00
|
|
|
PY_FILES_DIRS := dosage dosagelib scripts tests
|
2012-06-20 19:58:13 +00:00
|
|
|
PY2APPOPTS ?=
|
2012-12-12 16:41:29 +00:00
|
|
|
# Default pytest options:
|
|
|
|
# Do not use parallel testing with -n: it makes some tests fail since
|
|
|
|
# some web servers have limits on the number of parallel connections.
|
|
|
|
# Also note that using -n silently swallows test creation exceptions like
|
|
|
|
# import errors.
|
2012-12-19 19:43:39 +00:00
|
|
|
PYTESTOPTS?=--resultlog=testresults.txt --tb=short --durations=0
|
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
|
|
|
|
git archive --format=tar --prefix=$(LAPPNAME)-$(VERSION)/ HEAD | gzip -9 > dist/$(ARCHIVE_SOURCE)
|
|
|
|
[ ! -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:
|
2012-12-18 18:47:35 +00:00
|
|
|
github-upload $(GITUSER) $(GITREPO) \
|
2012-12-17 20:28:20 +00:00
|
|
|
dist/$(ARCHIVE_SOURCE) dist/$(ARCHIVE_WIN32) \
|
|
|
|
dist/$(ARCHIVE_SOURCE).asc dist/$(ARCHIVE_WIN32).asc
|
|
|
|
|
|
|
|
testresults:
|
|
|
|
scripts/mktestpage.py testresults.txt > $(HOMEPAGE)/content/testresults.html
|
|
|
|
|
|
|
|
homepage:
|
|
|
|
# update metadata
|
|
|
|
@echo "version: $(VERSION)" > $(HOMEPAGE)/info.yaml
|
|
|
|
@echo "name: $(APPNAME)" >> $(HOMEPAGE)/info.yaml
|
|
|
|
@echo "lname: $(LAPPNAME)" >> $(HOMEPAGE)/info.yaml
|
|
|
|
@echo "maintainer: $(MAINTAINER)" >> $(HOMEPAGE)/info.yaml
|
|
|
|
@echo "author: $(AUTHOR)" >> $(HOMEPAGE)/info.yaml
|
|
|
|
# generate static files
|
|
|
|
$(MAKE) -C doc
|
|
|
|
cp doc/$(LAPPNAME).1.html $(HOMEPAGE)/content
|
|
|
|
make -C $(HOMEPAGE) gen
|
|
|
|
|
2012-12-18 17:54:24 +00:00
|
|
|
release: distclean releasecheck
|
|
|
|
$(MAKE) dist sign upload homepage tag register 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
|
|
|
|
2012-12-12 16:41:29 +00:00
|
|
|
releasecheck: check
|
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
|
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
|
|
|
|
check-pofiles -v
|
|
|
|
py-tabdaddy
|
|
|
|
py-unittest2-compat tests/
|
2012-09-25 19:03:05 +00:00
|
|
|
$(MAKE) doccheck
|
|
|
|
$(MAKE) pyflakes
|
|
|
|
|
|
|
|
doccheck:
|
|
|
|
py-check-docstrings --force \
|
2012-10-11 16:02:34 +00:00
|
|
|
dosagelib/*.py \
|
2012-09-25 19:03:05 +00:00
|
|
|
dosage \
|
|
|
|
*.py
|
2012-06-20 19:58:13 +00:00
|
|
|
|
|
|
|
pyflakes:
|
|
|
|
pyflakes $(PY_FILES_DIRS)
|
|
|
|
|
|
|
|
count:
|
2012-12-17 20:28:20 +00:00
|
|
|
@sloccount $(PY_FILES_DIRS)
|
2012-06-20 19:58:13 +00:00
|
|
|
|
|
|
|
clean:
|
|
|
|
find . -name \*.pyc -delete
|
|
|
|
find . -name \*.pyo -delete
|
|
|
|
rm -rf build dist
|
|
|
|
|
|
|
|
distclean: clean
|
2012-12-18 17:54:24 +00:00
|
|
|
rm -rf build dist $(APPNAME).egg-info $(LAPPNAME).prof test.sh
|
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
|
|
|
|
|
|
|
deb:
|
2012-12-17 20:28:20 +00:00
|
|
|
# build a debian package
|
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); \
|
|
|
|
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)"
|
|
|
|
|
|
|
|
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
|
|
|
|
.PHONY: doccheck check releasecheck release dist chmod localbuild sign register tag
|