Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 10 Feb 2023 21:16:06 GMT
From:      Tijl Coosemans <tijl@FreeBSD.org>
To:        ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org
Subject:   git: 67d92e052a36 - main - print/hplip: Port pcardext module to Python 3.x
Message-ID:  <202302102116.31ALG642002301@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by tijl:

URL: https://cgit.FreeBSD.org/ports/commit/?id=67d92e052a364083dc46c6d9a071bd22ee64a814

commit 67d92e052a364083dc46c6d9a071bd22ee64a814
Author:     Tijl Coosemans <tijl@FreeBSD.org>
AuthorDate: 2023-02-10 20:22:42 +0000
Commit:     Tijl Coosemans <tijl@FreeBSD.org>
CommitDate: 2023-02-10 21:15:11 +0000

    print/hplip: Port pcardext module to Python 3.x
---
 print/hplip/Makefile                              |  1 +
 print/hplip/files/patch-pcard_pcardext_pcardext.c | 54 +++++++++++++++++++++++
 2 files changed, 55 insertions(+)

diff --git a/print/hplip/Makefile b/print/hplip/Makefile
index 8e4e4ab51d06..b5d7277f7048 100644
--- a/print/hplip/Makefile
+++ b/print/hplip/Makefile
@@ -1,5 +1,6 @@
 PORTNAME=	hplip
 PORTVERSION=	3.22.10
+PORTREVISION=	1
 CATEGORIES=	print
 MASTER_SITES=	SF
 
diff --git a/print/hplip/files/patch-pcard_pcardext_pcardext.c b/print/hplip/files/patch-pcard_pcardext_pcardext.c
new file mode 100644
index 000000000000..2b6ea5eb61d3
--- /dev/null
+++ b/print/hplip/files/patch-pcard_pcardext_pcardext.c
@@ -0,0 +1,54 @@
+--- pcard/pcardext/pcardext.c.orig	2022-10-27 13:08:44 UTC
++++ pcard/pcardext/pcardext.c
+@@ -59,7 +59,7 @@ int ReadSector(int sector, int nsector, void *buf, int
+         if( result )
+         {
+             Py_ssize_t len = 0;
+-            PyString_AsStringAndSize( result, &result_str, &len );
++            PyBytes_AsStringAndSize( result, &result_str, &len );
+             
+             if( len < nsector*FAT_HARDSECT )
+             {
+@@ -83,7 +83,7 @@ int WriteSector(int sector, int nsector, void *buf, in
+     {
+         result = PyObject_CallFunction( writesectorFunc, "iis#", sector, nsector, buf, size );
+         
+-        return PyInt_AS_LONG( result );
++        return PyLong_AS_LONG( result );
+     }
+ 
+     return 1;
+@@ -208,7 +208,7 @@ PyObject * pcardext_read( PyObject * self, PyObject * 
+     
+     if( FatReadFileExt( name, offset, len, buffer ) == len )
+     {
+-        return PyString_FromStringAndSize( (char *)buffer, len );
++        return PyBytes_FromStringAndSize( (char *)buffer, len );
+     }
+     else
+     {
+@@ -234,16 +234,16 @@ static PyMethodDef pcardext_methods[] = 
+ };  
+ 
+ 
+-static char pcardext_documentation[] = "Python extension for HP photocard services";
++PyDoc_STRVAR(pcardext_documentation, "Python extension for HP photocard services");
+ 
+-void initpcardext( void )
++static struct PyModuleDef pcardext_module = {
++    PyModuleDef_HEAD_INIT, "pcardext", pcardext_documentation, -1,
++    pcardext_methods,
++};
++
++PyMODINIT_FUNC PyInit_pcardext( void )
+ {
+-    PyObject * mod = Py_InitModule4( "pcardext", pcardext_methods, 
+-                                     pcardext_documentation, (PyObject*)NULL, 
+-                                     PYTHON_API_VERSION );
+-                     
+-    if (mod == NULL)
+-      return;
++    return PyModule_Create(&pcardext_module);
+ }
+ 
+ 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202302102116.31ALG642002301>