Monday, December 06, 2021

Re: patch print/py-reportlab for Python 3.9 base64

On 2021/12/06 16:20, Josh Grosse wrote:
> 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.

It would be much better to update instead. Can you try this diff please?

> I have added `MODPY_VERSION=3.9` to the Makefile, which I am
> unsure is the correct action.

It's not; that is the default for the python3 flavour anyway, but also the
port needs to support Python 2 unless a py2- version is split off (sK1
doesn't support py3).

Index: Makefile
===================================================================
RCS file: /cvs/ports/print/py-reportlab/Makefile,v
retrieving revision 1.17
diff -u -p -r1.17 Makefile
--- Makefile 2 Nov 2021 00:01:54 -0000 1.17
+++ Makefile 6 Dec 2021 23:09:44 -0000
@@ -2,15 +2,15 @@

COMMENT= PDF-generating toolkit for Python

-MODPY_EGG_VERSION= 3.2.0
+# XXX 3.6.x drops py2 support; graphics/sk1 needs it
+MODPY_EGG_VERSION= 3.5.68
DISTNAME= reportlab-${MODPY_EGG_VERSION}
PKGNAME= py-${DISTNAME}
EPOCH= 0
-REVISION= 9

# see patches/patch-setup_py
-# grep 'archive =' reportlab-3.2.0/setup.py
-PFBFER= pfbfer-20070710.zip
+# grep 'zipdata =' `make show=WRKSRC`/setup.py
+PFBFER= pfbfer-20180109.zip
SUBST_VARS= FULLDISTDIR PFBFER WRKINST MODPY_SITEPKG
EXTRACT_ONLY= ${DISTNAME}${EXTRACT_SUFX}
DISTFILES= ${DISTNAME}${EXTRACT_SUFX} \
@@ -18,14 +18,14 @@ DISTFILES= ${DISTNAME}${EXTRACT_SUFX} \

CATEGORIES= print graphics

-HOMEPAGE= http://www.reportlab.com
+HOMEPAGE= https://www.reportlab.com

# BSD, LGPLv2, MPL1.0, MIT
PERMIT_PACKAGE= Yes

WANTLIB += ${MODPY_WANTLIB} art_lgpl_2 freetype pthread

-MASTER_SITES0= http://www.reportlab.com/ftp/
+MASTER_SITES0= https://www.reportlab.com/ftp/

FLAVORS= python3
FLAVOR?=
@@ -53,16 +53,19 @@ pre-configure:
${WRKSRC}/docs/genAll.py \
${WRKSRC}/docs/userguide/genuserguide.py

-# XXX FLAVOR conflict
-#post-install:
-# cd ${WRKSRC}/docs && ${MODPY_BIN} genAll.py
-# ${INSTALL_DATA_DIR} ${PREFIX}/share/doc/py-reportlab
-# ${INSTALL_DATA} ${WRKBUILD}/docs/reportlab-userguide.pdf \
-# ${PREFIX}/share/doc/py-reportlab
+.if ${FLAVOR:Mpython3}
+post-install:
+ cd ${WRKSRC}/docs && \
+ ${MAKE_ENV} PYTHONPATH=${WRKSRC}/lib.openbsd-${OSREV}-${ARCH}-${MODPY_VERSION} \
+ ${MODPY_BIN} genAll.py
+ ${INSTALL_DATA_DIR} ${PREFIX}/share/doc/py-reportlab
+ ${INSTALL_DATA} ${WRKBUILD}/docs/reportlab-userguide.pdf \
+ ${PREFIX}/share/doc/py-reportlab
+.endif

do-test:
cd ${WRKSRC}/tests && \
- ${MAKE_ENV} PYTHONPATH=${WRKDIST}:${WRKINST}${MODPY_SITEPKG} \
+ ${MAKE_ENV} PYTHONPATH=${WRKSRC}/lib.openbsd-${OSREV}-${ARCH}-${MODPY_VERSION} \
${MODPY_BIN} ./runAll.py

.include <bsd.port.mk>
Index: distinfo
===================================================================
RCS file: /cvs/ports/print/py-reportlab/distinfo,v
retrieving revision 1.1
diff -u -p -r1.1 distinfo
--- distinfo 5 Jan 2016 13:21:49 -0000 1.1
+++ distinfo 6 Dec 2021 23:09:44 -0000
@@ -1,4 +1,4 @@
-SHA256 (pfbfer-20070710.zip) = +xRi/2zo765YoMSW8FN8WsFtSJXGjxZAwpc9tXTds3Y=
-SHA256 (reportlab-3.2.0.tar.gz) = cuaHZivYVHdkB7kQhINWGDG0VUbZNd+LBHdwgZkIYpM=
-SIZE (pfbfer-20070710.zip) = 677333
-SIZE (reportlab-3.2.0.tar.gz) = 1948090
+SHA256 (pfbfer-20180109.zip) = hRtDFVDoZrIXMX0J3TO1U1rggSAJda1N0l6AvirxD+w=
+SHA256 (reportlab-3.5.68.tar.gz) = 7+9ql+OrSfP0ADfb+aQWZmihfMaquhPV7Lq9+FSpszI=
+SIZE (pfbfer-20180109.zip) = 737561
+SIZE (reportlab-3.5.68.tar.gz) = 4512985
Index: patches/patch-setup_py
===================================================================
RCS file: /cvs/ports/print/py-reportlab/patches/patch-setup_py,v
retrieving revision 1.1
diff -u -p -r1.1 patch-setup_py
--- patches/patch-setup_py 5 Jan 2016 13:21:49 -0000 1.1
+++ patches/patch-setup_py 6 Dec 2021 23:09:44 -0000
@@ -1,55 +1,36 @@
$OpenBSD: patch-setup_py,v 1.1 2016/01/05 13:21:49 ajacoutot Exp $
---- setup.py.orig Fri Dec 12 12:31:11 2014
-+++ setup.py Mon Jan 4 10:40:32 2016
-@@ -140,11 +140,12 @@ class inc_lib_dirs:
- # darwin ports installation directories
- aDir(L, "/opt/local/lib")
- aDir(I, "/opt/local/include")
-- aDir(I, "/usr/local/include")
-- aDir(L, "/usr/local/lib")
-+ aDir(I, "${LOCALBASE}/include")
-+ aDir(L, "${LOCALBASE}/lib")
+
+Index: setup.py
+--- setup.py.orig
++++ setup.py
+@@ -183,7 +183,8 @@ class inc_lib_dirs:
+ aDir(L, "/usr/local/lib")
aDir(I, "/usr/include")
aDir(L, "/usr/lib")
- aDir(I, "/usr/include/freetype2")
-+ aDir(I, "${X11BASE}/include/freetype2")
-+ aDir(L, "${X11BASE}/lib")
++ aDir(I, "/usr/X11R6/include/freetype2")
++ aDir(L, "/usr/X11R6/lib")
prefix = sysconfig.get_config_var("prefix")
if prefix:
aDir(L, pjoin(prefix, "lib"))
-@@ -244,11 +245,7 @@ reportlab_files= [
- ]
+@@ -312,9 +313,8 @@ def get_fonts(PACKAGE_DIR, reportlab_files):
+ xitmsg = "not downloading T1 font curve files"
+ else:
+ try:
+- infoline("Downloading standard T1 font curves")
+- zipdata = url2data("http://www.reportlab.com/ftp/pfbfer-20180109.zip")
+- archive = zipfile.ZipFile(zipdata)
++ infoline("Extracting standard T1 font curves")
++ archive = zipfile.ZipFile("${FULLDISTDIR}/${PFBFER}")
+ dst = pjoin(rl_dir, 'fonts')

- def get_fonts(PACKAGE_DIR, reportlab_files):
-- import sys, os, os.path, zipfile, io
-- if isPy3:
-- import urllib.request as ureq
-- else:
-- import urllib2 as ureq
-+ import sys, os, os.path, zipfile
- rl_dir = PACKAGE_DIR['reportlab']
- if not [x for x in reportlab_files if not os.path.isfile(pjoin(rl_dir,x))]:
- infoline("Standard T1 font curves already downloaded")
-@@ -257,12 +254,7 @@ def get_fonts(PACKAGE_DIR, reportlab_files):
- infoline('not downloading T1 font curve files')
- return
- try:
-- infoline("Downloading standard T1 font curves")
--
-- remotehandle = ureq.urlopen("http://www.reportlab.com/ftp/pfbfer-20070710.zip")
-- zipdata = io.BytesIO(remotehandle.read())
-- remotehandle.close()
-- archive = zipfile.ZipFile(zipdata)
-+ archive = zipfile.ZipFile("${FULLDISTDIR}/${PFBFER}")
- dst = pjoin(rl_dir, 'fonts')
-
- for name in archive.namelist():
-@@ -360,7 +352,7 @@ def main():
- if isla:
- LIBART_INC=None
+ for name in archive.namelist():
+@@ -456,7 +456,7 @@ def main():
+ LIBART_INC=None #don't use system libart
else:
+ #check for an installed libart
- LIBART_INC = list(sorted(glob.glob('/usr/include/libart-*/libart_lgpl/libart-features.h')))
-+ LIBART_INC = list(sorted(glob.glob('${LOCALBASE}/include/libart-*/libart_lgpl/libart-features.h')))
++ LIBART_INC = list(sorted(glob.glob('/usr/local/include/libart-*/libart_lgpl/libart-features.h')))
if LIBART_INC:
def installed_libart_version(fn):
for l in open(fn, 'r').readlines():
Index: patches/patch-src_rl_addons_renderPM_gt1_gt1-misc_h
===================================================================
RCS file: /cvs/ports/print/py-reportlab/patches/patch-src_rl_addons_renderPM_gt1_gt1-misc_h,v
retrieving revision 1.1
diff -u -p -r1.1 patch-src_rl_addons_renderPM_gt1_gt1-misc_h
--- patches/patch-src_rl_addons_renderPM_gt1_gt1-misc_h 5 Jan 2016 13:21:49 -0000 1.1
+++ patches/patch-src_rl_addons_renderPM_gt1_gt1-misc_h 6 Dec 2021 23:09:44 -0000
@@ -1,12 +1,14 @@
$OpenBSD: patch-src_rl_addons_renderPM_gt1_gt1-misc_h,v 1.1 2016/01/05 13:21:49 ajacoutot Exp $
---- src/rl_addons/renderPM/gt1/gt1-misc.h.orig Mon Jan 4 11:00:31 2016
-+++ src/rl_addons/renderPM/gt1/gt1-misc.h Mon Jan 4 11:00:48 2016
+
+Index: src/rl_addons/renderPM/gt1/gt1-misc.h
+--- src/rl_addons/renderPM/gt1/gt1-misc.h.orig
++++ src/rl_addons/renderPM/gt1/gt1-misc.h
@@ -4,7 +4,7 @@
#define __GT1_MISC_H__

#include <stdlib.h> /* for malloc, etc. */
--#if defined(macintosh) || defined (__linux__) || defined(__FreeBSD_kernel__) || (__GNU__)
-+#if defined(macintosh) || defined (__linux__) || defined(__FreeBSD_kernel__) || (__GNU__) || defined(__OpenBSD__)
+-#if defined(macintosh) || defined(__APPLE__) || defined (__linux__) || defined(__FreeBSD_kernel__) || defined(__GNU__)
++#if defined(macintosh) || defined(__APPLE__) || defined (__linux__) || defined(__FreeBSD_kernel__) || defined(__GNU__) || defined(__OpenBSD__)
# include <string.h> /* for memcpy() */

No comments:

Post a Comment