2010-02-22 20:30:26 +00:00
|
|
|
# This Makefile is only used by developers.
|
2013-02-21 06:06:39 +00:00
|
|
|
PYTHON:=python
|
2011-12-27 16:47:28 +00:00
|
|
|
VERSION:=$(shell $(PYTHON) setup.py --version)
|
2012-12-17 17:14:58 +00:00
|
|
|
MAINTAINER:=$(shell $(PYTHON) setup.py --maintainer)
|
|
|
|
AUTHOR:=$(shell $(PYTHON) setup.py --author)
|
|
|
|
APPNAME:=$(shell $(PYTHON) setup.py --name)
|
2014-06-09 12:02:19 +00:00
|
|
|
ARCHIVE_SOURCE:=$(APPNAME)-$(VERSION).tar.gz
|
2015-12-07 19:16:28 +00:00
|
|
|
ARCHIVE_WHEEL:=$(APPNAME)-$(VERSION)-py2.py3-none-any.whl
|
2012-12-17 17:14:58 +00:00
|
|
|
GITUSER:=wummel
|
2014-06-09 12:02:19 +00:00
|
|
|
GITREPO:=$(APPNAME)
|
2014-06-08 11:00:41 +00:00
|
|
|
HOMEPAGE:=$(HOME)/public_html/patool-webpage.git
|
2013-07-19 13:15:17 +00:00
|
|
|
WEBMETA:=doc/web/app.yaml
|
2012-11-14 19:24:34 +00:00
|
|
|
# Pytest options:
|
2012-11-18 19:43:14 +00:00
|
|
|
# --resultlog: write test results in file
|
|
|
|
# -s: do not capture stdout/stderr (some tests fail otherwise)
|
2013-06-27 20:09:24 +00:00
|
|
|
PYTESTOPTS?=--resultlog=testresults.txt -s
|
2010-02-22 20:30:26 +00:00
|
|
|
# which test modules to run
|
2010-02-21 11:14:57 +00:00
|
|
|
TESTS ?= tests/
|
2012-11-14 19:24:34 +00:00
|
|
|
# set test options
|
2010-02-21 11:14:57 +00:00
|
|
|
TESTOPTS=
|
|
|
|
|
|
|
|
all:
|
|
|
|
|
|
|
|
|
|
|
|
dist:
|
2012-12-17 20:04:32 +00:00
|
|
|
[ -d dist ] || mkdir dist
|
2015-12-07 19:16:28 +00:00
|
|
|
$(PYTHON) setup.py sdist --formats=tar bdist_wheel
|
2014-06-09 12:02:19 +00:00
|
|
|
gzip --best dist/$(APPNAME)-$(VERSION).tar
|
2012-08-04 14:52:20 +00:00
|
|
|
|
|
|
|
sign:
|
2012-12-14 21:04:48 +00:00
|
|
|
[ -f dist/$(ARCHIVE_SOURCE).asc ] || gpg --detach-sign --armor dist/$(ARCHIVE_SOURCE)
|
2015-12-07 19:16:28 +00:00
|
|
|
[ -f dist/$(ARCHIVE_WHEEL).asc ] || gpg --detach-sign --armor dist/$(ARCHIVE_WHEEL)
|
2010-02-21 11:14:57 +00:00
|
|
|
|
2015-12-07 19:16:28 +00:00
|
|
|
upload: upload_source upload_binary
|
2014-06-08 11:00:41 +00:00
|
|
|
|
|
|
|
upload_source:
|
|
|
|
twine upload dist/$(ARCHIVE_SOURCE) dist/$(ARCHIVE_SOURCE).asc
|
|
|
|
|
|
|
|
upload_binary:
|
2015-12-07 19:16:28 +00:00
|
|
|
cp dist/$(ARCHIVE_WHEEL) dist/$(ARCHIVE_WHEEL).asc \
|
2014-06-08 11:00:41 +00:00
|
|
|
$(HOMEPAGE)/dist
|
2012-12-17 17:14:58 +00:00
|
|
|
|
2014-06-09 12:02:19 +00:00
|
|
|
update_webmeta:
|
2012-12-17 17:14:58 +00:00
|
|
|
# update metadata
|
2013-07-19 13:17:39 +00:00
|
|
|
@echo "version: \"$(VERSION)\"" > $(WEBMETA)
|
|
|
|
@echo "name: \"$(APPNAME)\"" >> $(WEBMETA)
|
|
|
|
@echo "maintainer: \"$(MAINTAINER)\"" >> $(WEBMETA)
|
|
|
|
@echo "author: \"$(AUTHOR)\"" >> $(WEBMETA)
|
|
|
|
git add $(WEBMETA)
|
2013-06-27 20:33:08 +00:00
|
|
|
git cm "Updated web meta data."
|
2014-06-09 12:02:19 +00:00
|
|
|
|
|
|
|
homepage: update_webmeta
|
2013-03-29 10:12:37 +00:00
|
|
|
# relase website
|
|
|
|
$(MAKE) -C doc/web release
|
2012-12-17 17:14:58 +00:00
|
|
|
|
|
|
|
tag:
|
|
|
|
# add and push the version tag
|
|
|
|
git tag upstream/$(VERSION)
|
|
|
|
git push --tags origin upstream/$(VERSION)
|
2010-03-08 16:28:59 +00:00
|
|
|
|
2012-12-17 17:14:58 +00:00
|
|
|
# Make a new release by calling all the distinct steps in the correct order.
|
|
|
|
# Each step is a separate target so that it's easy to do this manually if
|
|
|
|
# anything screwed up.
|
2014-06-27 19:24:23 +00:00
|
|
|
release: distclean releasecheck
|
2015-12-07 11:34:57 +00:00
|
|
|
$(MAKE) dist sign upload homepage tag register changelog
|
2012-08-03 19:41:45 +00:00
|
|
|
|
2012-12-17 17:14:58 +00:00
|
|
|
register:
|
2010-03-04 08:03:36 +00:00
|
|
|
@echo "Register at Python Package Index..."
|
2011-12-27 16:47:28 +00:00
|
|
|
$(PYTHON) setup.py register
|
2010-03-04 08:03:36 +00:00
|
|
|
|
2012-12-17 17:14:58 +00:00
|
|
|
releasecheck: test check
|
2010-03-04 08:03:36 +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
|
2015-12-07 11:29:07 +00:00
|
|
|
@if ! head -n1 doc/changelog.txt | egrep "^$(VERSION)" >/dev/null; then \
|
|
|
|
echo "Could not release: different versions in doc/changelog.txt and setup.py"; \
|
|
|
|
echo "Version in doc/changelog.txt:"; head -n1 doc/changelog.txt; \
|
|
|
|
echo "Version in setup.py: $(VERSION)"; false; \
|
|
|
|
fi
|
2014-06-08 11:00:41 +00:00
|
|
|
$(PYTHON) setup.py check --restructuredtext
|
2010-03-04 08:03:36 +00:00
|
|
|
|
2012-12-17 17:14:58 +00:00
|
|
|
check:
|
2010-02-21 11:14:57 +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-copyright
|
|
|
|
check-pofiles -v
|
|
|
|
py-tabdaddy
|
2010-03-06 10:19:20 +00:00
|
|
|
py-unittest2-compat tests/
|
2012-12-17 17:14:58 +00:00
|
|
|
$(MAKE) doccheck
|
|
|
|
|
|
|
|
doccheck:
|
|
|
|
py-check-docstrings --force \
|
|
|
|
patoolib \
|
|
|
|
patool \
|
|
|
|
*.py
|
2010-02-21 11:14:57 +00:00
|
|
|
|
|
|
|
pyflakes:
|
2012-12-17 17:14:58 +00:00
|
|
|
pyflakes setup.py patool patoolib tests
|
2010-02-21 11:14:57 +00:00
|
|
|
|
|
|
|
count:
|
2012-12-17 17:14:58 +00:00
|
|
|
# print some code statistics
|
|
|
|
@sloccount patool patoolib
|
2010-02-21 11:14:57 +00:00
|
|
|
|
|
|
|
clean:
|
2014-06-27 19:24:23 +00:00
|
|
|
-$(PYTHON) setup.py clean --all
|
|
|
|
find . -name '*.py[co]' -exec rm -f {} \;
|
|
|
|
|
|
|
|
distclean: clean
|
|
|
|
rm -rf build dist $(APPNAME).egg-info
|
|
|
|
rm -f _$(APPNAME)_configdata.py MANIFEST
|
|
|
|
# clean aborted dist builds and output files
|
|
|
|
rm -f testresults.txt
|
|
|
|
rm -rf $(APPNAME)-$(VERSION)
|
|
|
|
rm -f *-stamp*
|
2010-02-21 11:14:57 +00:00
|
|
|
|
2013-04-08 18:12:50 +00:00
|
|
|
localbuild:
|
|
|
|
$(PYTHON) setup.py build
|
|
|
|
|
|
|
|
test: localbuild
|
2012-11-14 19:24:34 +00:00
|
|
|
$(PYTHON) -m pytest $(PYTESTOPTS) $(TESTOPTS) $(TESTS)
|
2010-02-21 11:14:57 +00:00
|
|
|
|
2014-06-09 12:02:19 +00:00
|
|
|
doc/$(APPNAME).txt: doc/$(APPNAME).1
|
2015-12-07 19:16:28 +00:00
|
|
|
# make text file from man page for wheel builds
|
2012-12-17 17:14:58 +00:00
|
|
|
cols=`stty size | cut -d" " -f2`; stty cols 72; man -l $< | sed -e 's/.\cH//g' > $@; stty cols $$cols
|
2010-02-21 18:38:22 +00:00
|
|
|
|
2011-12-27 16:47:28 +00:00
|
|
|
update-copyright:
|
2012-12-17 17:14:58 +00:00
|
|
|
# update-copyright is a local tool which updates the copyright year for each
|
|
|
|
# modified file.
|
|
|
|
update-copyright --holder="$(MAINTAINER)"
|
2012-04-09 10:05:26 +00:00
|
|
|
|
|
|
|
changelog:
|
2012-12-17 17:14:58 +00:00
|
|
|
# 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-11-14 19:24:34 +00:00
|
|
|
|
2015-12-07 19:16:28 +00:00
|
|
|
.PHONY: changelog update-copyright test clean count pyflakes check
|
2013-03-29 10:12:37 +00:00
|
|
|
.PHONY: releasecheck release upload sign dist all tag register homepage
|
2013-04-08 18:12:50 +00:00
|
|
|
.PHONY: localbuild doccheck
|