--- pkpgcounter-3.50.orig/debian/watch
+++ pkpgcounter-3.50/debian/watch
@@ -0,0 +1,4 @@
+version=3
+opts="downloadurlmangle=s/gz\/view/gz/,filenamemangle=s/.*pkpgcounter-(.*)\.tar\.gz\/view/pkpgcounter-$1.tar.gz/" \
+ http://www.pykota.com/software/pkpgcounter/download/tarballs \
+ http://www.pykota.com/software/pkpgcounter/download/tarballs/pkpgcounter-(.*)\.tar\.gz/view
--- pkpgcounter-3.50.orig/debian/compat
+++ pkpgcounter-3.50/debian/compat
@@ -0,0 +1 @@
+5
--- pkpgcounter-3.50.orig/debian/README.source
+++ pkpgcounter-3.50/debian/README.source
@@ -0,0 +1,8 @@
+This package uses quilt to manage all modifications to the upstream
+source. Changes are stored in the source package as diffs in
+debian/patches and applied during the build. Please see:
+
+ /usr/share/doc/quilt/README.source
+
+for more information on how to apply the patches, modify patches, or
+remove a patch.
--- pkpgcounter-3.50.orig/debian/copyright
+++ pkpgcounter-3.50/debian/copyright
@@ -0,0 +1,35 @@
+This package was debianized by Kumar Appaiah <akumar@ee.iitm.ac.in> on
+Sat, 28 Jul 2007 20:57:47 +0530.
+
+It was downloaded from http://www.pykota.com/software/pkpgcounter
+
+Upstream Author:
+
+ Jerome Alet <alet@librelogiciel.com>
+
+Copyright:
+
+ Copyright (C) 2003, 2004, 2005, 2006, 2007 Jerome Alet
+
+License:
+
+ This package is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This package is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this package; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+On Debian systems, the complete text of the GNU General Public License
+version 3 can be found in `/usr/share/common-licenses/GPL-3'.
+
+The Debian packaging is (C) 2007-2008, Kumar Appaiah <akumar@debian.org>
+and and Jerome Alet <alet@librelogiciel.com>, and is licensed under
+the GPL 3, see above.
--- pkpgcounter-3.50.orig/debian/rules
+++ pkpgcounter-3.50/debian/rules
@@ -0,0 +1,56 @@
+#!/usr/bin/make -f
+# -*- makefile -*-
+#export DH_VERBOSE=1
+
+# The versions of python currently supported
+PYTHON=$(shell pyversions -d)
+
+include /usr/share/quilt/quilt.make
+-include /usr/share/python/python.mk
+
+build: build-stamp
+
+build-stamp: patch
+ dh_testdir
+ $(PYTHON) setup.py build
+ touch $@
+
+clean: unpatch
+ dh_testdir
+ dh_testroot
+ rm -f *-stamp
+ rm -rf compile build
+ ./clean.sh
+ dh_clean
+
+install: build install-$(PYTHON)
+
+install-$(PYTHON):
+ dh_testdir
+ dh_testroot
+ $(PYTHON) setup.py install --root `pwd`/debian/pkpgcounter/ $(py_setup_install_args)
+ find ./debian/pkpgcounter/usr/lib -name '*\.py' | xargs sed -i -e '1 s|^#\!.*python.*||'
+ sed -i -e '1 s|^#\!.*python.*|#!/usr/bin/python|' ./debian/pkpgcounter/usr/bin/pkpgcounter
+ rm ./debian/pkpgcounter/usr/share/doc/pkpgcounter/COPYING
+
+# Build architecture-independent files here.
+# Pass to all debhelper commands in this target to reduce clutter.
+binary-indep: build install
+ dh_testdir
+ dh_testroot
+ dh_installdocs
+ dh_installexamples
+ dh_installchangelogs
+ dh_pysupport
+ dh_compress -X.py
+ dh_fixperms
+ dh_installdeb
+ dh_gencontrol
+ dh_md5sums
+ dh_builddeb
+
+binary: binary-indep
+
+binary-arch:
+
+.PHONY: build clean binary-indep binary install
--- pkpgcounter-3.50.orig/debian/pkpgcounter.examples
+++ pkpgcounter-3.50/debian/pkpgcounter.examples
@@ -0,0 +1,7 @@
+tests/colors.pdf
+tests/master.ps.gz
+tests/README
+tests/gstests.py
+tests/runcolors.py
+tests/runtest.sh
+
--- pkpgcounter-3.50.orig/debian/changelog
+++ pkpgcounter-3.50/debian/changelog
@@ -0,0 +1,167 @@
+pkpgcounter (3.50-7) unstable; urgency=low
+
+ [ Christian Kastner ]
+ * Fix FTBFS by removing useless arch-specific dependencies from Recommends.
+ Closes: #583063
+
+ -- Python Applications Packaging Team <python-apps-team@lists.alioth.debian.org> Fri, 25 Jun 2010 18:40:47 +0200
+
+pkpgcounter (3.50-6) unstable; urgency=low
+
+ [ Kumar Appaiah ]
+ * debian/control:
+ + Standards Version is now 3.8.4 (no changes needed)
+ + Build-Depend on python-support above 0.90.
+ + Use "all" instead of "current" for XS-Python-Versions.
+ (Closes: #570561)
+ * debian/rules:
+ + Use the default Python version.
+
+ -- Python Applications Packaging Team <python-apps-team@lists.alioth.debian.org> Sun, 28 Feb 2010 17:08:48 +0100
+
+pkpgcounter (3.50-5) unstable; urgency=low
+
+ [ Julien Lavergne ]
+ * From Ubuntu, prepare for the future python transition:
+ - debian/rules:
+ + Include /usr/share/python/python.mk
+ + Add $(py_setup_install_args) to setup.py install
+ - debian/control:
+ + Bump build-depends to python (>= 2.5.4-1~)
+
+ [ Ryan Kavanagh ]
+ * Added a README.source, as required by Debian Policy Manual section 4.14
+
+ [ Kumar Appaiah ]
+ * Conditionally use python.mk and reduce Build-Depends of Python to
+ 2.3.5-11.
+ * Switch to python-support.
+ * Suggest abiword instead of recommending it. (Closes: #525839)
+
+ -- Kumar Appaiah <akumar@debian.org> Thu, 03 Dec 2009 20:23:41 -0600
+
+pkpgcounter (3.50-4) unstable; urgency=low
+
+ * debian/control:
+ + Don't suggest pcl6, gspcl, ghostpcl and ghostpdl
+ + Correct to recommend texlive-latex-base.
+
+ -- Kumar Appaiah <akumar@debian.org> Sat, 06 Dec 2008 09:19:42 -0600
+
+pkpgcounter (3.50-3) unstable; urgency=low
+
+ * debian/control
+ + switch Vcs-Browser field to viewsvn
+ + Use standards version 3.8.0 (no changes needed).
+ + Use quilt for patches.
+ + Don't depend obsolete gs, gs-esp.
+ + Recommend texlive-latex-bin instead of tetex-bin.
+ + Change my e-mail address to use debian.org address.
+ + fix capitalization in short description.
+ * debian/rules:
+ + Adapt for use with quilt.
+ + Remove ugly rmdir hack.
+ * debian/patches/01_fix_tempfile.diff
+ + Ensure temporary files are closed. (Closes: #507770)
+ * debian/copyright:
+ + Update e-mail addresses, dates.
+ + Refer explicitly to GPL v3.
+
+ -- Kumar Appaiah <akumar@debian.org> Thu, 04 Dec 2008 07:53:44 -0600
+
+pkpgcounter (3.50-2) unstable; urgency=low
+
+ [ Jerome Alet ]
+ * debian/control:
+ + Recommend xauth instead of xbase-clients. (Closes: #475386)
+
+ -- Kumar Appaiah <akumar@ee.iitm.ac.in> Thu, 10 Apr 2008 22:04:16 +0530
+
+pkpgcounter (3.50-1) unstable; urgency=low
+
+ [ Jerome Alet ]
+ * New upstream release.
+ * Upgraded list of supported file formats in control.
+ * Removed unneeded dependency on python-dev.
+ * Added ghostscript as an alternative dependency.
+ * Removed debian/dirs, not needed.
+ * Added missing dependencies.
+ * Removed unnecessary spaces in control.
+ * Changed short description in control.
+
+ [ Kumar Appaiah ]
+ * debian/rules:
+ + Remove emptly usr/lib directory.
+ + No need to call dpatch, as there are no patches.
+ * debian/control:
+ + No patches, so remove dpatch dependency.
+
+ -- Jerome Alet <alet@librelogiciel.com> Mon, 10 Dec 2007 22:04:52 +0100
+
+pkpgcounter (3.40-1) unstable; urgency=low
+
+ * New upstream release.
+ * Removed the manual page patch which is already done upstream.
+ * Remove accented characters in upstream author's name in copyright file.
+ * Added several third party software to Recommends, which are only needed
+ in some use cases.
+ * Changed description to match upstream's one.
+ * Update Standards-Version to 3.7.3.
+
+ -- Jerome Alet <alet@librelogiciel.com> Fri, 30 Nov 2007 11:01:35 +0100
+
+pkpgcounter (3.30-1) unstable; urgency=low
+
+ * New upstream release
+ * Added imagemagick to Recommends
+ * Changed long description to reflect upstream's.
+
+ -- Jerome Alet <alet@librelogiciel.com> Fri, 23 Nov 2007 11:26:57 +0100
+
+pkpgcounter (3.20-1) unstable; urgency=low
+
+ * New upstream release
+ * Rename XS-Vcs-* fields to Vcs-* (dpkg supports them now)
+
+ -- Kumar Appaiah <akumar@ee.iitm.ac.in> Mon, 08 Oct 2007 12:31:06 +0530
+
+pkpgcounter (3.10-1) unstable; urgency=low
+
+ * New upstream release.
+ * Add package to Debian's Python Application Packaging Team.
+ * Added XS-Vcs-Svn and XS-Vcs-Browser.
+ * Add upstream to Uploaders for co-maintenance.
+ * Merge upstream's debian/ directory features, especially control file.
+ * Update 01fix_man.dpatch to fix manpage hyphens.
+ * Add Homepage field to control.
+
+ -- Kumar Appaiah <akumar@ee.iitm.ac.in> Fri, 21 Sep 2007 18:17:58 +0530
+
+pkpgcounter (3.00-1) unstable; urgency=low
+
+ * New upstream release
+ * Use 01_fix_man.dpatch to fix man page.
+ * Remove redundant license
+ * Update watch file
+ * Update copyright to GPL-3.
+
+ -- Kumar Appaiah <akumar@ee.iitm.ac.in> Tue, 11 Sep 2007 13:31:55 +0530
+
+pkpgcounter (2.18-2) unstable; urgency=low
+
+ * Change section to utils.
+ * Depend only on python-dev.
+ * Remove incorrect XS-Vcs-Svn.
+ * Fix hyphens in man page.
+ * Add dependency on python-imaging.
+ * Add "Recommends" for python-psyco
+ * Clean up rules.
+
+ -- Kumar Appaiah <akumar@ee.iitm.ac.in> Wed, 08 Aug 2007 01:03:40 +0530
+
+pkpgcounter (2.18-1) unstable; urgency=low
+
+ * Initial release (Closes: #435030)
+
+ -- Kumar Appaiah <akumar@ee.iitm.ac.in> Sat, 28 Jul 2007 20:57:47 +0530
+
--- pkpgcounter-3.50.orig/debian/control
+++ pkpgcounter-3.50/debian/control
@@ -0,0 +1,53 @@
+Source: pkpgcounter
+Section: utils
+Priority: optional
+Maintainer: Python Applications Packaging Team <python-apps-team@lists.alioth.debian.org>
+Uploaders: Kumar Appaiah <akumar@debian.org>, Jerome Alet <alet@librelogiciel.com>
+Build-Depends-Indep: python (>= 2.3.5-11~), python-support (>= 0.90), python-imaging
+Build-Depends: debhelper (>= 5.0.37.3), quilt
+Standards-Version: 3.8.4
+XS-Python-Version: all
+Vcs-Svn: svn://svn.debian.org/python-apps/packages/pkpgcounter/trunk
+Vcs-Browser: http://svn.debian.org/viewsvn/python-apps/packages/pkpgcounter/trunk/
+Homepage: http://www.pykota.com/software/pkpgcounter
+
+Package: pkpgcounter
+Architecture: all
+Depends: ${python:Depends}, ${misc:Depends}, python-imaging (>= 1.1.2-3.2), ghostscript
+Recommends: python-psyco, imagemagick, xvfb, xauth, texlive-latex-base
+Suggests: abiword
+XB-Python-Version: ${python:Versions}
+Description: computes number of pages or quantity of ink needed to print documents
+ pkpgcounter is a generic Page Description Language parser which can
+ either count the number of pages or compute the percent of ink
+ coverage needed to print various types of documents. It is written in
+ Python.
+ .
+ It currently recognizes the following file formats :
+ .
+ * PostScript (both DSC compliant and binary)
+ * PDF
+ * PCL3/4/5
+ * PCLXL (aka PCL6)
+ * DVI
+ * OpenDocument (ISO/IEC DIS 26300)
+ * Microsoft Word (c) (tm) (r) (etc...)
+ * Plain text
+ * TIFF
+ * Several other image formats
+ * ESC/P2
+ * Zenographics ZjStream
+ * Samsung QPDL (aka SPL2)
+ * Samsung SPL1
+ * ESC/PageS03
+ * Brother HBP
+ * Hewlett-Packard Lightweight Imaging Device Interface Language
+ * Structured Fax
+ * Canon BJ/BJC
+ * ASCII PNM (Netpbm)
+ .
+ The ten latter ones, as well as some TIFF documents, are currently
+ only supported in page counting mode.
+ .
+ pkpgcounter is often used in combination with print
+ accounting solutions like PyKota or JasMine.
--- pkpgcounter-3.50.orig/debian/docs
+++ pkpgcounter-3.50/debian/docs
@@ -0,0 +1,3 @@
+BUGS
+NEWS
+README
--- pkpgcounter-3.50.orig/debian/preinst
+++ pkpgcounter-3.50/debian/preinst
@@ -0,0 +1,9 @@
+#!/bin/sh
+# TODO: remove this file after releasing Squeeze
+set -e
+if [ "$1" = upgrade ] && dpkg --compare-versions "$2" lt 3.50-5
+then
+ pycentral pkgremove pkpgcounter
+fi
+
+#DEBHELPER#
--- pkpgcounter-3.50.orig/debian/source/format
+++ pkpgcounter-3.50/debian/source/format
@@ -0,0 +1 @@
+1.0
--- pkpgcounter-3.50.orig/debian/patches/series
+++ pkpgcounter-3.50/debian/patches/series
@@ -0,0 +1 @@
+01_fix_tempfile.diff
--- pkpgcounter-3.50.orig/debian/patches/01_fix_tempfile.diff
+++ pkpgcounter-3.50/debian/patches/01_fix_tempfile.diff
@@ -0,0 +1,58 @@
+This patch backports some fixes which remove unneeded temporary
+files upon exit, thus preventing accumulation of temporary files.
+
+Index: pkpgcounter-3.50/pkpgpdls/analyzer.py
+===================================================================
+--- pkpgcounter-3.50.orig/pkpgpdls/analyzer.py 2008-12-04 07:35:51.000000000 -0600
++++ pkpgcounter-3.50/pkpgpdls/analyzer.py 2008-12-04 07:37:31.000000000 -0600
+@@ -55,7 +55,6 @@
+ self.options = options
+ self.filename = filename
+ self.workfile = None
+- self.mustclose = None
+
+ def getJobSize(self) :
+ """Returns the job's size."""
+@@ -97,7 +96,6 @@
+
+ def openFile(self) :
+ """Opens the job's data stream for reading."""
+- self.mustclose = False # by default we don't want to close the file when finished
+ if hasattr(self.filename, "read") and hasattr(self.filename, "seek") :
+ # filename is in fact a file-like object
+ infile = self.filename
+@@ -107,7 +105,6 @@
+ else :
+ # normal file
+ self.workfile = open(self.filename, "rb")
+- self.mustclose = True
+ return
+
+ # Use a temporary file, always seekable contrary to standard input.
+@@ -123,8 +120,7 @@
+
+ def closeFile(self) :
+ """Closes the job's data stream if we have to."""
+- if self.mustclose :
+- self.workfile.close()
++ self.workfile.close()
+
+ def readFirstAndLastBlocks(self, inputfile) :
+ """Reads the first and last blocks of data."""
+--- pkpgcounter-3.50.orig/pkpgpdls/pjl.py
++++ pkpgcounter-3.50/pkpgpdls/pjl.py
+@@ -129,12 +129,12 @@
+ klass = PJLParser
+ if arg == "-" :
+ infile = sys.stdin
+- mustclose = 0
++ mustclose = False
+ else :
+ if arg.endswith(".ejl") :
+ klass = EJLParser
+ infile = open(arg, "rb")
+- mustclose = 1
++ mustclose = True
+ try :
+ parser = klass(infile.read(), debug=1)
+ except PJLParserError, msg :