pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/print/py-Pdf Convert to python-3.x and distutils.mk.



details:   https://anonhg.NetBSD.org/pkgsrc/rev/80c967f438f7
branches:  trunk
changeset: 629561:80c967f438f7
user:      wiz <wiz%pkgsrc.org@localhost>
date:      Thu Jan 23 14:38:42 2014 +0000

description:
Convert to python-3.x and distutils.mk.
Bump PKGREVISION.

diffstat:

 print/py-Pdf/Makefile                       |   7 +-
 print/py-Pdf/PLIST                          |   3 +-
 print/py-Pdf/distinfo                       |   5 +-
 print/py-Pdf/patches/patch-pyPdf_generic.py |  69 +++++++++++++++++++++++++++++
 print/py-Pdf/patches/patch-pyPdf_pdf.py     |  53 ++++++++++++++++++++++
 print/py-Pdf/patches/patch-pyPdf_utils.py   |  31 +++++++++++++
 6 files changed, 162 insertions(+), 6 deletions(-)

diffs (210 lines):

diff -r e8e3d6ed859e -r 80c967f438f7 print/py-Pdf/Makefile
--- a/print/py-Pdf/Makefile     Thu Jan 23 14:15:12 2014 +0000
+++ b/print/py-Pdf/Makefile     Thu Jan 23 14:38:42 2014 +0000
@@ -1,7 +1,8 @@
-# $NetBSD: Makefile,v 1.5 2012/10/08 13:45:45 asau Exp $
+# $NetBSD: Makefile,v 1.6 2014/01/23 14:38:42 wiz Exp $
 
 DISTNAME=      pyPdf-1.13
 PKGNAME=       ${PYPKGPREFIX}-Pdf-1.13
+PKGREVISION=   1
 CATEGORIES=    print python
 MASTER_SITES=  http://pybrary.net/pyPdf/
 
@@ -10,7 +11,5 @@
 COMMENT=       PDF library
 LICENSE=       modified-bsd
 
-PYDISTUTILSPKG=        yes
-
-.include "../../lang/python/extension.mk"
+.include "../../lang/python/distutils.mk"
 .include "../../mk/bsd.pkg.mk"
diff -r e8e3d6ed859e -r 80c967f438f7 print/py-Pdf/PLIST
--- a/print/py-Pdf/PLIST        Thu Jan 23 14:15:12 2014 +0000
+++ b/print/py-Pdf/PLIST        Thu Jan 23 14:38:42 2014 +0000
@@ -1,4 +1,5 @@
-@comment $NetBSD: PLIST,v 1.2 2009/06/14 18:11:59 joerg Exp $
+@comment $NetBSD: PLIST,v 1.3 2014/01/23 14:38:42 wiz Exp $
+${PYSITELIB}/${EGG_FILE}
 ${PYSITELIB}/pyPdf/__init__.py
 ${PYSITELIB}/pyPdf/__init__.pyc
 ${PYSITELIB}/pyPdf/__init__.pyo
diff -r e8e3d6ed859e -r 80c967f438f7 print/py-Pdf/distinfo
--- a/print/py-Pdf/distinfo     Thu Jan 23 14:15:12 2014 +0000
+++ b/print/py-Pdf/distinfo     Thu Jan 23 14:38:42 2014 +0000
@@ -1,5 +1,8 @@
-$NetBSD: distinfo,v 1.3 2011/04/15 08:49:00 adam Exp $
+$NetBSD: distinfo,v 1.4 2014/01/23 14:38:42 wiz Exp $
 
 SHA1 (pyPdf-1.13.tar.gz) = ba7aed11cf21a2c218df2e3979be5eb90992dcbe
 RMD160 (pyPdf-1.13.tar.gz) = 0669d4a93c20fcd899d15ff42cb1b8b908f28e3b
 Size (pyPdf-1.13.tar.gz) = 35699 bytes
