diff options
| author | CoprDistGit <infra@openeuler.org> | 2023-04-11 21:29:52 +0000 |
|---|---|---|
| committer | CoprDistGit <infra@openeuler.org> | 2023-04-11 21:29:52 +0000 |
| commit | c46de47a4a322732fb2ab545e3614ae6e0765ddb (patch) | |
| tree | 7ebab845de901c1dbdd32886eb46b6019d021ad2 | |
| parent | 4f393d9fe1289e13e1204c1303ef268abfc78849 (diff) | |
automatic import of python-libusb-package
| -rw-r--r-- | .gitignore | 1 | ||||
| -rw-r--r-- | python-libusb-package.spec | 422 | ||||
| -rw-r--r-- | sources | 1 |
3 files changed, 424 insertions, 0 deletions
@@ -0,0 +1 @@ +/libusb-package-1.0.26.1.tar.gz diff --git a/python-libusb-package.spec b/python-libusb-package.spec new file mode 100644 index 0000000..3d9fe9c --- /dev/null +++ b/python-libusb-package.spec @@ -0,0 +1,422 @@ +%global _empty_manifest_terminate_build 0 +Name: python-libusb-package +Version: 1.0.26.1 +Release: 1 +Summary: Package containing libusb so it can be installed via Python package managers +License: Apache 2.0 +URL: https://github.com/pyocd/libusb-package +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/46/eb/4640c50f990f0b7433803f3553a08bbdf8b0d2d121704297b6b4708579bc/libusb-package-1.0.26.1.tar.gz + + +%description +# Container package for libusb + +This Python package functions as an installation vehicle for libusb shared libraries, to +simplify installation of tools that require libusb. The main use case is so that users +don't have to install libusb manually for projects that use pyusb. However, any Python +project that uses a libusb wrapper can also benefit. + +See [libusb.info](https://libusb.info) for more information about libusb. + +Note: Currently the included libusb is built _without_ udev support on Linux. + +Note: The libusb upstream git repository is included as a submodule, so you need to clone with submodules +enabled. You can either clone with `--recurse-submodules` or run `git submodule update --init` after cloning. + + +## Installation + +All releases include wheels for Linux, macOS, and Windows for multiple architectures. In addition, a source +distribution is released. + +If a matching wheel is not available, the source distribution will be installed and libusb will be compiled. +This means the libusb build requirements must be installed: + +- Linux and macOS: autoconf, automake, libtool, and m4. As mentioned above, libusb is built without udev support, + so libudev-dev is not required on Linux. +- Windows: Visual Studio 2019 (Community is ok). + +If the libusb build fails when installing from a source distribution, the `libusb-package` install _will still +succeed_. In this case, an "empty" `libusb-package` is installed that doesn't contain a libusb shared library. +`get_library_path()` returns None and `find_library()` falls back to returning a system installation of libusb, +if available. + +You can also install from a clone of the git repository by running `pip install .` from the repository root directory. +Editable installs are supported. Please note that running `setup.py` directly is no longer supported for PEP 517 +compliant packages. When building from the repo, because libusb 1.0.24 does not support out of tree builds, the build is +done in-place in the `src/libusb` directory. `make clean` is run before compiling to ensure a clean build. + + +## APIs + +There are four public functions exported by `libusb_package`. + +- `find(*args, **kwargs)`: Wrapper around pyusb's `usb.core.find()` that sets the `backend` + parameter to a libusb1 backend created from the libusb library included in `libusb_package`. + All other parameters are passed unmodified + +- `get_libusb1_backend()`: Returns a `pyusb` backend object for the libusb version contained + in `libusb_package`. + +- `find_library(candidate)`: Lower level function that returns either the full path to a + library contained in `libusb_package` with a name starting with `candidate`, or None if + no matching library is found. This function is suitable for use with the `find_library` + callback parameter for pyusb's `get_backend()` functions. + + If `get_library_path()` returns None, indicating there is no included library, this function + will fall back to `ctypes.util.find_library()`. + +- `get_library_path()`: Returns an absolute Path object for the included library. If there is not + an included library, None is returned. + +Both `get_libusb1_backend()` and `get_library_path()` cache their return values. + + +## Versioning + +The version of libusb-package is composed of the libusb version plus an additional field for +the version of the Python code. For instance, 1.0.24.0. The Python code version will be reset +to 0 when the libusb version is incremented for new libusb release. + + +## Examples + +Usage example for `find()`: + +```py +import libusb_package + +for dev in libusb_package.find(find_all=True): + print(dev) +``` + + +Usage example for `find_library()`: + +```py +import libusb_package +import usb.core +import usb.backend.libusb1 + +libusb1_backend = usb.backend.libusb1.get_backend(find_library=libusb_package.find_library) +# -> calls usb.libloader.load_locate_library( +# ('usb-1.0', 'libusb-1.0', 'usb'), +# 'cygusb-1.0.dll', 'Libusb 1', +# win_cls=win_cls, +# find_library=find_library, check_symbols=('libusb_init',)) +# +# -> calls find_library(candidate) with candidate in ('usb-1.0', 'libusb-1.0', 'usb') +# returns lib name or path (as appropriate for OS) if matching lib is found + +# It would also be possible to pass the output of libusb_package.get_libsusb1_backend() +# to the backend parameter here. In fact, that function is simply a shorthand for the line +# above. +print(list(usb.core.find(find_all=True, backend=libusb1_backend))) +``` + + +### Source distribution + +Before building a source distribution, be sure to clean all untracked files from the libusb +submodule using `git -C src/libusb clean -dfx`. + + +### License + +The Python code for `libusb-package` is licensed with Apache 2.0.\ +The libusb library and its source code are licensed with GPLv2. + + +%package -n python3-libusb-package +Summary: Package containing libusb so it can be installed via Python package managers +Provides: python-libusb-package +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +BuildRequires: python3-cffi +BuildRequires: gcc +BuildRequires: gdb +%description -n python3-libusb-package +# Container package for libusb + +This Python package functions as an installation vehicle for libusb shared libraries, to +simplify installation of tools that require libusb. The main use case is so that users +don't have to install libusb manually for projects that use pyusb. However, any Python +project that uses a libusb wrapper can also benefit. + +See [libusb.info](https://libusb.info) for more information about libusb. + +Note: Currently the included libusb is built _without_ udev support on Linux. + +Note: The libusb upstream git repository is included as a submodule, so you need to clone with submodules +enabled. You can either clone with `--recurse-submodules` or run `git submodule update --init` after cloning. + + +## Installation + +All releases include wheels for Linux, macOS, and Windows for multiple architectures. In addition, a source +distribution is released. + +If a matching wheel is not available, the source distribution will be installed and libusb will be compiled. +This means the libusb build requirements must be installed: + +- Linux and macOS: autoconf, automake, libtool, and m4. As mentioned above, libusb is built without udev support, + so libudev-dev is not required on Linux. +- Windows: Visual Studio 2019 (Community is ok). + +If the libusb build fails when installing from a source distribution, the `libusb-package` install _will still +succeed_. In this case, an "empty" `libusb-package` is installed that doesn't contain a libusb shared library. +`get_library_path()` returns None and `find_library()` falls back to returning a system installation of libusb, +if available. + +You can also install from a clone of the git repository by running `pip install .` from the repository root directory. +Editable installs are supported. Please note that running `setup.py` directly is no longer supported for PEP 517 +compliant packages. When building from the repo, because libusb 1.0.24 does not support out of tree builds, the build is +done in-place in the `src/libusb` directory. `make clean` is run before compiling to ensure a clean build. + + +## APIs + +There are four public functions exported by `libusb_package`. + +- `find(*args, **kwargs)`: Wrapper around pyusb's `usb.core.find()` that sets the `backend` + parameter to a libusb1 backend created from the libusb library included in `libusb_package`. + All other parameters are passed unmodified + +- `get_libusb1_backend()`: Returns a `pyusb` backend object for the libusb version contained + in `libusb_package`. + +- `find_library(candidate)`: Lower level function that returns either the full path to a + library contained in `libusb_package` with a name starting with `candidate`, or None if + no matching library is found. This function is suitable for use with the `find_library` + callback parameter for pyusb's `get_backend()` functions. + + If `get_library_path()` returns None, indicating there is no included library, this function + will fall back to `ctypes.util.find_library()`. + +- `get_library_path()`: Returns an absolute Path object for the included library. If there is not + an included library, None is returned. + +Both `get_libusb1_backend()` and `get_library_path()` cache their return values. + + +## Versioning + +The version of libusb-package is composed of the libusb version plus an additional field for +the version of the Python code. For instance, 1.0.24.0. The Python code version will be reset +to 0 when the libusb version is incremented for new libusb release. + + +## Examples + +Usage example for `find()`: + +```py +import libusb_package + +for dev in libusb_package.find(find_all=True): + print(dev) +``` + + +Usage example for `find_library()`: + +```py +import libusb_package +import usb.core +import usb.backend.libusb1 + +libusb1_backend = usb.backend.libusb1.get_backend(find_library=libusb_package.find_library) +# -> calls usb.libloader.load_locate_library( +# ('usb-1.0', 'libusb-1.0', 'usb'), +# 'cygusb-1.0.dll', 'Libusb 1', +# win_cls=win_cls, +# find_library=find_library, check_symbols=('libusb_init',)) +# +# -> calls find_library(candidate) with candidate in ('usb-1.0', 'libusb-1.0', 'usb') +# returns lib name or path (as appropriate for OS) if matching lib is found + +# It would also be possible to pass the output of libusb_package.get_libsusb1_backend() +# to the backend parameter here. In fact, that function is simply a shorthand for the line +# above. +print(list(usb.core.find(find_all=True, backend=libusb1_backend))) +``` + + +### Source distribution + +Before building a source distribution, be sure to clean all untracked files from the libusb +submodule using `git -C src/libusb clean -dfx`. + + +### License + +The Python code for `libusb-package` is licensed with Apache 2.0.\ +The libusb library and its source code are licensed with GPLv2. + + +%package help +Summary: Development documents and examples for libusb-package +Provides: python3-libusb-package-doc +%description help +# Container package for libusb + +This Python package functions as an installation vehicle for libusb shared libraries, to +simplify installation of tools that require libusb. The main use case is so that users +don't have to install libusb manually for projects that use pyusb. However, any Python +project that uses a libusb wrapper can also benefit. + +See [libusb.info](https://libusb.info) for more information about libusb. + +Note: Currently the included libusb is built _without_ udev support on Linux. + +Note: The libusb upstream git repository is included as a submodule, so you need to clone with submodules +enabled. You can either clone with `--recurse-submodules` or run `git submodule update --init` after cloning. + + +## Installation + +All releases include wheels for Linux, macOS, and Windows for multiple architectures. In addition, a source +distribution is released. + +If a matching wheel is not available, the source distribution will be installed and libusb will be compiled. +This means the libusb build requirements must be installed: + +- Linux and macOS: autoconf, automake, libtool, and m4. As mentioned above, libusb is built without udev support, + so libudev-dev is not required on Linux. +- Windows: Visual Studio 2019 (Community is ok). + +If the libusb build fails when installing from a source distribution, the `libusb-package` install _will still +succeed_. In this case, an "empty" `libusb-package` is installed that doesn't contain a libusb shared library. +`get_library_path()` returns None and `find_library()` falls back to returning a system installation of libusb, +if available. + +You can also install from a clone of the git repository by running `pip install .` from the repository root directory. +Editable installs are supported. Please note that running `setup.py` directly is no longer supported for PEP 517 +compliant packages. When building from the repo, because libusb 1.0.24 does not support out of tree builds, the build is +done in-place in the `src/libusb` directory. `make clean` is run before compiling to ensure a clean build. + + +## APIs + +There are four public functions exported by `libusb_package`. + +- `find(*args, **kwargs)`: Wrapper around pyusb's `usb.core.find()` that sets the `backend` + parameter to a libusb1 backend created from the libusb library included in `libusb_package`. + All other parameters are passed unmodified + +- `get_libusb1_backend()`: Returns a `pyusb` backend object for the libusb version contained + in `libusb_package`. + +- `find_library(candidate)`: Lower level function that returns either the full path to a + library contained in `libusb_package` with a name starting with `candidate`, or None if + no matching library is found. This function is suitable for use with the `find_library` + callback parameter for pyusb's `get_backend()` functions. + + If `get_library_path()` returns None, indicating there is no included library, this function + will fall back to `ctypes.util.find_library()`. + +- `get_library_path()`: Returns an absolute Path object for the included library. If there is not + an included library, None is returned. + +Both `get_libusb1_backend()` and `get_library_path()` cache their return values. + + +## Versioning + +The version of libusb-package is composed of the libusb version plus an additional field for +the version of the Python code. For instance, 1.0.24.0. The Python code version will be reset +to 0 when the libusb version is incremented for new libusb release. + + +## Examples + +Usage example for `find()`: + +```py +import libusb_package + +for dev in libusb_package.find(find_all=True): + print(dev) +``` + + +Usage example for `find_library()`: + +```py +import libusb_package +import usb.core +import usb.backend.libusb1 + +libusb1_backend = usb.backend.libusb1.get_backend(find_library=libusb_package.find_library) +# -> calls usb.libloader.load_locate_library( +# ('usb-1.0', 'libusb-1.0', 'usb'), +# 'cygusb-1.0.dll', 'Libusb 1', +# win_cls=win_cls, +# find_library=find_library, check_symbols=('libusb_init',)) +# +# -> calls find_library(candidate) with candidate in ('usb-1.0', 'libusb-1.0', 'usb') +# returns lib name or path (as appropriate for OS) if matching lib is found + +# It would also be possible to pass the output of libusb_package.get_libsusb1_backend() +# to the backend parameter here. In fact, that function is simply a shorthand for the line +# above. +print(list(usb.core.find(find_all=True, backend=libusb1_backend))) +``` + + +### Source distribution + +Before building a source distribution, be sure to clean all untracked files from the libusb +submodule using `git -C src/libusb clean -dfx`. + + +### License + +The Python code for `libusb-package` is licensed with Apache 2.0.\ +The libusb library and its source code are licensed with GPLv2. + + +%prep +%autosetup -n libusb-package-1.0.26.1 + +%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-libusb-package -f filelist.lst +%dir %{python3_sitearch}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Tue Apr 11 2023 Python_Bot <Python_Bot@openeuler.org> - 1.0.26.1-1 +- Package Spec generated @@ -0,0 +1 @@ +4c3d53fdaf39de8c7ecf6da7edbb7a25 libusb-package-1.0.26.1.tar.gz |
