Merge pull request #17198 from Rmys/master

hplip ver. bump
This commit is contained in:
Rmys
2025-08-13 12:22:55 +03:00
committed by GitHub
4 changed files with 208 additions and 8 deletions
+4
View File
@@ -11,6 +11,9 @@ from pisi.actionsapi import get
import os
shelltools.export("PYTHON", "/usr/bin/python3")
def setup():
# Patch compressed PPDs
for patch in sorted(os.listdir("ppd-patches")):
@@ -30,6 +33,7 @@ def setup():
# Change python shebang
shelltools.system("find -name '*.py' -print0 | xargs -0 sed -i 's,^#!/usr/bin/env python,#!/usr/bin/python,'")
shelltools.system("find -name '*.py' -print0 | xargs -0 sed -i 's,^#!/usr/bin/python,#!/usr/bin/python3,'")
# These are barely the defaults except:
# --enable-foomatic-drv-install (default=no) (respected by Fedora, enabled by Ubuntu)
@@ -0,0 +1,52 @@
diff -up hplip-3.20.9/configure.in.configure-python hplip-3.20.9/configure.in
--- hplip-3.20.9/configure.in.configure-python 2020-09-23 07:24:27.000000000 +0200
+++ hplip-3.20.9/configure.in 2020-10-02 07:27:09.082331431 +0200
@@ -604,17 +604,29 @@ if test "$class_driver" = "no" && test "
fi
fi
-SAVE_CPPFLAGS="$CPPFLAGS"
-CFLAGS=`python-config --includes`
-if [ $? -eq 0 ]
-then
- echo $FLAGS
-else
-CFLAGS=`python3-config --includes`
- if [ $? -eq 0 ]
- then
- echo $FLAGS
- fi
+AC_PATH_PROG(python3_config_path, python3-config, [AC_MSG_ERROR([python3-config not installed], 6)])
+
+PYTHON_INCLUDES=`$python3_config_path --includes`
+if test "X$PYTHON_INCLUDES" = "X" ; then
+ AC_MSG_ERROR([Cannot get Python includes via python3-config], 6)
+fi
+
+PYTHON_LIBS=`$python3_config_path --libs`
+if test "X$PYTHON_LIBS" = "X" ; then
+ AC_MSG_ERROR([Cannot get Python libs via python3-config], 6)
+fi
+
+SAVE_CFLAGS=$CFLAGS
+SAVE_LIBS=$LIBS
+
+CFLAGS="$CFLAGS $PYTHON_INCLUDES"
+LIBS="$LIBS $PYTHON_LIBS"
+
+AC_TRY_LINK(,[ ], AC_MSG_RESULT(yes); python_includes="ok", AC_MSG_ERROR([no: PYTHON DISABLED], 6))
+
+if test "X$python_includes" != "Xok" ; then
+ CFLAGS="$SAVE_CFLAGS"
+ LIBS="$SAVE_LIBS"
fi
#CFLAGS=`(python-config --includes)`
@@ -631,7 +643,6 @@ if test "$class_driver" = "no" && test "
AS_IF([test "x$FOUND_HEADER" != "xyes"],
[AC_MSG_ERROR([cannot find python-devel support], 6)])
fi
-CFLAGS="$save_CFLAGS"
if test "$hpijs_only_build" = "no" && test "$scan_build" = "yes" && test "$hpcups_only_build" = "no"; then
AC_CHECK_LIB([sane], [sane_open], [LIBS="$LIBS"], [AC_MSG_ERROR([cannot find sane-backends-devel support (or --disable-scan-build)], 12)])
+134
View File
@@ -0,0 +1,134 @@
From: Till Kamppeter <till.kamppeter@gmail.com>
Date: Fri, 22 Jul 2016 09:33:04 +0200
Subject: Workaround patch for missing Python3 transition of the old
(pre-USB-storage) photo memory card support (pcardext) as this part builds
in Python3 environments but with pointer-related warnings which are fatal
errors for Ubuntu's build servers. The patch silences the warnings but the
memory card support is dropped in Python3 environments. This patch is
supplied by the HPLIP upstream developers and will be replaced by a more
proper solution in the next upstream release of HPLIP (see LP: #1275353)
---
pcard/pcardext/pcardext.c | 59 +++++++++++++++++++++++++++++++++++++----------
pcard/photocard.py | 2 +-
unload.py | 5 ++++
3 files changed, 53 insertions(+), 13 deletions(-)
diff --git a/pcard/pcardext/pcardext.c b/pcard/pcardext/pcardext.c
index c1a8273..37d979b 100644
--- a/pcard/pcardext/pcardext.c
+++ b/pcard/pcardext/pcardext.c
@@ -20,7 +20,7 @@ pcardext - Python extension for HP photocard services
Requires:
Python 2.2+
-Author: Don Welch
+Author: Don Welch
\*****************************************************************************/
@@ -38,9 +38,37 @@ typedef int Py_ssize_t;
int verbose=0;
+#if PY_MAJOR_VERSION >= 3
+ #define MOD_ERROR_VAL NULL
+ #define MOD_SUCCESS_VAL(val) val
+ #define MOD_INIT(name) PyMODINIT_FUNC PyInit_##name(void)
+ #define PyInt_AS_LONG PyLong_AS_LONG
+ #define MOD_DEF(ob, name, doc, methods) \
+ static struct PyModuleDef moduledef = { \
+ PyModuleDef_HEAD_INIT, name, doc, -1, methods, }; \
+ ob = PyModule_Create(&moduledef);
+
+
+ #define PY_String_Bytes PyBytes_FromStringAndSize
+ #define PY_AsString_Bytes PyBytes_AsStringAndSize
+
+#else
+ #define MOD_ERROR_VAL
+ #define MOD_SUCCESS_VAL(val)
+ #define MOD_INIT(name) void init##name(void)
+ #define MOD_DEF(ob, name, doc, methods) \
+ ob = Py_InitModule3(name, methods, doc);
+
+ #define PY_String_Bytes PyString_FromStringAndSize
+ #define PY_AsString_Bytes PyString_AsStringAndSize
+
+#endif
+
PyObject * readsectorFunc = NULL;
PyObject * writesectorFunc = NULL;
+
+
int ReadSector(int sector, int nsector, void *buf, int size)
{
PyObject * result;
@@ -56,9 +84,13 @@ int ReadSector(int sector, int nsector, void *buf, int size)
if( result )
{
Py_ssize_t len = 0;
- PyString_AsStringAndSize( result, &result_str, &len );
+
+ //PyString_AsStringAndSize( result, &result_str, &len );
+ //PyBytes_AsStringAndSize( result, &result_str, &len );
+ PY_AsString_Bytes( result, &result_str, &len );
- if( len < nsector*FAT_HARDSECT )
+
+ if( len < nsector*FAT_HARDSECT )
{
goto abort;
}
@@ -205,7 +237,9 @@ PyObject * pcardext_read( PyObject * self, PyObject * args )
if( FatReadFileExt( name, offset, len, buffer ) == len )
{
- return PyString_FromStringAndSize( (char *)buffer, len );
+ // return PyString_FromStringAndSize( (char *)buffer, len );
+ return PY_String_Bytes( (char *)buffer, len );
+ // return PyBytes_FromStringAndSize( (char *)buffer, len );
}
else
{
@@ -233,14 +267,15 @@ static PyMethodDef pcardext_methods[] =
static char pcardext_documentation[] = "Python extension for HP photocard services";
-void initpcardext( void )
-{
- PyObject * mod = Py_InitModule4( "pcardext", pcardext_methods,
- pcardext_documentation, (PyObject*)NULL,
- PYTHON_API_VERSION );
-
- if (mod == NULL)
- return;
+MOD_INIT(pcardext) {
+
+ PyObject* mod ;
+ MOD_DEF(mod, "pcardext", pcardext_documentation, pcardext_methods);
+ if (mod == NULL)
+ return MOD_ERROR_VAL;
+
+ return MOD_SUCCESS_VAL(mod);
+
}
diff --git a/unload.py b/unload.py
index 3fdd5a3..ce8b069 100755
--- a/unload.py
+++ b/unload.py
@@ -44,6 +44,11 @@ except ImportError:
# Local
from base.g import *
+from base.sixext import PY3
+if PY3:
+ log.error("This functionality is not spported in python3 environment.")
+ sys.exit(1)
+
from base import device, utils, tui, module
from prnt import cups
+18 -8
View File
@@ -13,7 +13,7 @@
<Icon>hplip</Icon>
<Summary>HP Linux Imaging and Printing System</Summary>
<Description>HP Linux Imaging and Printing (HPLIP) System includes printer and scanner drivers and related service tools.</Description>
<Archive sha1sum="7790ac35acb5b703b19715b08b49031f090d2bed" type="targz">mirrors://sourceforge/hplip/hplip-3.24.4.tar.gz</Archive>
<Archive sha1sum="3c5933eea8c41ebf2279a440004b6cc9d3cfddb9" type="targz">mirrors://sourceforge/hplip/hplip-3.25.6.tar.gz</Archive>
<AdditionalFiles>
<!-- PPD patcher -->
<AdditionalFile permission="0755" target="patch-ppds">patch-ppds.sh</AdditionalFile>
@@ -32,15 +32,15 @@
<Dependency>sane-backends-devel</Dependency>
<Dependency>cups-devel</Dependency>
<Dependency>python3-devel</Dependency>
<Dependency>python-devel</Dependency>
<!-- <Dependency>python-devel</Dependency> -->
<Dependency>libusb-devel</Dependency>
<Dependency>dbus-devel</Dependency>
<Dependency>openssl-devel</Dependency>
<Dependency>desktop-file-utils</Dependency>
<Dependency>avahi-devel</Dependency>
<Dependency>python-reportlab</Dependency>
<Dependency>python3-reportlab</Dependency>
<Dependency>libxcrypt-devel</Dependency>
<Dependency>python-pillow-devel</Dependency>
<Dependency>python3-pillow-devel</Dependency>
<!-- <Dependency>python-qt5-devel</Dependency> -->
</BuildDependencies>
<Patches>
@@ -91,6 +91,9 @@
<Patch level="1">Re-add-drivers-missing-from-3.19.1.patch</Patch>
<Patch level="1">reproducible-gzip.patch</Patch>
<!-- <Patch level="1">fix-Werror-format-security.patch</Patch> -->
<Patch level="1">hplip-configure-python.patch</Patch>
<Patch level="1">python3.diff</Patch>
</Patches>
</Source>
@@ -115,8 +118,8 @@
<Dependency>openssl</Dependency>
<Dependency>avahi</Dependency>
<Dependency>avahi-libs</Dependency>
<Dependency>python-pillow</Dependency>
<Dependency>python-reportlab</Dependency>
<Dependency>python3-pillow</Dependency>
<Dependency>python3-reportlab</Dependency>
<!-- <Dependency>usb-modeswitch</Dependency> -->
</RuntimeDependencies>
<Files>
@@ -154,8 +157,8 @@
<RuntimeDependencies>
<Dependency release="current">hplip</Dependency>
<!-- <Dependency>python-reportlab</Dependency> -->
<Dependency>python-pygobject</Dependency>
<Dependency>python-qt5</Dependency>
<Dependency>python3-pygobject3</Dependency>
<Dependency>python3-qt5</Dependency>
</RuntimeDependencies>
<Files>
<Path fileType="executable">/usr/bin/hp-toolbox</Path>
@@ -190,6 +193,13 @@
</Package>
<History>
<Update release="20">
<Date>2025-08-13</Date>
<Version>3.25.6</Version>
<Comment>Version bump.</Comment>
<Name>Pisi Linux Community</Name>
<Email>admin@pisilinux.org</Email>
</Update>
<Update release="19">
<Date>2024-12-24</Date>
<Version>3.24.4</Version>