[arch-commits] Commit in hplip/trunk (PKGBUILD python3.diff)

2019-12-11 Thread Andreas Radke via arch-commits
Date: Wednesday, December 11, 2019 @ 16:54:40
  Author: andyrtr
Revision: 370678

upgpkg: hplip 1:3.19.11-7: fix more python3 bugs - FS#64811

Modified:
  hplip/trunk/PKGBUILD
  hplip/trunk/python3.diff

--+
 PKGBUILD |7 +-
 python3.diff |  152 ++---
 2 files changed, 148 insertions(+), 11 deletions(-)

Modified: PKGBUILD
===
--- PKGBUILD2019-12-11 14:41:19 UTC (rev 370677)
+++ PKGBUILD2019-12-11 16:54:40 UTC (rev 370678)
@@ -5,7 +5,7 @@
 
 pkgname=hplip
 pkgver=3.19.11
-pkgrel=6
+pkgrel=7
 epoch=1
 pkgdesc="Drivers for HP DeskJet, OfficeJet, Photosmart, Business Inkjet and 
some LaserJet"
 arch=('x86_64')
@@ -38,7 +38,7 @@
 
'763949a0bc460dcc9faefc86f2a91cf342781bfce696ed0c3826758572dd03ac266bbeb7b6a4f9376ac298d7d3c9c4def42d94921a8e1d1695e39396e36d95ff'
 
'8710e039626878270b8b7bc1569566274d935c84652d758e25ce8fe01c0f44d911148620bb494489e1238201c01f3ba255c19f7dc5c2ff0d45a5f2a79190286b'
 
'450e0e77954a9d919bbde0a4b9d630920a1225679121f94d6854e16ce9b2f8ed8c4de7ddf629012b9f9d24d075a407a4077d1710ad9d023742f402b4d139a111'
-
'834cd60af0b938b1d930e63fa43ce21900a32bd4842b6a03902dfd0b8e99b295be152531873e09a46506ef4645d67f3d06b7e1339ba92c6d56373f8277ee53ea')
+
'5885b223f96706bc09a147b5c141d620846c9058563e986983ca2ab90922cabe891a651d90d5004d45549b3874c40f8a1570a8a79e067d66f182668c7e82')
 validpgpkeys=('4ABA2F66DBD5A95894910E0673D770CDA59047B9') # HPLIP (HP Linux 
Imaging and Printing) 
 
 prepare() {
@@ -55,7 +55,8 @@
  patch -Np1 -i 
"${srcdir}"/0025-Remove-all-ImageProcessor-functionality-which-is-clo.patch
  # fix broken printer naming FS#64420, FS#64801
  patch -Np1 -i "${srcdir}"/fix-broken-printer-naming.diff
- # fix unsupported old python variable
+ # Workaround patch for missing Python3 transition of the old
+ # (pre-USB-storage) photo memory card support (pcardext) - Debian patch
  patch -Np1 -i "${srcdir}"/python3.diff
 
  export AUTOMAKE='automake --foreign'

Modified: python3.diff
===
--- python3.diff2019-12-11 14:41:19 UTC (rev 370677)
+++ python3.diff2019-12-11 16:54:40 UTC (rev 370678)
@@ -1,11 +1,147 @@
 hplip-3.19.11/pcard/pcardext/pcardext.c2019-11-04 11:31:08.0 
+0100
-+++ hplip-3.19.11/pcard/pcardext/pcardext.c.new2019-12-11 
12:13:20.710959557 +0100
-@@ -80,7 +80,7 @@
+From: Till Kamppeter 
+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();
++
++
++  #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;
+-   

[arch-commits] Commit in hplip/trunk (PKGBUILD python3.diff)

2019-12-11 Thread Andreas Radke via arch-commits
Date: Wednesday, December 11, 2019 @ 11:25:46
  Author: andyrtr
Revision: 370666

upgpkg: hplip 1:3.19.11-6: fix python3 unsupported variable type - FS#64674

Added:
  hplip/trunk/python3.diff
Modified:
  hplip/trunk/PKGBUILD

--+
 PKGBUILD |   12 
 python3.diff |   11 +++
 2 files changed, 19 insertions(+), 4 deletions(-)

Modified: PKGBUILD
===
--- PKGBUILD2019-12-11 09:46:10 UTC (rev 370665)
+++ PKGBUILD2019-12-11 11:25:46 UTC (rev 370666)
@@ -5,7 +5,7 @@
 
 pkgname=hplip
 pkgver=3.19.11
-pkgrel=5
+pkgrel=6
 epoch=1
 pkgdesc="Drivers for HP DeskJet, OfficeJet, Photosmart, Business Inkjet and 
some LaserJet"
 arch=('x86_64')
@@ -29,7 +29,8 @@
 0022-Add-include-cups-ppd.h-in-various-places-as-CUPS-2.2.patch
 0023-Fix-handling-of-unicode-filenames-in-sixext.py.patch
 0025-Remove-all-ImageProcessor-functionality-which-is-clo.patch
-fix-broken-printer-naming.diff)
+fix-broken-printer-naming.diff
+python3.diff)
 
sha512sums=('f419de0e18937c93c2727f4d8b4f7bf1fcc24961a6b7a0d043ce8341c65d0c0332cd354c0cd907b85bc6ccc7735d23ba5f2c918dba5bf965540291cfcbe032d5'
 'SKIP'
 
'ee0bd240568a7dbb4dc6ef64dba28ea84c4bedf7d688d054960c68f8f0bc4562961c40845107ef0c936e60d3e676bffb2a1ba708039690bb0520cda3a525'
@@ -36,12 +37,13 @@
 
'22aeb5b851f78bc6bc62e0bc3da99fecaf42d7604af41e2f3343f8d3666541f7b06b7d1a7d0ddf24f1731ac7b12dfe582375a98e3b94dfa323d6ce954549ca67'
 
'763949a0bc460dcc9faefc86f2a91cf342781bfce696ed0c3826758572dd03ac266bbeb7b6a4f9376ac298d7d3c9c4def42d94921a8e1d1695e39396e36d95ff'
 
'8710e039626878270b8b7bc1569566274d935c84652d758e25ce8fe01c0f44d911148620bb494489e1238201c01f3ba255c19f7dc5c2ff0d45a5f2a79190286b'
-
'450e0e77954a9d919bbde0a4b9d630920a1225679121f94d6854e16ce9b2f8ed8c4de7ddf629012b9f9d24d075a407a4077d1710ad9d023742f402b4d139a111')
+
'450e0e77954a9d919bbde0a4b9d630920a1225679121f94d6854e16ce9b2f8ed8c4de7ddf629012b9f9d24d075a407a4077d1710ad9d023742f402b4d139a111'
+
'834cd60af0b938b1d930e63fa43ce21900a32bd4842b6a03902dfd0b8e99b295be152531873e09a46506ef4645d67f3d06b7e1339ba92c6d56373f8277ee53ea')
 validpgpkeys=('4ABA2F66DBD5A95894910E0673D770CDA59047B9') # HPLIP (HP Linux 
Imaging and Printing) 
 
 prepare() {
  cd "$pkgname"-$pkgver
- 
+
  # disable insecure update - https://bugs.archlinux.org/task/38083
  patch -Np0 -i "${srcdir}"/disable_upgrade.patch
  
@@ -53,6 +55,8 @@
  patch -Np1 -i 
"${srcdir}"/0025-Remove-all-ImageProcessor-functionality-which-is-clo.patch
  # fix broken printer naming FS#64420, FS#64801
  patch -Np1 -i "${srcdir}"/fix-broken-printer-naming.diff
+ # fix unsupported old python variable
+ patch -Np1 -i "${srcdir}"/python3.diff
 
  export AUTOMAKE='automake --foreign'
  autoreconf --force --install

Added: python3.diff
===
--- python3.diff(rev 0)
+++ python3.diff2019-12-11 11:25:46 UTC (rev 370666)
@@ -0,0 +1,11 @@
+--- hplip-3.19.11/pcard/pcardext/pcardext.c2019-11-04 11:31:08.0 
+0100
 hplip-3.19.11/pcard/pcardext/pcardext.c.new2019-12-11 
12:13:20.710959557 +0100
+@@ -80,7 +80,7 @@
+ {
+ result = PyObject_CallFunction( writesectorFunc, "iis#", sector, 
nsector, buf, size );
+ 
+-return PyInt_AS_LONG( result );
++return PyLong_AS_LONG( result );
+ }
+ 
+ return 1;