patool/Makefile

160 lines
4.8 KiB
Makefile
Raw Normal View History

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
ARCHIVE_WIN32:=$(APPNAME)-$(VERSION).exe
2012-12-17 17:14:58 +00:00
GITUSER:=wummel
2014-06-09 12:02:19 +00:00
GITREPO:=$(APPNAME)
HOMEPAGE:=$(HOME)/public_html/patool-webpage.git
2013-07-19 13:15:17 +00:00
WEBMETA:=doc/web/app.yaml
2015-07-28 08:21:23 +00:00
DEBUILDDIR:=$(HOME)/projects/debian/unofficial
2014-06-09 12:02:19 +00:00
DEBORIGFILE:=$(DEBUILDDIR)/$(APPNAME)_$(VERSION).orig.tar.gz
DEBPACKAGEDIR:=$(DEBUILDDIR)/$(APPNAME)-$(VERSION)
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
2014-06-09 12:02:19 +00:00
$(PYTHON) setup.py sdist --formats=tar
gzip --best dist/$(APPNAME)-$(VERSION).tar
# [ ! -f ../$(ARCHIVE_WIN32) ] || cp ../$(ARCHIVE_WIN32) dist
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)
# [ -f dist/$(ARCHIVE_WIN32).asc ] || gpg --detach-sign --armor dist/$(ARCHIVE_WIN32)
2010-02-21 11:14:57 +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 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)
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:
@echo "Register at Python Package Index..."
2011-12-27 16:47:28 +00:00
$(PYTHON) setup.py register
2012-12-17 17:14:58 +00:00
releasecheck: test check
@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 ! 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
# @if [ ! -f ../$(ARCHIVE_WIN32) ]; then \
# echo "Missing WIN32 distribution archive at ../$(ARCHIVE_WIN32)"; \
# false; \
# fi
$(PYTHON) setup.py check --restructuredtext
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
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
2012-12-17 17:14:58 +00:00
# make text file from man page for Windows builds
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
deb:
2012-12-17 17:14:58 +00:00
# build a debian package
2013-02-20 20:03:55 +00:00
[ -f $(DEBORIGFILE) ] || cp dist/$(ARCHIVE_SOURCE) $(DEBORIGFILE)
2014-06-27 19:50:28 +00:00
sed -i -e 's/VERSION_$(APPNAME):=.*/VERSION_$(APPNAME):=$(VERSION)/' $(DEBUILDDIR)/$(APPNAME).mak
2012-12-17 17:14:58 +00:00
[ -d $(DEBPACKAGEDIR) ] || (cd $(DEBUILDDIR); \
patool extract $(DEBORIGFILE); \
cd $(CURDIR); \
git checkout debian; \
cp -r debian $(DEBPACKAGEDIR); \
2013-02-22 17:31:33 +00:00
rm -f $(DEBPACKAGEDIR)/debian/.gitignore; \
2012-12-17 17:14:58 +00:00
git checkout master)
2014-06-09 12:02:19 +00:00
$(MAKE) -C $(DEBUILDDIR) $(APPNAME)_clean $(APPNAME)
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)"
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
2013-04-08 18:12:50 +00:00
.PHONY: changelog update-copyright deb 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