diff options
author | wiz <wiz> | 2014-01-23 14:38:42 +0000 |
---|---|---|
committer | wiz <wiz> | 2014-01-23 14:38:42 +0000 |
commit | 370c5595e3a636bcdb00a97bfd96e33dcc88feb7 (patch) | |
tree | a57acb03b1ced00fc36315ae320caaf76d3a8d19 /print/py-Pdf/patches | |
parent | 0b0f3a64d2c361085b6fa5013e58d1c3646b6a16 (diff) | |
download | pkgsrc-370c5595e3a636bcdb00a97bfd96e33dcc88feb7.tar.gz |
Convert to python-3.x and distutils.mk.
Bump PKGREVISION.
Diffstat (limited to 'print/py-Pdf/patches')
-rw-r--r-- | print/py-Pdf/patches/patch-pyPdf_generic.py | 69 | ||||
-rw-r--r-- | print/py-Pdf/patches/patch-pyPdf_pdf.py | 53 | ||||
-rw-r--r-- | print/py-Pdf/patches/patch-pyPdf_utils.py | 31 |
3 files changed, 153 insertions, 0 deletions
diff --git a/print/py-Pdf/patches/patch-pyPdf_generic.py b/print/py-Pdf/patches/patch-pyPdf_generic.py new file mode 100644 index 00000000000..8f28090252c --- /dev/null +++ b/print/py-Pdf/patches/patch-pyPdf_generic.py @@ -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 --git a/print/py-Pdf/patches/patch-pyPdf_pdf.py b/print/py-Pdf/patches/patch-pyPdf_pdf.py new file mode 100644 index 00000000000..52f1674dd93 --- /dev/null +++ b/print/py-Pdf/patches/patch-pyPdf_pdf.py @@ -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 --git a/print/py-Pdf/patches/patch-pyPdf_utils.py b/print/py-Pdf/patches/patch-pyPdf_utils.py new file mode 100644 index 00000000000..e1be33c1010 --- /dev/null +++ b/print/py-Pdf/patches/patch-pyPdf_utils.py @@ -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))
|