Skip to content

Commit

Permalink
Update PyPDF2 requirement and remove monkey patch
Browse files Browse the repository at this point in the history
  • Loading branch information
kylemacfarlane committed Sep 28, 2015
1 parent 7b3bd39 commit 678f117
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 33 deletions.
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -79,7 +79,7 @@ def alltests():
install_requires=[
'Pygments',
'lxml',
'PyPDF2>=1.21',
'PyPDF2>=1.25.1',
'reportlab>=3.1.44',
'setuptools',
'six',
Expand Down
31 changes: 0 additions & 31 deletions src/z3c/rml/page.py
Expand Up @@ -25,37 +25,6 @@
PyPDF2 = None


if PyPDF2 is not None and six.PY3:
# Monkey patch PyPDF2 for Python 3 compatibility
# https://github.com/mstamy2/PyPDF2/pull/172
class ASCII85Decode(object):
def decode(data, decodeParms=None):
if isinstance(data, str):
data = data.encode('ascii')
import struct
n = b = 0
out = bytearray()
for c in data:
if ord('!') <= c and c <= ord('u'):
n += 1
b = b*85+(c-33)
if n == 5:
out += struct.pack(b'>L',b)
n = b = 0
elif c == ord('z'):
assert n == 0
out += b'\0\0\0\0'
elif c == ord('~'):
if n:
for _ in range(5-n):
b = b*85+84
out += struct.pack(b'>L',b)[:n-1]
break
return bytes(out)
decode = staticmethod(decode)
PyPDF2.filters.ASCII85Decode = ASCII85Decode


class MergePostProcessor(object):

def __init__(self):
Expand Down
2 changes: 1 addition & 1 deletion versions.cfg
Expand Up @@ -13,7 +13,7 @@ zope.location = 4.0.3
zope.pagetemplate = 4.0.4
reportlab = 3.1.44
Pillow = 2.7.0
PyPDF2 = 1.23
PyPDF2 = 1.25.1
lxml = 3.3.5

# Required by:
Expand Down

0 comments on commit 678f117

Please sign in to comment.