+SHA1 (patch-pyPdf_generic.py) = c661b2fd4cea8679ac551733ea25b7efa9fbb37d
+SHA1 (patch-pyPdf_pdf.py) = b4e2822531b6d54676c1d7e5d672e1fe50f50ee5
+SHA1 (patch-pyPdf_utils.py) = 11b14d0c3bdbdac04312f1a4f8eb9f27c6d09009
diff -r e8e3d6ed859e -r 80c967f438f7 print/py-Pdf/patches/patch-pyPdf_generic.py
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/print/py-Pdf/patches/patch-pyPdf_generic.py       Thu Jan 23 14:38:42 2014 +0000
@@ -0,0 +1,69 @@
+$NetBSD: patch-pyPdf_generic.py,v 1.1 2014/01/23 14:38:42 wiz Exp $
+
+python-3.x compatibility.
+
+--- pyPdf/generic.py.orig      2010-12-04 22:49:56.000000000 +0000
++++ pyPdf/generic.py
+@@ -99,7 +99,7 @@ class NullObject(PdfObject):
+     def readFromStream(stream):
+         nulltxt = stream.read(4)
+         if nulltxt != "null":
+-            raise utils.PdfReadError, "error reading null object"
++            raise utils.PdfReadError("error reading null object")
+         return NullObject()
+     readFromStream = staticmethod(readFromStream)
+ 
+@@ -137,7 +137,7 @@ class ArrayObject(list, PdfObject):
+         arr = ArrayObject()
+         tmp = stream.read(1)
+         if tmp != "[":
+-            raise utils.PdfReadError, "error reading array"
++            raise utils.PdfReadError("error reading array")
+         while True:
+             # skip leading whitespace
+             tok = stream.read(1)
+@@ -425,7 +425,7 @@ class NameObject(str, PdfObject):
+     def readFromStream(stream):
+         name = stream.read(1)
+         if name != "/":
+-            raise utils.PdfReadError, "name read error"
++            raise utils.PdfReadError("name read error")
+         while True:
+             tok = stream.read(1)
+             if tok.isspace() or tok in NameObject.delimiterCharacters:
+@@ -517,7 +517,7 @@ class DictionaryObject(dict, PdfObject):
+     def readFromStream(stream, pdf):
+         tmp = stream.read(2)
+         if tmp != "<<":
+-            raise utils.PdfReadError, "dictionary read error"
++            raise utils.PdfReadError("dictionary read error")
+         data = {}
+         while True:
+             tok = readNonWhitespace(stream)
+@@ -531,7 +531,7 @@ class DictionaryObject(dict, PdfObject):
+             value = readObject(stream, pdf)
+             if data.has_key(key):
+                 # multiple definitions of key not permitted
+-                raise utils.PdfReadError, "multiple definitions in dictionary"
++                raise utils.PdfReadError("multiple definitions in dictionary")
+             data[key] = value
+         pos = stream.tell()
+         s = readNonWhitespace(stream)
+@@ -570,7 +570,7 @@ class DictionaryObject(dict, PdfObject):
+                     data["__streamdata__"] = data["__streamdata__"][:-1]
+                 else:
+                     stream.seek(pos, 0)
+-                    raise utils.PdfReadError, "Unable to find 'endstream' marker after stream."
++                    raise utils.PdfReadError("Unable to find 'endstream' marker after stream.")
+         else:
+             stream.seek(pos, 0)
+         if data.has_key("__streamdata__"):
+@@ -655,7 +655,7 @@ class EncodedStreamObject(StreamObject):
+             return decoded._data
+ 
+     def setData(self, data):
+-        raise utils.PdfReadError, "Creating EncodedStreamObject is not currently supported"
++        raise utils.PdfReadError("Creating EncodedStreamObject is not currently supported")
+ 
+ 
+ class RectangleObject(ArrayObject):
diff -r e8e3d6ed859e -r 80c967f438f7 print/py-Pdf/patches/patch-pyPdf_pdf.py
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/print/py-Pdf/patches/patch-pyPdf_pdf.py   Thu Jan 23 14:38:42 2014 +0000
@@ -0,0 +1,53 @@
+$NetBSD: patch-pyPdf_pdf.py,v 1.1 2014/01/23 14:38:42 wiz Exp $
+
+python-3.x compatibility.
+
+--- pyPdf/pdf.py.orig  2010-12-04 22:49:56.000000000 +0000
++++ pyPdf/pdf.py
+@@ -652,7 +652,7 @@ class PdfFileReader(object):
+         if not self._override_encryption and self.isEncrypted:
+             # if we don't have the encryption key:
+             if not hasattr(self, '_decryption_key'):
+-                raise Exception, "file has not been decrypted"
++                raise Exception("file has not been decrypted")
+             # otherwise, decrypt here...
+             import struct
+             pack1 = struct.pack("<i", indirectReference.idnum)[:3]
+@@ -704,14 +704,14 @@ class PdfFileReader(object):
+         while not line:
+             line = self.readNextEndLine(stream)
+         if line[:5] != "%%EOF":
+-            raise utils.PdfReadError, "EOF marker not found"
++            raise utils.PdfReadError("EOF marker not found")
+ 
+         # find startxref entry - the location of the xref table
+         line = self.readNextEndLine(stream)
+         startxref = int(line)
+         line = self.readNextEndLine(stream)
+         if line[:9] != "startxref":
+-            raise utils.PdfReadError, "startxref not found"
++            raise utils.PdfReadError("startxref not found")
+ 
+         # read all cross reference tables and their trailers
+         self.xref = {}
+@@ -725,7 +725,7 @@ class PdfFileReader(object):
+                 # standard cross-reference table
+                 ref = stream.read(4)
+                 if ref[:3] != "ref":
+-                    raise utils.PdfReadError, "xref table read error"
++                    raise utils.PdfReadError("xref table read error")
+                 readNonWhitespace(stream)
+                 stream.seek(-1, 1)
+                 while 1:
+@@ -898,9 +898,9 @@ class PdfFileReader(object):
+     def _decrypt(self, password):
+         encrypt = self.trailer['/Encrypt'].getObject()
+         if encrypt['/Filter'] != '/Standard':
+-            raise NotImplementedError, "only Standard PDF encryption handler is available"
++            raise NotImplementedError("only Standard PDF encryption handler is available")
+         if not (encrypt['/V'] in (1, 2)):
+-            raise NotImplementedError, "only algorithm code 1 and 2 are supported"
++            raise NotImplementedError("only algorithm code 1 and 2 are supported")
+         user_password, key = self._authenticateUserPassword(password)
+         if user_password:
+             self._decryption_key = key
diff -r e8e3d6ed859e -r 80c967f438f7 print/py-Pdf/patches/patch-pyPdf_utils.py
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/print/py-Pdf/patches/patch-pyPdf_utils.py Thu Jan 23 14:38:42 2014 +0000
@@ -0,0 +1,31 @@
+$NetBSD: patch-pyPdf_utils.py,v 1.1 2014/01/23 14:38:42 wiz Exp $
+
+python-3.x compatibility.
+
+--- pyPdf/utils.py.orig        2010-12-04 22:49:56.000000000 +0000
++++ pyPdf/utils.py
+@@ -74,13 +74,13 @@ class ConvertFunctionsToVirtualList(obje
+ 
+     def __getitem__(self, index):
+         if not isinstance(index, int):
+-            raise TypeError, "sequence indices must be integers"
++            raise TypeError("sequence indices must be integers")
+         len_self = len(self)
+         if index < 0:
+             # support negative indexes
+             index = len_self + index
+         if index < 0 or index >= len_self:
+-            raise IndexError, "sequence index out of range"
++            raise IndexError("sequence index out of range")
+         return self.getFunction(index)
+ 
+ def RC4_encrypt(key, plaintext):
+@@ -117,6 +117,6 @@ class PageSizeNotDefinedError(PyPdfError
+ if __name__ == "__main__":
+     # test RC4
+     out = RC4_encrypt("Key", "Plaintext")
+-    print repr(out)
++    print(repr(out))
+     pt = RC4_encrypt("Key", out)
+-    print repr(pt)
++    print(repr(pt))



Home | Main Index | Thread Index | Old Index