File hidapi-cython-3-0-support.patch of Package python-hidapi
From 749da6931f57c4c30596de678125648ccfd6e1cd Mon Sep 17 00:00:00 2001
From: Pavol Rusnak <pavol@rusnak.io>
Date: Thu, 20 Jul 2023 13:09:19 +0200
Subject: [PATCH] Require Cython<3 instead of Cython
---
setup.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: hidapi-0.14.0/setup.py
===================================================================
--- hidapi-0.14.0.orig/setup.py 2022-08-23 14:17:29.000000000 +0200
+++ hidapi-0.14.0/setup.py 2023-11-06 09:03:04.882813374 +0100
@@ -1,5 +1,6 @@
#!/usr/bin/python
from setuptools import setup, Extension
+from Cython.Build import cythonize
import os
import sys
import subprocess
@@ -9,7 +10,7 @@ hidapi_topdir = os.path.join("hidapi")
hidapi_include = os.path.join(hidapi_topdir, "hidapi")
system_hidapi = 0
libs = []
-src = ["hid.pyx", "chid.pxd"]
+src = ["hid.pyx"]
def hidapi_src(platform):
@@ -42,7 +43,7 @@ if sys.platform.startswith("linux"):
)
)
libs = ["udev", "rt"]
- src = ["hidraw.pyx", "chid.pxd"]
+ src = ["hidraw.pyx"]
if system_hidapi == 1:
libs.append("hidapi-hidraw")
else:
@@ -135,7 +136,6 @@ setup(
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
],
- ext_modules=modules,
- setup_requires=["Cython"],
+ ext_modules=cythonize(modules, language_level=3),
install_requires=["setuptools>=19.0"],
)
Index: hidapi-0.14.0/hid.pyxdep
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ hidapi-0.14.0/hid.pyxdep 2023-11-06 09:03:04.876146640 +0100
@@ -0,0 +1 @@
+chid.pxd
Index: hidapi-0.14.0/pyproject.toml
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ hidapi-0.14.0/pyproject.toml 2023-11-06 09:03:04.876146640 +0100
@@ -0,0 +1,3 @@
+[build-system]
+requires = ["setuptools", "Cython"]
+build-backend = "setuptools.build_meta"
Index: hidapi-0.14.0/requirements.txt
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ hidapi-0.14.0/requirements.txt 2023-11-06 09:04:05.063418378 +0100
@@ -0,0 +1 @@
+Cython>=3.0
Index: hidapi-0.14.0/README.rst
===================================================================
--- hidapi-0.14.0.orig/README.rst 2021-03-03 16:55:41.000000000 +0100
+++ hidapi-0.14.0/README.rst 2023-11-06 09:03:04.882813374 +0100
@@ -44,14 +44,10 @@ Build from source
1. Download cython-hidapi archive::
- $ git clone https://github.com/trezor/cython-hidapi.git
+ $ git clone --recursive https://github.com/trezor/cython-hidapi.git
$ cd cython-hidapi
-2. Initialize hidapi submodule::
-
- $ git submodule update --init
-
-3. Build cython-hidapi extension module::
+2. Build cython-hidapi extension module::
$ python setup.py build
@@ -59,7 +55,7 @@ Build from source
$ python setup.py build --without-libusb
-4. Install cython-hidapi module into your Python distribution::
+3. Install cython-hidapi module into your Python distribution::
$ sudo python setup.py install
@@ -67,13 +63,13 @@ Build from source
$ pip install -e .
-5. Test install::
+4. Test install::
$ python
>>> import hid
>>>
-6. Try example script::
+5. Try example script::
$ python try.py