patool/Makefile

146 lines
4.5 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)
LAPPNAME:=$(shell echo $(APPNAME)|tr "[A-Z]" "[a-z]")
ARCHIVE_SOURCE:=$(LAPPNAME)-$(VERSION).tar.gz
ARCHIVE_WIN32:=$(LAPPNAME)-$(VERSION).exe
GITUSER:=wummel
GITREPO:=$(LAPPNAME)
2013-03-29 10:12:37 +00:00
WEB_META:=doc/web/app.yaml
2013-03-04 18:12:15 +00:00
DEBUILDDIR:=$(HOME)/projects/debian/official
2012-12-17 17:14:58 +00:00
DEBORIGFILE:=$(DEBUILDDIR)/$(LAPPNAME)_$(VERSION).orig.tar.gz
DEBPACKAGEDIR:=$(DEBUILDDIR)/$(LAPPNAME)-$(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
2012-12-17 17:14:58 +00:00
git archive --format=tar --prefix=$(LAPPNAME)-$(VERSION)/ HEAD | gzip -9 > dist/$(ARCHIVE_SOURCE)
2012-12-14 21:04:48 +00:00
[ ! -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
2012-12-17 17:14:58 +00:00
upload:
2012-12-17 20:04:32 +00:00
github-upload $(GITUSER) $(GITREPO) \
dist/$(ARCHIVE_SOURCE) dist/$(ARCHIVE_WIN32) \
dist/$(ARCHIVE_SOURCE).asc dist/$(ARCHIVE_WIN32).asc
2012-12-17 17:14:58 +00:00
homepage:
# update metadata
2013-03-29 10:12:37 +00:00
@echo "version: \"$(VERSION)\"" > $(WEB_META)
@echo "name: \"$(APPNAME)\"" >> $(WEB_META)
@echo "lname: \"$(LAPPNAME)\"" >> $(WEB_META)
@echo "maintainer: \"$(MAINTAINER)\"" >> $(WEB_META)
@echo "author: \"$(AUTHOR)\"" >> $(WEB_META)
2013-06-27 20:33:08 +00:00
git add $(WEB_META)
git cm "Updated web meta data."
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.
release: clean releasecheck
2013-04-11 16:29:01 +00:00
$(MAKE) dist sign upload homepage tag register changelog deb
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
@echo "Submitting to freecode.org..."
freecode-submit < $(LAPPNAME).freecode
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
2010-10-04 17:32:04 +00:00
@if [ ! -f ../$(ARCHIVE_WIN32) ]; then \
echo "Missing WIN32 distribution archive at ../$(ARCHIVE_WIN32)"; \
false; \
fi
2012-12-17 17:14:58 +00:00
@if ! grep "Version: $(VERSION)" $(LAPPNAME).freecode > /dev/null; then \
echo "Could not release: edit $(LAPPNAME).freecode version"; false; \
fi
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:
find . -name \*.pyc -delete
find . -name \*.pyo -delete
2012-12-17 17:14:58 +00:00
rm -rf build dist
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
2012-12-17 17:14:58 +00:00
doc/$(LAPPNAME).txt: doc/$(LAPPNAME).1
# 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)
2012-12-21 21:23:24 +00:00
sed -i -e 's/VERSION_$(LAPPNAME):=.*/VERSION_$(LAPPNAME):=$(VERSION)/' $(DEBUILDDIR)/$(LAPPNAME).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)
2012-12-21 21:23:24 +00:00
$(MAKE) -C $(DEBUILDDIR) $(LAPPNAME)_clean $(LAPPNAME)
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