Closed flit closed 2 years ago
Seems like a Cython issue fixed in https://github.com/cython/cython/pull/4428
The problem is actually the hid.c
file included in the sdist generated from Cython before cython/cython#4428 was fixed. If I build from a git clone or install with pip using git+https://github.com/trezor/cython-hidapi
it works fine.
So… imo, this issue remains open until a new sdist is released with an updated hid.c
. Would you mind whenever you get a chance? 🙏🏽
Thanks! 😄
I just uploaded 0.12.0 to PyPi - https://pypi.org/project/hidapi/0.12.0/#files
Can you please try if that fixed the issue?
Thanks
Unexpectedly, it doesn't build successfully on install.
$ python --version
Python 3.11.0b1
$ pip install hidapi
Collecting hidapi
Downloading hidapi-0.12.0.tar.gz (145 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 145.9/145.9 kB 2.8 MB/s eta 0:00:00
Preparing metadata (setup.py) ... done
Requirement already satisfied: setuptools>=19.0 in ./venv311/lib/python3.11/site-packages (from hidapi) (62.3.2)
Building wheels for collected packages: hidapi
Building wheel for hidapi (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [20 lines of output]
/Users/creed/test/venv311/lib/python3.11/site-packages/setuptools/installer.py:27: SetuptoolsDeprecationWarning: setuptools.installer is deprecated. Requirements should be satisfied by a PEP 517 installer.
warnings.warn(
running bdist_wheel
running build
running build_ext
skipping 'hid.c' Cython extension (up-to-date)
building 'hid' extension
creating build
creating build/temp.macosx-12.2-x86_64-cpython-311
creating build/temp.macosx-12.2-x86_64-cpython-311/hidapi
creating build/temp.macosx-12.2-x86_64-cpython-311/hidapi/mac
clang -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -framework IOKit -framework CoreFoundation -framework AppKit -Ihidapi/hidapi -I/Users/creed/test/venv311/include -I/Users/creed/.pyenv/versions/3.11.0b1/include/python3.11 -c hid.c -o build/temp.macosx-12.2-x86_64-cpython-311/hid.o
clang: warning: -framework IOKit: 'linker' input unused [-Wunused-command-line-argument]
clang: warning: -framework CoreFoundation: 'linker' input unused [-Wunused-command-line-argument]
clang: warning: -framework AppKit: 'linker' input unused [-Wunused-command-line-argument]
hid.c:253:12: fatal error: 'longintrepr.h' file not found
#include "longintrepr.h"
^~~~~~~~~~~~~~~
1 error generated.
error: command '/usr/bin/clang' failed with exit code 1
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for hidapi
Could you have had an existing hid.c
in your working copy when you built the sdist? I had to remove my copy in order to force regeneration via the updated Cython.
Yeah… the hid.c
files in both 0.11.2 and 0.12.0 sdists are exactly the same.
I generated the result via cython 0.29.30.
Not sure what to do next ... 🤷
Delete hid.c
from the working copy root, build/install so that hid.c
is regenerated, then build the sdist.
When I do this, the generated hid.c
is different from the one included in the 0.12.0 sdist.
When I do this, the generated
hid.c
is different from the one included in the 0.12.0 sdist.
Good catch! I wrongly assumed that hid.c
is regenerated when I run python3 setup.py sdist
🤦
Will upload 0.12.0.post1 with regenerated hid.c
to PyPI soon
Uploaded 0.12.0.post2 to PyPI : https://pypi.org/project/hidapi/0.12.0.post2/#files
@flit can you please check whether this works for you?
I will upload wheels once the fix has been confirmed.
🎉 Works perfectly!
Thanks very much for fixing this quickly.
Host OS: macOS 12.4 (21F79) Python: 3.11.0b1 installed via pyenv 2.3.1 wheel: 0.37.1 pip: 22.1.2
Build log: