Build updates

This commit is contained in:
Bastian Kleineidam 2012-12-17 21:28:20 +01:00
parent 905ae36174
commit 5cb4c24fad
10 changed files with 837 additions and 605 deletions

View file

@ -1,7 +1,6 @@
include MANIFEST.in
include COPYING Makefile requirements.txt
include *.bat
include doc/Makefile doc/*.txt doc/*.1 doc/*.html
include doc/css/*.css doc/js/*.js
include scripts/*.py scripts/*.sh
include scripts/*.py scripts/*.sh scripts/*.bat
recursive-include tests *.py

View file

@ -2,7 +2,18 @@
PYVER:=2.7
PYTHON:=python$(PYVER)
VERSION:=$(shell $(PYTHON) setup.py --version)
ARCHIVE:=dosage-$(VERSION).tar.gz
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)
PY_FILES_DIRS := dosage dosagelib scripts tests
PY2APPOPTS ?=
# Default pytest options:
@ -24,32 +35,57 @@ chmod:
find . -type d -exec chmod 755 {} \;
dist:
git archive --format=tar --prefix=dosage-$(VERSION)/ HEAD | gzip -9 > ../$(ARCHIVE)
[ -f ../$(ARCHIVE).sha1 ] || sha1sum ../$(ARCHIVE) > ../$(ARCHIVE).sha1
[ -f ../$(ARCHIVE).asc ] || gpg --detach-sign --armor ../$(ARCHIVE)
[ -d dist ] || mkdir dist
git archive --format=tar --prefix=$(LAPPNAME)-$(VERSION)/ HEAD | gzip -9 > dist/$(ARCHIVE_SOURCE)
[ ! -f ../$(ARCHIVE_WIN32) ] || cp ../$(ARCHIVE_WIN32) dist
doc/dosage.1.html: doc/dosage.1
man2html -r $< | tail -n +2 | sed 's/Time:.*//g' | sed 's@/:@/@g' > $@
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)
release: distclean releasecheck dist
git tag v$(VERSION)
upload:
github-upload $(GITUSRE) $(GITREPO) \
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
release: distclean releasecheck dist sign upload homepage tag register
tag:
git tag upstream/$(VERSION)
git push --tags origin upstream/$(VERSION)
register:
@echo "Register at Python Package Index..."
$(PYTHON) setup.py register
freecode-submit < dosage.freecode
@echo "Submit to freecode..."
freecode-submit < $(LAPPNAME).freecode
releasecheck: 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 ! grep "Version: $(VERSION)" dosage.freecode > /dev/null; then \
# echo "Could not release: edit dosage.freecode version"; false; \
# fi
@if ! grep "Version: $(VERSION)" $(LAPPNAME).freecode > /dev/null; then \
echo "Could not release: edit $(LAPPNAME).freecode version"; false; \
fi
# 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
@ -67,7 +103,7 @@ pyflakes:
pyflakes $(PY_FILES_DIRS)
count:
@sloccount $(PY_FILES_DIRS) | grep "Total Physical Source Lines of Code"
@sloccount $(PY_FILES_DIRS)
clean:
find . -name \*.pyc -delete
@ -75,8 +111,8 @@ clean:
rm -rf build dist
distclean: clean
rm -rf build dist Dosage.egg-info dosage.prof test.sh testresults.txt
rm -f _Dosage_configdata.py MANIFEST
rm -rf build dist $(APPNAME).egg-info dosage.prof test.sh testresults.txt
rm -f _$(APPNAME)_configdata.py MANIFEST
localbuild:
$(PYTHON) setup.py build
@ -84,11 +120,32 @@ localbuild:
test: localbuild
env LANG=en_US.utf-8 http_proxy="" $(PYTHON) -m pytest $(PYTESTOPTS) $(TESTOPTS) $(TESTS)
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)/$(LAPPNAME)_$(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)/$(LAPPNAME)
$(MAKE) -C $(DEBUILDDIR) $(LAPPNAME)
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)"
.PHONY: update-copyright deb test clean distclean count pyflakes
.PHONY: doccheck check releasecheck release dist chmod localbuild
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
.PHONY: update-copyright deb test clean distclean count pyflakes changelog
.PHONY: doccheck check releasecheck release dist chmod localbuild sign register tag

View file

@ -1,14 +1,11 @@
MANFILES:=dosage.1.html
all: dosage.1.html dosage.txt
all: man testresults.html
man: $(MANFILES)
dosage.txt: dosage.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
dosage.1.html: dosage.1
man2html -r $< | tail -n +2 | sed 's/Time:.*//g' | sed 's@/:@/@g' > $@
# patch --no-backup-if-mismatch --quiet $@ dosage.1.html.diff
patch --no-backup-if-mismatch --quiet $@ dosage.1.html.diff
testresults.html: ../testresults.txt
../scripts/mktestpage.py $< > $@
.PHONY: all man
.PHONY: all

