diff options
| author | CoprDistGit <infra@openeuler.org> | 2023-04-11 16:08:50 +0000 |
|---|---|---|
| committer | CoprDistGit <infra@openeuler.org> | 2023-04-11 16:08:50 +0000 |
| commit | 3806de3b9c0057ab593fd26c6ca3a3fd67576a2c (patch) | |
| tree | 95a206c1e0f0de0b67cacf462bab9d353d8baffc /python-hid.spec | |
| parent | 63e18752c917fc42b8c9dd5154baec96bf08910a (diff) | |
automatic import of python-hid
Diffstat (limited to 'python-hid.spec')
| -rw-r--r-- | python-hid.spec | 348 |
1 files changed, 348 insertions, 0 deletions
diff --git a/python-hid.spec b/python-hid.spec new file mode 100644 index 0000000..1a0bc4e --- /dev/null +++ b/python-hid.spec @@ -0,0 +1,348 @@ +%global _empty_manifest_terminate_build 0 +Name: python-hid +Version: 1.0.5 +Release: 1 +Summary: ctypes bindings for hidapi +License: MIT +URL: https://github.com/apmorton/pyhidapi +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/e0/2a/87d8d87343c9be4f839972b0a3bef66b8b4f0d350cda11f2d3d8222f29ab/hid-1.0.5.tar.gz +BuildArch: noarch + + +%description +# Installing pyhidapi +pyhidapi is available on [PyPI](https://pypi.org/project/hid/) and can be installed using pip. +``` +pip install hid +``` + +pyhidapi is dependant upon the [hidapi library](https://github.com/libusb/hidapi), which must be installed separately. + +# Installing hidapi + +## Linux +Installation procedures vary depending on your distribution. + +### Arch Linux +Binary distributions are available in the community repository. + +1. Enable the community repository in `/etc/pacman.conf` +``` +[community] +Include = /etc/pacman.d/mirrorlist +``` +2. Install hidapi +``` +pacman -Sy hidapi +``` + +### CentOS/RHEL +Binary distributions are available through [EPEL](https://fedoraproject.org/wiki/EPEL). +``` +yum install hidapi +``` + +### Fedora +Binary distributions are available. +``` +dnf install hidapi +``` + +### Ubuntu/Debian +Binary distributions are available. + +``` +apt install libhidapi-hidraw0 +``` +or +``` +apt install libhidapi-libusb0 +``` + +### Others +Binary distributions may be available in your package repositories. If not, you can build from source as described [in the libusb/hidapi README](https://github.com/libusb/hidapi#build-instructions). + +## Windows +Installation procedure for Windows is described [in the libusb/hidapi README](https://github.com/libusb/hidapi#building-on-windows) + +Binary distributions are provided by [libusb/hidapi](https://github.com/libusb/hidapi/releases) + +## OSX +There are currently no official binary distributions for Mac, so you must build hidapi yourself. + +Installation instructions are described [in the libusb/hidapi README](https://github.com/libusb/hidapi#mac) + +You can also use brew: +``` +brew install hidapi +``` + +## FreeBSD +Binary distributions are available. + +``` +pkg install -g 'py3*-hid' +``` + +# Sample usage code + +The details about a HID device can be printed with following code: + +```python +import hid + +vid = 0x046d # Change it for your device +pid = 0xc534 # Change it for your device + +with hid.Device(vid, pid) as h: + print(f'Device manufacturer: {h.manufacturer}') + print(f'Product: {h.product}') + print(f'Serial Number: {h.serial}') +``` + + + + + +%package -n python3-hid +Summary: ctypes bindings for hidapi +Provides: python-hid +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-hid +# Installing pyhidapi +pyhidapi is available on [PyPI](https://pypi.org/project/hid/) and can be installed using pip. +``` +pip install hid +``` + +pyhidapi is dependant upon the [hidapi library](https://github.com/libusb/hidapi), which must be installed separately. + +# Installing hidapi + +## Linux +Installation procedures vary depending on your distribution. + +### Arch Linux +Binary distributions are available in the community repository. + +1. Enable the community repository in `/etc/pacman.conf` +``` +[community] +Include = /etc/pacman.d/mirrorlist +``` +2. Install hidapi +``` +pacman -Sy hidapi +``` + +### CentOS/RHEL +Binary distributions are available through [EPEL](https://fedoraproject.org/wiki/EPEL). +``` +yum install hidapi +``` + +### Fedora +Binary distributions are available. +``` +dnf install hidapi +``` + +### Ubuntu/Debian +Binary distributions are available. + +``` +apt install libhidapi-hidraw0 +``` +or +``` +apt install libhidapi-libusb0 +``` + +### Others +Binary distributions may be available in your package repositories. If not, you can build from source as described [in the libusb/hidapi README](https://github.com/libusb/hidapi#build-instructions). + +## Windows +Installation procedure for Windows is described [in the libusb/hidapi README](https://github.com/libusb/hidapi#building-on-windows) + +Binary distributions are provided by [libusb/hidapi](https://github.com/libusb/hidapi/releases) + +## OSX +There are currently no official binary distributions for Mac, so you must build hidapi yourself. + +Installation instructions are described [in the libusb/hidapi README](https://github.com/libusb/hidapi#mac) + +You can also use brew: +``` +brew install hidapi +``` + +## FreeBSD +Binary distributions are available. + +``` +pkg install -g 'py3*-hid' +``` + +# Sample usage code + +The details about a HID device can be printed with following code: + +```python +import hid + +vid = 0x046d # Change it for your device +pid = 0xc534 # Change it for your device + +with hid.Device(vid, pid) as h: + print(f'Device manufacturer: {h.manufacturer}') + print(f'Product: {h.product}') + print(f'Serial Number: {h.serial}') +``` + + + + + +%package help +Summary: Development documents and examples for hid +Provides: python3-hid-doc +%description help +# Installing pyhidapi +pyhidapi is available on [PyPI](https://pypi.org/project/hid/) and can be installed using pip. +``` +pip install hid +``` + +pyhidapi is dependant upon the [hidapi library](https://github.com/libusb/hidapi), which must be installed separately. + +# Installing hidapi + +## Linux +Installation procedures vary depending on your distribution. + +### Arch Linux +Binary distributions are available in the community repository. + +1. Enable the community repository in `/etc/pacman.conf` +``` +[community] +Include = /etc/pacman.d/mirrorlist +``` +2. Install hidapi +``` +pacman -Sy hidapi +``` + +### CentOS/RHEL +Binary distributions are available through [EPEL](https://fedoraproject.org/wiki/EPEL). +``` +yum install hidapi +``` + +### Fedora +Binary distributions are available. +``` +dnf install hidapi +``` + +### Ubuntu/Debian +Binary distributions are available. + +``` +apt install libhidapi-hidraw0 +``` +or +``` +apt install libhidapi-libusb0 +``` + +### Others +Binary distributions may be available in your package repositories. If not, you can build from source as described [in the libusb/hidapi README](https://github.com/libusb/hidapi#build-instructions). + +## Windows +Installation procedure for Windows is described [in the libusb/hidapi README](https://github.com/libusb/hidapi#building-on-windows) + +Binary distributions are provided by [libusb/hidapi](https://github.com/libusb/hidapi/releases) + +## OSX +There are currently no official binary distributions for Mac, so you must build hidapi yourself. + +Installation instructions are described [in the libusb/hidapi README](https://github.com/libusb/hidapi#mac) + +You can also use brew: +``` +brew install hidapi +``` + +## FreeBSD +Binary distributions are available. + +``` +pkg install -g 'py3*-hid' +``` + +# Sample usage code + +The details about a HID device can be printed with following code: + +```python +import hid + +vid = 0x046d # Change it for your device +pid = 0xc534 # Change it for your device + +with hid.Device(vid, pid) as h: + print(f'Device manufacturer: {h.manufacturer}') + print(f'Product: {h.product}') + print(f'Serial Number: {h.serial}') +``` + + + + + +%prep +%autosetup -n hid-1.0.5 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-hid -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Tue Apr 11 2023 Python_Bot <Python_Bot@openeuler.org> - 1.0.5-1 +- Package Spec generated |
