It appears that the transition to Python 3.9 caused a regression
for print/py-reportlab.  The base64 API changed: encodestring and
decodestring are now encodebytes and decode bytes.  The attached
patch revises print/py-reportlab accordingly.

I have added `MODPY_VERSION=3.9` to the Makefile, which I am 
unsure is the correct action.
diff --git a/print/py-reportlab/Makefile b/print/py-reportlab/Makefile
index c744c24a10d..476f27044de 100644
--- a/print/py-reportlab/Makefile
+++ b/print/py-reportlab/Makefile
@@ -6,7 +6,8 @@ MODPY_EGG_VERSION=      3.2.0
 DISTNAME=              reportlab-${MODPY_EGG_VERSION}
 PKGNAME=               py-${DISTNAME}
 EPOCH=                 0
-REVISION=              9
+MODPY_VERSION=         3.9
+REVISION=              10
 
 # see patches/patch-setup_py
 # grep 'archive =' reportlab-3.2.0/setup.py
diff --git a/print/py-reportlab/patches/patch-src_reportlab_lib_pdfencrypt_py 
b/print/py-reportlab/patches/patch-src_reportlab_lib_pdfencrypt_py
new file mode 100644
index 00000000000..5c494111e64
--- /dev/null
+++ b/print/py-reportlab/patches/patch-src_reportlab_lib_pdfencrypt_py
@@ -0,0 +1,27 @@
+$OpenBSD$
+
+Index: src/reportlab/lib/pdfencrypt.py
+--- src/reportlab/lib/pdfencrypt.py.orig
++++ src/reportlab/lib/pdfencrypt.py
+@@ -240,10 +240,10 @@ def computeO(userPassword, ownerPassword, revision):
+     if DEBUG: print('computeO(%s,%s,%s)==>%s' % tuple([hexText(str(x)) for x 
in (userPassword, ownerPassword, revision,O)]))
+     return O
+ 
+-def computeU(encryptionkey, 
encodestring=PadString,revision=2,documentId=None):
++def computeU(encryptionkey, encodebytes=PadString,revision=2,documentId=None):
+     from reportlab.lib.arciv import ArcIV
+     if revision == 2:
+-        result = ArcIV(encryptionkey).encode(encodestring)
++        result = ArcIV(encryptionkey).encode(encodebytes)
+     elif revision == 3:
+         assert documentId is not None, "Revision 3 algorithm needs the 
document ID!"
+         h = md5(PadString)
+@@ -256,7 +256,7 @@ def computeU(encryptionkey, encodestring=PadString,rev
+         while len(tmp) < 32:
+             tmp += b'\0'
+         result = tmp
+-    if DEBUG: print('computeU(%s,%s,%s,%s)==>%s' % tuple([hexText(str(x)) for 
x in (encryptionkey, encodestring,revision,documentId,result)]))
++    if DEBUG: print('computeU(%s,%s,%s,%s)==>%s' % tuple([hexText(str(x)) for 
x in (encryptionkey, encodebytes,revision,documentId,result)]))
+     return result
+ 
+ def checkU(encryptionkey, U):
diff --git a/print/py-reportlab/patches/patch-src_reportlab_lib_utils_py 
b/print/py-reportlab/patches/patch-src_reportlab_lib_utils_py
new file mode 100644
index 00000000000..d8d525eec1b
--- /dev/null
+++ b/print/py-reportlab/patches/patch-src_reportlab_lib_utils_py
@@ -0,0 +1,40 @@
+$OpenBSD$
+
+Index: src/reportlab/lib/utils.py
+--- src/reportlab/lib/utils.py.orig
++++ src/reportlab/lib/utils.py
+@@ -5,7 +5,7 @@ __version__=''' $Id$ '''
+ __doc__='''Gazillions of miscellaneous internal utility functions'''
+ 
+ import os, sys, imp, time, types
+-from base64 import decodestring as base64_decodestring, encodestring as 
base64_encodestring
++from base64 import decodebytes as base64_decodebytes, encodebytes as 
base64_encodebytes
+ from reportlab import isPy3
+ from reportlab.lib.logger import warnOnce
+ from reportlab.lib.rltempfile import get_rl_tempfile, get_rl_tempdir, 
_rl_getuid
+@@ -115,10 +115,10 @@ if isPy3:
+             return str(x).encode(enc)
+ 
+     def encode_label(args):
+-        return 
base64_encodestring(pickle.dumps(args)).strip().decode('latin1')
++        return base64_encodebytes(pickle.dumps(args)).strip().decode('latin1')
+ 
+     def decode_label(label):
+-        return pickle.loads(base64_decodestring(label.encode('latin1')))
++        return pickle.loads(base64_decodebytes(label.encode('latin1')))
+ 
+     def rawUnicode(s):
+         '''converts first 256 unicodes 1-1'''
+@@ -212,10 +212,10 @@ else:
+     from string import letters as ascii_letters, uppercase as 
ascii_uppercase, lowercase as ascii_lowercase
+ 
+     def encode_label(args):
+-        return base64_encodestring(pickle.dumps(args)).strip()
++        return base64_encodebytes(pickle.dumps(args)).strip()
+ 
+     def decode_label(label):
+-        return pickle.loads(base64_decodestring(label))
++        return pickle.loads(base64_decodebytes(label))
+ 
+     def rawUnicode(s):
+         '''converts first 256 unicodes 1-1'''

Reply via email to