View file

@ -166,7 +166,7 @@ Jonathan Jacobs <korpse@slipgate.za.net>
.br
Tristan Seligmann <mithrandi@slipgate.za.net>
.br
Bastian Kleineidam <calvin@users.sourceforge.net>
Bastian Kleineidam <bastian.kleineidam@web.de>
.SH COPYRIGHT
Copyright \(co 2004-2005 Tristan Seligmann and Jonathan Jacobs
.br

View file

@ -4,7 +4,7 @@
</HEAD><BODY>
<H1>DOSAGE</H1>
Section: User Commands (1)<BR><A HREF="#index">Index</A>
<A HREF="../index.html">Return to Main Contents</A><HR>
<A HREF="index.html">Return to Main Contents</A><HR>
<A NAME="lbAB">&nbsp;</A>
<H2>NAME</H2>
@ -240,7 +240,7 @@ Jonathan Jacobs &lt;<A HREF="mailto:korpse@slipgate.za.net">korpse@slipgate.za.n
Tristan Seligmann &lt;<A HREF="mailto:mithrandi@slipgate.za.net">mithrandi@slipgate.za.net</A>&gt;
<BR>
Bastian Kleineidam &lt;<A HREF="mailto:calvin@users.sourceforge.net">calvin@users.sourceforge.net</A>&gt;
Bastian Kleineidam &lt;<A HREF="mailto:bastian.kleineidam@web.de">bastian.kleineidam@web.de</A>&gt;
<A NAME="lbAN">&nbsp;</A>
<H2>COPYRIGHT</H2>
@ -269,7 +269,7 @@ Copyright &#169; 2012 Bastian Kleineidam
</DL>
<HR>
This document was created by
<A HREF="/cgi-bin/man/man2html">man2html</A>,
man2html,
using the manual pages.<BR>
</BODY>

22
doc/dosage.1.html.diff Normal file
View file

@ -0,0 +1,22 @@
diff --git i/doc/dosage.1.html w/doc/dosage.1.html
index e4f07f0..b8110eb 100644
--- i/doc/dosage.1.html
+++ w/doc/dosage.1.html
@@ -4,7 +4,7 @@
</HEAD><BODY>
<H1>DOSAGE</H1>
Section: User Commands (1)<BR><A HREF="#index">Index</A>
-<A HREF="../index.html">Return to Main Contents</A><HR>
+<A HREF="index.html">Return to Main Contents</A><HR>
<A NAME="lbAB">&nbsp;</A>
<H2>NAME</H2>
@@ -269,7 +269,7 @@ Copyright &#169; 2012 Bastian Kleineidam
</DL>
<HR>
This document was created by
-<A HREF="/cgi-bin/man/man2html">man2html</A>,
+man2html,
using the manual pages.<BR>
</BODY>

160
doc/dosage.txt Normal file
View file

@ -0,0 +1,160 @@
DOSAGE(1) DOSAGE(1)
NAME
dosage - a commandline webcomic downloader and archiver
SYNOPSIS
dosage [options] module...
DESCRIPTION
dosage is an application designed to keep a local mirror of
specific web comics and other picture-based content, such as
Picture Of The Day sites, with a variety of options for updat
ing and maintaining collections.
OPTIONS
-b PATH, --basepath=PATH
Specifies a base path to put comic subdirectories. The
default is Comics.
--baseurl=PATH
Specifies the base URL for output events. The default is
a local file URI.
-a, --all
Traverses all available strips backwards from the cur
rent one. This can be useful you want a full collection
of a new comic strip, or update an existing one where
files are missing. Catchups can start at a specific
strip by using the index syntax, see the INDEX SYNTAX
and SPECIAL SYNTAX sections for more information. This
is useful when you missed some days and want only to
download the missing files. To make this task easy, the
traversal ends at the first existing image file when
starting from an index (excluding the index itself).
-h, --help
Output brief help information.
-l, --list
List available comic modules in multi-column fashion.
--singlelist
List available comic modules in single-column fashion.
-m MODULE, --modulehelp=MODULE
Output module-specific help for MODULE.
-o OUTPUT, --output=OUTPUT
OUTPUT may be any one of the following:
html - Writes out an HTML file linking to the strips
actually downloaded in the current run, named by date
(ala dailystrips). The files can be found in the html
directory of your Comics directory.
rss - Writes out an RSS feed detailing what strips were
downloaded in the last 24 hours. The feed can be found
in Comics/dailydose.xml.
rss - Writes an RSS feed with all of the strips down
loaded during the run, for use with your favourite RSS
aggregator.
-t, --timestamps
Print timestamps for all output at any level.
-v, --verbose
Increase the output level by one with each occurence.
-V, --version
Display the version number. module At least one valid
module must be specified. A list of valid modules can be
found by passing the -l option. Multiple module argu
ments can be specified on the command line. Module
names are case insensitive, and it is sufficient to
specify a unique substring of the module name.
INDEX SYNTAX
Instead of starting at the latest comic strip, an index lets
dosage start at a certain strip. The index can be specified by
appending a colon : and the index name after the module. Multi
ple comma-spearated indices can also be specified.
The index name itself usually is the part of the comic strip
URL that identifiess a strip, eg. a number or a date. The
expected format is documented when using the --modulehelp
option.
SPECIAL SYNTAX
@ This expands to mean all the comics currently in your
Comics directory. All other specified comic module names
will be ignored.
@@ This expands to mean all the comics available to Dosage.
INDEX SYNTAX can not be used with SPECIAL SYNTAX.
EXAMPLES
Retrieve all Mega Tokyo comics:
dosage -a megatokyo
Retrieve the current comic of Cyanide and Happiness:
dosage cyanideandhappiness
Retrieve the current strip of all comics in your Comics direc
tory:
dosage @
Retrieve the current strip of every comic that there is a mod
ule for:
dosage @@
Retrieve the Penny Arcade strip for a given index:
dosage pennyarcade:2004-07-22
Retrieve Calvin and Hobbes strips from a given index going
backwards to the beginning until an existing file is found:
dosage -c calvinandhobbes:20120722
ENVIRONMENT
HTTP_PROXY
mainline will use the specified HTTP proxy when down
loading URL contents.
NOTES
Should retrieval fail on any given strip mainline will attempt
to retry. However the retry information is only outputted in
the second and successive output levels.
At the time of writing, a complete Dosage collection weighs in
at around 3.0GB.
RETURN VALUE
The return value greater than zero when
· a program error occurred.
· comics could not be found or downloaded
· the program run was aborted with Ctrl-C
Else the return value is zero.
BUGS
Users can report or view bugs, patches or feature suggestions
at https://github.com/wummel/dosage/issues
AUTHORS
Jonathan Jacobs <korpse@slipgate.za.net>
Tristan Seligmann <mithrandi@slipgate.za.net>
Bastian Kleineidam <bastian.kleineidam@web.de>
COPYRIGHT
Copyright © 2004-2005 Tristan Seligmann and Jonathan Jacobs
Copyright © 2012 Bastian Kleineidam
DOSAGE(1)

File diff suppressed because it is too large Load diff

View file

@ -3,30 +3,25 @@
from __future__ import print_function
import sys
import os
import stat
import time
sys.path.append(os.path.join(os.path.dirname(__file__), ".."))
from dosagelib.scraper import get_scrapers
htmltemplate = """
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<title>Dosage test results</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" href="css/normalize.css">
<link rel="stylesheet" href="css/main.css">
<link rel="stylesheet" href="css/dosage.css">
<script src="js/masonry.min.js"></script>
<script src="http://use.edgefonts.net/open-sans.js"></script>
</head>
<body>
<p>Dosage test results from %(date)s</p>
<p>Note that it is almost impossible to get a 100% OK test run
due to temporary network failures or sites that are just updating
the comic page.</p>
<div id="container">
---
extends: base.j2
default_block: content
title: Dosage by Bastian Kleineidam
description: a commandline webcomic downloader and archiver
---
<div class="inner clearfix">
<section id="main-content">
<h2>Dosage test results from %(date)s</h2>
<p>Note that it is almost impossible to get a 100%% OK test run
due to temporary site failures.</p>
<div id="testresults">
%(content)s
</div>
<script>
@ -36,14 +31,12 @@ window.onload = function() {
});
};
</script>
</body>
</html>
"""
def get_mtime (filename):
"""Return modification time of filename."""
return os.stat(filename)[stat.ST_MTIME]
return os.path.getmtime(filename)
def strdate(t):

View file

@ -20,6 +20,7 @@ except ImportError:
has_py2exe = False
from distutils.core import setup, Distribution
from distutils.command.install_lib import install_lib
from distutils.command.register import register
from distutils import util
from distutils.file_util import write_file
@ -339,6 +340,16 @@ except ImportError:
pass
class MyRegister (register, object):
"""Custom register command."""
def build_post_data(self, action):
"""Force application name to lower case."""
data = super(MyRegister, self).build_post_data(action)
data['name'] = data['name'].lower()
return data
args = dict(
name = AppName,
version = AppVersion,
@ -361,6 +372,7 @@ args = dict(
cmdclass = {
'install_lib': MyInstallLib,
'py2exe': MyPy2exe,
'register': MyRegister,
},
options = {
"py2exe": py2exe_options,