summaryrefslogtreecommitdiffstats
path: root/source/ap/hplip
diff options
context:
space:
mode:
Diffstat (limited to 'source/ap/hplip')
-rwxr-xr-xsource/ap/hplip/hplip.SlackBuild7
-rw-r--r--source/ap/hplip/hplip.python3.10.diff77
2 files changed, 82 insertions, 2 deletions
diff --git a/source/ap/hplip/hplip.SlackBuild b/source/ap/hplip/hplip.SlackBuild
index 45bb30cc9..382b8c9c0 100755
--- a/source/ap/hplip/hplip.SlackBuild
+++ b/source/ap/hplip/hplip.SlackBuild
@@ -27,7 +27,7 @@ cd $(dirname $0) ; CWD=$(pwd)
PKGNAM=hplip
VERSION=${VERSION:-$(echo $PKGNAM-*.tar.?z | rev | cut -f 3- -d . | cut -f 1 -d - | rev)}
-BUILD=${BUILD:-4}
+BUILD=${BUILD:-5}
NUMJOBS=${NUMJOBS:-" -j$(expr $(nproc) + 1) "}
@@ -89,6 +89,9 @@ zcat $CWD/fix-desktop-file.patch.gz | patch -p1 --verbose || exit 1
# Fix for deprecated python function:
zcat $CWD/hplip.is_alive.diff.gz | patch -p1 --verbose || exit 1
+# Patch for Python 3.10:
+zcat $CWD/hplip.python3.10.diff.gz | patch -p1 --verbose || exit 1
+
# Choose correct options depending on whether PAM is installed:
if [ -L /lib${LIBDIRSUFFIX}/libpam.so.? ]; then
unset SHADOW_OPTIONS
@@ -130,7 +133,7 @@ done
# Needed because Makefile.am was patched:
autoreconf -vif || exit 1
-CFLAGS="$SLKCFLAGS -I/usr/include/python3.8" \
+CFLAGS="$SLKCFLAGS" \
CXXFLAGS="$SLKCFLAGS" \
PYTHON=/usr/bin/python3 \
./configure \
diff --git a/source/ap/hplip/hplip.python3.10.diff b/source/ap/hplip/hplip.python3.10.diff
new file mode 100644
index 000000000..5963f567a
--- /dev/null
+++ b/source/ap/hplip/hplip.python3.10.diff
@@ -0,0 +1,77 @@
+diff --git a/io/mudext/hpmudext.c b/io/mudext/hpmudext.c
+index dca3e9d..dfcd22a 100644
+--- a/io/mudext/hpmudext.c
++++ b/io/mudext/hpmudext.c
+@@ -24,6 +24,8 @@ Authors: Don Welch, David Suffield, Naga Samrat Chowdary Narla
+
+ \*****************************************************************************/
+
++#define PY_SSIZE_T_CLEAN
++
+ #include <Python.h>
+ #include <stdarg.h>
+ #include "hpmud.h"
+@@ -187,14 +189,22 @@ static PyObject *write_channel(PyObject *self, PyObject *args)
+ HPMUD_CHANNEL cd;
+ int timeout = 30;
+ char * buf;
+- int buf_size = 0;
++ Py_ssize_t buf_size = 0;
++ int buf_size_asInt = 0;
+ int bytes_written = 0;
+
+ if (!PyArg_ParseTuple(args, "iis#|i", &dd, &cd, &buf, &buf_size, &timeout))
+ return NULL;
+
++ if (buf_size < INT_MIN)
++ buf_size_asInt = INT_MIN;
++ else if (buf_size > INT_MAX)
++ buf_size_asInt = INT_MAX;
++ else
++ buf_size_asInt = (int)buf_size;
++
+ Py_BEGIN_ALLOW_THREADS
+- result = hpmud_write_channel(dd, cd, buf, buf_size, timeout, &bytes_written);
++ result = hpmud_write_channel(dd, cd, buf, buf_size_asInt, timeout, &bytes_written);
+ Py_END_ALLOW_THREADS
+
+ return Py_BuildValue("(ii)", result, bytes_written);
+@@ -231,14 +241,22 @@ static PyObject *set_pml(PyObject *self, PyObject *args)
+ char * oid;
+ int type;
+ char * data;
+- int data_size;
++ Py_ssize_t data_size = 0;
++ int data_size_asInt = 0;
+ int pml_result;
+
+ if (!PyArg_ParseTuple(args, "iisis#", &dd, &cd, &oid, &type, &data, &data_size))
+ return NULL;
+
++ if (data_size < INT_MIN)
++ data_size_asInt = INT_MIN;
++ else if (data_size > INT_MAX)
++ data_size_asInt = INT_MAX;
++ else
++ data_size_asInt = (int)data_size;
++
+ Py_BEGIN_ALLOW_THREADS
+- result = hpmud_set_pml(dd, cd, oid, type, (void *)data, data_size, &pml_result);
++ result = hpmud_set_pml(dd, cd, oid, type, (void *)data, data_size_asInt, &pml_result);
+ Py_END_ALLOW_THREADS
+
+ return Py_BuildValue("(ii)", result, pml_result);
+diff --git a/scan/scanext/scanext.c b/scan/scanext/scanext.c
+index 1e6b514..597abd8 100755
+--- a/scan/scanext/scanext.c
++++ b/scan/scanext/scanext.c
+@@ -45,6 +45,8 @@ PERFORMANCE OF THIS SOFTWARE.
+ *******************************************************************/
+
+
++#define PY_SSIZE_T_CLEAN
++
+ /* _ScanDevice objects */
+
+ #include "Python.h"
+