Bug 278086

Summary: comms/py-hid: missing library path in __init__.py
Product: Ports & Packages Reporter: dennis <drac7ft>
Component: Individual Port(s)Assignee: Mateusz Piotrowski <0mp>
Status: Closed FIXED    
Severity: Affects Some People CC: 0mp
Priority: ---    
Version: Latest   
Hardware: amd64   
OS: Any   

Description dennis 2024-04-01 05:42:27 UTC
py-hid will fail due to not finding libhidapi.so.  The "library_paths" variable in the installed __init__.py located at /usr/local/lib/python3.9/site-packages/hid does not have a path for any suitable library for it to use.

I have successfully patched it by adding 'libhidapi.so' to the list of library_paths.  FreeBSD uses libhidapi.so and not any of the other library paths listed in __init__.py.

I don't have a formal diff, but adding libhidapi.so fixes the problem and py-hid works correctly for my test case.  It completely failed before.  I'm hoping the maintainer can put in the proper patch.
Comment 1 Mateusz Piotrowski freebsd_committer freebsd_triage 2024-04-11 15:26:09 UTC
Hey dennis, thank you for the report. Could you submit a PR upstream [1]? Then we could just update py-hid to a newer version and have the issue fixed without having to patch locally.

Also, I've returned the port to the pool, so if you'd like to become a maintainer, feel free to assume maintainership :)

[1]: https://github.com/apmorton/pyhidapi/blob/master/hid/__init__.py
Comment 2 commit-hook freebsd_committer freebsd_triage 2024-04-11 15:56:43 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=9675d0a4f943418c1dce991da3ad87734ed09152

commit 9675d0a4f943418c1dce991da3ad87734ed09152
Author:     Mateusz Piotrowski <0mp@FreeBSD.org>
AuthorDate: 2024-04-11 15:53:25 +0000
Commit:     Mateusz Piotrowski <0mp@FreeBSD.org>
CommitDate: 2024-04-11 15:55:47 +0000

    comms/py-hid: Add libhidapi.so to library_paths

    dennis <drac7ft@gmail.com> reportsed that py-hid would fail due to not
    finding libhidapi.so.  The "library_paths" variable in the installed
    __init__.py did not have a path for any suitable library for it to use.

    PR:             278086
    Reported by:    dennis <drac7ft@gmail.com>

 comms/py-hid/Makefile                              |  1 +
 comms/py-hid/files/patch-hid_____init____.py (new) | 10 ++++++++++
 2 files changed, 11 insertions(+)
Comment 3 Mateusz Piotrowski freebsd_committer freebsd_triage 2024-04-11 15:57:34 UTC
I've written a patch according to your description. Let me know if that fixed the issue.