Balló György pushed to branch main at Arch Linux / Packaging / Packages / 
python-qrencode


Commits:
824d0b25 by Balló György at 2023-09-24T13:53:48+02:00
upgpkg: 1.2-13: Fix compatibility with Python 3.10 (FS#73372)

- - - - -


2 changed files:

- PKGBUILD
- + python-3.10.patch


Changes:

=====================================
PKGBUILD
=====================================
@@ -3,16 +3,26 @@
 
 pkgname=python-qrencode
 pkgver=1.2
-pkgrel=12
+pkgrel=13
 pkgdesc='Simple wrapper for the C qrencode library'
 url='https://pypi.python.org/pypi/qrencode/'
 arch=('x86_64')
 license=('MIT')
 depends=('python' 'python-pillow' 'qrencode' 'glibc')
-source=(https://pypi.org/packages/source/q/qrencode/qrencode-${pkgver}.tar.gz)
-sha512sums=('e6ebf0c2d2081408ef3d4f4a2a44712e86f70019e34da5de49c1a31a26d69cafac07afb501be24bc95a2525e038a47a74f02279981ade1d33b3e96d3dbb5ce5f')
+source=(https://pypi.org/packages/source/q/qrencode/qrencode-${pkgver}.tar.gz
+        python-3.10.patch)
+sha512sums=('e6ebf0c2d2081408ef3d4f4a2a44712e86f70019e34da5de49c1a31a26d69cafac07afb501be24bc95a2525e038a47a74f02279981ade1d33b3e96d3dbb5ce5f'
+            
'862e99e857cf6863a16d7b13467cbfb05b5f2b61008ebc20f36ae58258fa728195df2fea8585e6f1043ade1b9e9eaa28641c3dfd31b6be29b8681289b2c94cab')
 
-package_python-qrencode() {
+prepare() {
+  cd qrencode-${pkgver}
+  # Python 3.10 compatibility
+  # https://bugs.archlinux.org/task/73372
+  # https://github.com/Arachnid/pyqrencode/pull/14
+  patch -Np1 -i ../python-3.10.patch
+}
+
+package() {
   cd qrencode-${pkgver}
   python setup.py install --prefix=/usr --root="${pkgdir}" -O1
 }


=====================================
python-3.10.patch
=====================================
@@ -0,0 +1,41 @@
+From a0d9942b601cdb3e585f3b38c11c7e62930856e7 Mon Sep 17 00:00:00 2001
+From: anarcat <anar...@users.noreply.github.com>
+Date: Thu, 2 Mar 2023 22:54:32 -0500
+Subject: [PATCH] adapt to changes in Python 3.10
+
+It looks like the qrencode Python library is currently unusable in
+Debian bookworm. Here's a simple example:
+
+anarcat@angela:paperbackup$ python3 -c 'import qrencode ; version, size, data 
= qrencode.encode(b"test")'
+Traceback (most recent call last):
+  File "<string>", line 1, in <module>
+  File "/usr/lib/python3/dist-packages/qrencode/__init__.py", line 47, in 
encode
+    version, size, data = _encode(data, version, level, hint, True)
+                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+SystemError: PY_SSIZE_T_CLEAN macro must be defined for '#' formats
+anarcat@angela:paperbackup[1]$
+
+According to a casual search on the web, it looks like the extension
+needs to be recompiled / patched for Python 3.10:
+
+https://stackoverflow.com/a/71019907
+
+Quote:
+
+> On 3.10 any module(s) that use the # variant when parsing arguments
+> need to have a #define PY_SSIZE_T_CLEAN before including Python.h.
+
+I don't actually know what I'm doing here to be real honest, but that fixes 
the problem on my end.
+---
+ qr_encode.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/qr_encode.c b/qr_encode.c
+index 52f3575..caa93bc 100644
+--- a/qr_encode.c
++++ b/qr_encode.c
+@@ -1,3 +1,4 @@
++#define PY_SSIZE_T_CLEAN
+ #include <Python.h>
+ #include <stdlib.h>
+ #include <qrencode.h>



View it on GitLab: 
https://gitlab.archlinux.org/archlinux/packaging/packages/python-qrencode/-/commit/824d0b2525541c1a334d7c7422bf756080886aa6

-- 
View it on GitLab: 
https://gitlab.archlinux.org/archlinux/packaging/packages/python-qrencode/-/commit/824d0b2525541c1a334d7c7422bf756080886aa6
You're receiving this email because of your account on gitlab.archlinux.org.


Reply via email to