Build and documentation updates
This commit is contained in:
parent
ee3b2497ea
commit
bf1e937db4
107
Makefile
107
Makefile
|
@ -1,12 +1,20 @@
|
|||
# This Makefile is only used by developers.
|
||||
PYVER:=2.7
|
||||
PYTHON:=python$(PYVER)
|
||||
APPNAME:=patool
|
||||
VERSION:=$(shell $(PYTHON) setup.py --version)
|
||||
ARCHIVE_SOURCE:=$(APPNAME)-$(VERSION).tar.gz
|
||||
ARCHIVE_RPM:=$(APPNAME)-$(VERSION)-1.x86_64.rpm
|
||||
ARCHIVE_WIN32:=$(APPNAME)-$(VERSION).exe
|
||||
PY_FILES_DIRS := patool setup.py patoolib tests
|
||||
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_RPM:=$(LAPPNAME)-$(VERSION)-1.x86_64.rpm
|
||||
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)
|
||||
PY2APPOPTS ?=
|
||||
ifeq ($(shell uname),Darwin)
|
||||
CHMODMINUSMINUS:=
|
||||
|
@ -31,7 +39,8 @@ chmod:
|
|||
|
||||
dist:
|
||||
$(PYTHON) setup.py bdist_rpm
|
||||
git archive --format=tar --prefix=$(APPNAME)-$(VERSION)/ HEAD | gzip -9 > dist/$(ARCHIVE_SOURCE)
|
||||
rm dist/*.src.rpm
|
||||
git archive --format=tar --prefix=$(LAPPNAME)-$(VERSION)/ HEAD | gzip -9 > dist/$(ARCHIVE_SOURCE)
|
||||
[ ! -f ../$(ARCHIVE_WIN32) ] || cp ../$(ARCHIVE_WIN32) dist
|
||||
|
||||
sign:
|
||||
|
@ -39,23 +48,37 @@ sign:
|
|||
[ -f dist/$(ARCHIVE_WIN32).asc ] || gpg --detach-sign --armor dist/$(ARCHIVE_WIN32)
|
||||
[ -f dist/$(ARCHIVE_RPM).asc ] || gpg --detach-sign --armor dist/$(ARCHIVE_RPM)
|
||||
|
||||
upload: dist/README.md sign
|
||||
github-upload wummel patool dist/*
|
||||
make -C $(HOMEPAGE)
|
||||
upload:
|
||||
github-upload $(GITUSER) $(GITREPO) dist/$(ARCHIVE_SOURCE)* dist/$(ARCHIVE_WIN32)* dist/$(ARCHIVE_RPM)*
|
||||
|
||||
dist/README.md: doc/README-Download.md.tmpl doc/changelog.txt
|
||||
# copying readme for release
|
||||
sed -e 's/{APPNAME}/$(APPNAME)/g' -e 's/{VERSION}/$(VERSION)/g' $< > $@
|
||||
# append changelog
|
||||
awk '/released/ {c++}; c==2 {exit}; {print " " $$0}' doc/changelog.txt >> $@
|
||||
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 $(HOMEPAGE) gen
|
||||
|
||||
release: clean releasecheck dist upload
|
||||
tag:
|
||||
# add and push the version tag
|
||||
git tag upstream/$(VERSION)
|
||||
git push --tags origin upstream/$(VERSION)
|
||||
|
||||
# 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
|
||||
$(MAKE) dist sign upload homepage tag register deb
|
||||
|
||||
register:
|
||||
@echo "Register at Python Package Index..."
|
||||
$(PYTHON) setup.py register
|
||||
freecode-submit < patool.freecode
|
||||
@echo "Submitting to freecode.org..."
|
||||
freecode-submit < $(LAPPNAME).freecode
|
||||
|
||||
releasecheck: check test
|
||||
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
|
||||
|
@ -63,48 +86,70 @@ releasecheck: check test
|
|||
echo "Missing WIN32 distribution archive at ../$(ARCHIVE_WIN32)"; \
|
||||
false; \
|
||||
fi
|
||||
@if ! grep "Version: $(VERSION)" patool.freecode > /dev/null; then \
|
||||
echo "Could not release: edit patool.freecode version"; false; \
|
||||
@if ! grep "Version: $(VERSION)" $(LAPPNAME).freecode > /dev/null; then \
|
||||
echo "Could not release: edit $(LAPPNAME).freecode version"; false; \
|
||||
fi
|
||||
|
||||
# Build OSX installer
|
||||
app: clean chmod
|
||||
# Build OSX installer
|
||||
$(PYTHON) setup.py py2app $(PY2APPOPTS)
|
||||
|
||||
check:
|
||||
# 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:
|
||||
[ ! -d .svn ] || check-nosvneolstyle -v
|
||||
check-copyright
|
||||
check-pofiles -v
|
||||
py-tabdaddy
|
||||
py-unittest2-compat tests/
|
||||
$(MAKE) doccheck
|
||||
|
||||
doccheck:
|
||||
py-check-docstrings --force \
|
||||
patoolib \
|
||||
patool \
|
||||
*.py
|
||||
|
||||
pyflakes:
|
||||
pyflakes $(PY_FILES_DIRS)
|
||||
pyflakes setup.py patool patoolib tests
|
||||
|
||||
count:
|
||||
@sloccount patool patoolib | grep "Total Physical Source Lines of Code"
|
||||
# print some code statistics
|
||||
@sloccount patool patoolib
|
||||
|
||||
clean:
|
||||
find . -name \*.pyc -delete
|
||||
find . -name \*.pyo -delete
|
||||
rm -rf build dist doc/README.md
|
||||
rm -rf build dist
|
||||
|
||||
test:
|
||||
$(PYTHON) -m pytest $(PYTESTOPTS) $(TESTOPTS) $(TESTS)
|
||||
|
||||
doc/patool.txt: doc/patool.1
|
||||
cols=`stty size | cut -d" " -f2`; stty cols 72; man -l doc/patool.1 | perl -pe 's/.\cH//g' > doc/patool.txt; stty cols $$cols
|
||||
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
|
||||
|
||||
deb:
|
||||
git-buildpackage --git-upstream-branch=master --git-debian-branch=debian --git-ignore-new
|
||||
# build a debian package
|
||||
[ -f $(DEBORIGFILE) ] || cp dist/$(ARCHIVE_SOURCE) $(DEBORIGFILE) $(DEBUILDDIR)/$(APPNAME)_$(VERSION).orig.tar.gz
|
||||
sed -i 's/VERSION:=.*/VERSION:=$(VERSION)/' $(DEBUILDDIR)/$(LAPPNAME).mak
|
||||
[ -d $(DEBPACKAGEDIR) ] || (cd $(DEBUILDDIR); \
|
||||
patool extract $(DEBORIGFILE); \
|
||||
cd $(CURDIR); \
|
||||
git checkout debian; \
|
||||
cp -r debian $(DEBPACKAGEDIR); \
|
||||
git checkout master)
|
||||
rm -f $(DEBUILDDIR)/$(PACKAGE)
|
||||
$(MAKE) -C $(DEBUILDDIR) $(PACKAGE)
|
||||
|
||||
update-copyright:
|
||||
update-copyright --holder="Bastian Kleineidam"
|
||||
# update-copyright is a local tool which updates the copyright year for each
|
||||
# modified file.
|
||||
update-copyright --holder="$(MAINTAINER)"
|
||||
|
||||
changelog:
|
||||
github-changelog $(DRYRUN) wummel patool doc/changelog.txt
|
||||
# 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
|
||||
|
||||
.PHONY: changelog update-copyright deb test clean count pyflakes check app
|
||||
.PHONY: releasecheck release upload sign dist chmod all
|
||||
.PHONY: releasecheck release upload sign dist chmod all tag register
|
||||
|
|
|
@ -1,36 +0,0 @@
|
|||
{APPNAME} Downloads
|
||||
======================
|
||||
|
||||
{APPNAME} {VERSION} is available for download for Windows and
|
||||
Linux systems and in source format.
|
||||
|
||||
Files
|
||||
------
|
||||
|
||||
* `{APPNAME}-{VERSION}.exe`:
|
||||
The Windows installer. If you run Windows, use this. The installer is
|
||||
signed with a local certificate signature.
|
||||
* `{APPNAME}-{VERSION}-1.x86_64.rpm`:
|
||||
The Linux RPM package compiled for the x86/64bit architecture.
|
||||
If you have an RPM based Linux distribution and a 64bit x86 processor,
|
||||
use this.
|
||||
* `{APPNAME}-{VERSION}.tar.gz`:
|
||||
The source code. See `doc/install.txt` for compilation and installation
|
||||
instructions.
|
||||
|
||||
The `.asc` files are GPG signatures that you can use to verify that the
|
||||
download is indeed made by the owner of the GPG key below (ie. me).
|
||||
For example download the `.tar.gz.asc` file in the same directory as the
|
||||
`.tar.gz` file and run `gpg --verify {APPNAME}-{VERSION}.tar.gz`
|
||||
|
||||
The GPG key used to sign these packages is 32EC6F3E. It can be
|
||||
downloaded with `gpg --keyserver wwwkeys.pgp.net --recv-keys 32EC6F3E`.
|
||||
|
||||
The `.sha1` files contain checksums that you can use to verify the
|
||||
file integrity. Download the `.sha1` file in the same directory as
|
||||
the `.tar.gz` file and run `sha1sum -c {APPNAME}-{VERSION}.tar.gz.sha1`
|
||||
|
||||
|
||||
Changelog for this release
|
||||
---------------------------
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
Project: patool
|
||||
Version: 0.17
|
||||
Version: 0.18
|
||||
Release-Focus: Minor feature enhancements
|
||||
Hide: N
|
||||
Website-URL: http://github.com/wummel/patool
|
||||
|
@ -9,5 +9,5 @@ GIT-Tree-URL: https://github.com/wummel/patool.git
|
|||
Windows-installer-URL: http://github.com/downloads/wummel/patool/patool-${version}.win32.exe
|
||||
|
||||
Support has been added for chmlib and archmage handling
|
||||
Microsoft ITSS/CHM (.chm) archives. Also the project moved from
|
||||
sourceforge to github.
|
||||
Microsoft ITSS/CHM (.chm) archives. The project moved from
|
||||
Sourceforge to Github.
|
||||
|
|
|
@ -526,6 +526,7 @@ def _handle_archive (archive, command, *args, **kwargs):
|
|||
|
||||
|
||||
def get_archive_cmdlist_func (program, command, format):
|
||||
"""Get the Python function that executes the given program."""
|
||||
# get python module for given archive program
|
||||
key = util.stripext(os.path.basename(program).lower())
|
||||
modulename = ".programs." + ProgramModules.get(key, key)
|
||||
|
|
|
@ -107,7 +107,9 @@ def totype(v, default):
|
|||
return v
|
||||
|
||||
|
||||
class CommandError(Exception): pass
|
||||
class CommandError(Exception):
|
||||
"""Error for baker commands."""
|
||||
pass
|
||||
|
||||
|
||||
class Cmd(object):
|
||||
|
@ -116,6 +118,7 @@ class Cmd(object):
|
|||
|
||||
def __init__(self, name, fn, argnames, keywords, shortopts,
|
||||
has_varargs, has_kwargs, docstring, paramdocs):
|
||||
"""Store given metadata."""
|
||||
self.name = name
|
||||
self.fn = fn
|
||||
self.argnames = argnames
|
||||
|
@ -129,7 +132,10 @@ class Cmd(object):
|
|||
|
||||
|
||||
class Baker(object):
|
||||
"""Main class."""
|
||||
|
||||
def __init__(self):
|
||||
"""Initialize command variables."""
|
||||
self.commands = {}
|
||||
self.defaultcommand = None
|
||||
|
||||
|
@ -343,6 +349,7 @@ class Baker(object):
|
|||
sys.exit(0)
|
||||
|
||||
def parse_args(self, scriptname, cmd, argv):
|
||||
"""Parse command arguments."""
|
||||
keywords = cmd.keywords
|
||||
shortopts = cmd.shortopts
|
||||
|
||||
|
|
|
@ -34,5 +34,6 @@ def create_ape (archive, compression, cmd, *args, **kwargs):
|
|||
|
||||
|
||||
def test_ape (archive, compression, cmd, **kwargs):
|
||||
"""Test an APE archive."""
|
||||
cmdlist = [cmd, archive, '-v']
|
||||
return cmdlist
|
||||
|
|
|
@ -42,6 +42,7 @@ def create_tar (archive, compression, cmd, *args, **kwargs):
|
|||
return cmdlist
|
||||
|
||||
def add_tar_opts (cmdlist, compression, verbose):
|
||||
"""Add tar options to cmdlist."""
|
||||
progname = os.path.basename(cmdlist[0])
|
||||
if compression == 'gzip':
|
||||
cmdlist.append('-z')
|
||||
|
|
|
@ -91,10 +91,13 @@ class memoized (object):
|
|||
not re-evaluated."""
|
||||
|
||||
def __init__(self, func):
|
||||
"""Set func and init cache."""
|
||||
self.func = func
|
||||
self.cache = {}
|
||||
|
||||
def __call__(self, *args):
|
||||
"""Try to find result for function arguments in local cache or
|
||||
execute the function and fill the cache with the result."""
|
||||
try:
|
||||
return self.cache[args]
|
||||
except KeyError:
|
||||
|
|
Loading…
Reference in New Issue