From ddf8906dac4836e1e8ec797f09c4073b2febd18f8ab783831077af5a195aca27 Mon Sep 17 00:00:00 2001 From: Nico Krapp Date: Wed, 22 Jan 2025 13:01:50 +0000 Subject: [PATCH] - Update to 3.2.0 * Add example for scanning the complete device tree * Fix CRLF problem * testUSB1: Fix python 3.13 support - Drop py313.patch, merged upstream OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-libusb1?expand=0&rev=13 --- .gitattributes | 23 ++++++++ .gitignore | 1 + libusb1-3.1.0.tar.gz | 3 + libusb1-3.2.0.tar.gz | 3 + py313.patch | 57 +++++++++++++++++++ python-libusb1.changes | 124 +++++++++++++++++++++++++++++++++++++++++ python-libusb1.spec | 64 +++++++++++++++++++++ 7 files changed, 275 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 libusb1-3.1.0.tar.gz create mode 100644 libusb1-3.2.0.tar.gz create mode 100644 py313.patch create mode 100644 python-libusb1.changes create mode 100644 python-libusb1.spec diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,23 @@ +## Default LFS +*.7z filter=lfs diff=lfs merge=lfs -text +*.bsp filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.gem filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.jar filter=lfs diff=lfs merge=lfs -text +*.lz filter=lfs diff=lfs merge=lfs -text +*.lzma filter=lfs diff=lfs merge=lfs -text +*.obscpio filter=lfs diff=lfs merge=lfs -text +*.oxt filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.rpm filter=lfs diff=lfs merge=lfs -text +*.tbz filter=lfs diff=lfs merge=lfs -text +*.tbz2 filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.txz filter=lfs diff=lfs merge=lfs -text +*.whl filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57affb6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.osc diff --git a/libusb1-3.1.0.tar.gz b/libusb1-3.1.0.tar.gz new file mode 100644 index 0000000..edd7b51 --- /dev/null +++ b/libusb1-3.1.0.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4ee9b0a55f8bd0b3ea7017ae919a6c1f439af742c4a4b04543c5fd7af89b828c +size 83013 diff --git a/libusb1-3.2.0.tar.gz b/libusb1-3.2.0.tar.gz new file mode 100644 index 0000000..daea491 --- /dev/null +++ b/libusb1-3.2.0.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a11a6095e718cd49418a96329314da271cca6be7b4317a142724523371ac8961 +size 105601 diff --git a/py313.patch b/py313.patch new file mode 100644 index 0000000..c320a5d --- /dev/null +++ b/py313.patch @@ -0,0 +1,57 @@ +From e8fdf43ff4b0ba55edbbb83a6822d62f0f755e64 Mon Sep 17 00:00:00 2001 +From: Antoine Damhet +Date: Tue, 13 Aug 2024 17:22:01 +0200 +Subject: [PATCH] testUSB1: fix python 3.13 support + +PEP 667[1] makes all calls to `locals()` return a snapshot of the local +context. Fix the tests by removing the `local_dict` variable and keep +looking at the latest `locals()` state. + +[1]: https://peps.python.org/pep-0667/ + +Signed-off-by: Antoine Damhet +--- + usb1/testUSB1.py | 10 ++++------ + 1 file changed, 4 insertions(+), 6 deletions(-) + +diff --git a/usb1/testUSB1.py b/usb1/testUSB1.py +index ce33031..cc5503d 100644 +--- a/usb1/testUSB1.py ++++ b/usb1/testUSB1.py +@@ -278,15 +278,14 @@ def testDefaultEnumScope(self): + """ + ENUM_NAME = 'THE_ANSWER' + ENUM_VALUE = 42 +- local_dict = locals() + global_dict = globals() +- self.assertEqual(local_dict.get(ENUM_NAME), None) ++ self.assertEqual(locals().get(ENUM_NAME), None) + self.assertEqual(global_dict.get(ENUM_NAME), None) + self.assertEqual(getattr(libusb1, ENUM_NAME, None), None) + # pylint: disable=unused-variable + TEST_ENUM = libusb1.Enum({ENUM_NAME: ENUM_VALUE}) + # pylint: enable=unused-variable +- self.assertEqual(local_dict.get(ENUM_NAME), ENUM_VALUE) ++ self.assertEqual(locals().get(ENUM_NAME), ENUM_VALUE) + self.assertEqual(global_dict.get(ENUM_NAME), None) + self.assertEqual(getattr(libusb1, ENUM_NAME, None), None) + +@@ -296,16 +295,15 @@ def testExplicitEnumScope(self): + """ + ENUM_NAME = 'THE_ANSWER' + ENUM_VALUE = 42 +- local_dict = locals() + global_dict = globals() +- self.assertEqual(local_dict.get(ENUM_NAME), None) ++ self.assertEqual(locals().get(ENUM_NAME), None) + self.assertEqual(global_dict.get(ENUM_NAME), None) + self.assertEqual(getattr(libusb1, ENUM_NAME, None), None) + # pylint: disable=unused-variable + TEST_ENUM = libusb1.Enum({ENUM_NAME: ENUM_VALUE}, global_dict) + # pylint: enable=unused-variable + try: +- self.assertEqual(local_dict.get(ENUM_NAME), None) ++ self.assertEqual(locals().get(ENUM_NAME), None) + self.assertEqual(global_dict.get(ENUM_NAME), ENUM_VALUE) + self.assertEqual(getattr(libusb1, ENUM_NAME, None), None) + finally: diff --git a/python-libusb1.changes b/python-libusb1.changes new file mode 100644 index 0000000..7a8780a --- /dev/null +++ b/python-libusb1.changes @@ -0,0 +1,124 @@ +------------------------------------------------------------------- +Wed Jan 22 12:50:43 UTC 2025 - John Paul Adrian Glaubitz + +- Update to 3.2.0 + * Add example for scanning the complete device tree + * Fix CRLF problem + * testUSB1: Fix python 3.13 support +- Drop py313.patch, merged upstream + +------------------------------------------------------------------- +Mon Dec 2 12:43:40 UTC 2024 - Markéta Machová + +- Add upstream py313.patch to fix build with new python + +------------------------------------------------------------------- +Fri Dec 8 08:19:05 UTC 2023 - Dirk Müller + +- update to 3.1.0: + * Fix bug preventing use of setPollFDNotifiers. + * Wrap libusb_interrupt_event_handler, available since libusb + 1.0.21, to help applications wake an event handling thread (ex: + durring exit). + +------------------------------------------------------------------- +Thu Mar 3 04:49:28 UTC 2022 - Steve Kowalik + +- Update to 3.0.0: + * Add support for pyinstaller. + * Fix support for python 3.10. + * Drop python <3.4 support. + * Do not load the C library on import. Allows applications to customise + the lookup logic (see usb1.loadLibrary). + * Add LIBUSB_SPEED_SUPER_PLUS. + * Better control device iterator end of life. + * Fix objects escaping control from their parent. + * Fix a TypeError exception in USBContext.handleEvents. + * Fix an AttributeError exception in USBContext.hotplugRegisterCallback. + * Fix segfault in pypy3 when finalizing USBDevice objects. + * Source only: convert examples to python3. + * Release process: also run some examples scripts. + * Update versioneer to be compatible with 3.11. + * Drop python <3.6 support. + +------------------------------------------------------------------- +Wed Jan 20 09:43:06 UTC 2021 - John Vandenberg + +- Update to v1.9.1 + * Fix installation from pypi source tarball, broken in 1.8.1 +- from v1.9 + * Drop USBPollerThread + * Deprecate libusb-lock-related USBContext API +- from v1.8.1 + * Embed libusb1 dll for easier deployment on Windows + * Cryptographically signed releases + * Use libusb_free_pollfds whenever available (libusb1>=1.0.20) + * Fix hotplug callback destruction at context teardown + * Drop remnants of python 2.6 support code +- from v1.8 + * Fix getExtra and libusb1.libusb_control_transfer_get_data + * Fix getMaxPower unit on SuperSpeed devices + +------------------------------------------------------------------- +Wed May 15 21:54:23 UTC 2019 - Jonathan Harker + +- Upgrade to 1.7.1: + * usb1.__version__ is now present, managed by versioneer. Fix an occasional + segfault when closing a transfer from inside its callback function. + +------------------------------------------------------------------- +Mon Apr 15 06:40:15 UTC 2019 - John Vandenberg + +- Activate test suite +- Remove unnecessary build dependencies, and add BuildArch: noarch +- Remove GPL license as it was relicensed to LGPL2.1+ in May 2015 + +------------------------------------------------------------------- +Fri Dec 14 16:38:03 UTC 2018 - marec@detebe.org + +- Update to version 1.7: + * Bump to 1.7 . + * setup: Simplify. + * Bump copyright year. + * usb1: Expose transferred byte count and received bytes on synchronous API + * usb1: Fix docstring interruptRead refering to itself. + * Specify that it is compatible with python 3 in setup.py + * README: libusb.org seems dead, switch to the fork. + * usb1: Move getManufacturer, getProduct ,getSerialNumber to USBDeviceHandle. + * usb1: get{,ASCII}StringDescriptor now return None for descriptor 0. + * Bump to 1.6.6 . + +------------------------------------------------------------------- +Mon Aug 27 10:41:21 UTC 2018 - marec@detebe.org + +- Update to version 1.6.6: + * Bump to 1.6.6 . + * usb1: Expose string descriptors on USBDevice. + * Bump to 1.6.5 . + * usb1: Bind "cast" to USBContext class. + * Cast libusb pollfd callbacks from null pointer to proper type. + * examples: Make hotplug and listdev examples python3-friendly. + * setup.py: Tell setuptools to run 2to3 when running on python3 + * usb1: Document hotplug handler limitations. + * Bump to 1.6.4 . + * usb1: Fix asynchronous control transfer buffer. + +------------------------------------------------------------------- +Tue Jul 24 16:22:41 UTC 2018 - marec@detebe.org + +- Update to version 1.6.5: + * Bump to 1.6.5 . + * usb1: Bind "cast" to USBContext class. + * Cast libusb pollfd callbacks from null pointer to proper type. + * examples: Make hotplug and listdev examples python3-friendly. + * setup.py: Tell setuptools to run 2to3 when running on python3 + * usb1: Document hotplug handler limitations. + * Bump to 1.6.4 . + * usb1: Fix asynchronous control transfer buffer. + * Bump to 1.6.3 . + * Deprecate USBPollerThread. + +------------------------------------------------------------------- +Thu Jun 21 18:06:13 UTC 2018 - marec@detebe.org + +- initial package build diff --git a/python-libusb1.spec b/python-libusb1.spec new file mode 100644 index 0000000..6c959b4 --- /dev/null +++ b/python-libusb1.spec @@ -0,0 +1,64 @@ +# +# spec file for package python-libusb1 +# +# Copyright (c) 2025 SUSE LLC +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via https://bugs.opensuse.org/ +# + + +Name: python-libusb1 +Version: 3.2.0 +Release: 0 +Summary: Python wrapper for libusb-1.0 +# Relicensed from GPL to LGPLv2.1+ in May 2015 +# https://github.com/vpelletier/python-libusb1/commit/238eaefa0759622afc554884b4b333d9bf946c65 +License: LGPL-2.1-or-later +URL: https://github.com/vpelletier/%{name} +Source: https://files.pythonhosted.org/packages/source/l/libusb1/libusb1-%{version}.tar.gz +BuildRequires: %{python_module setuptools} +BuildRequires: fdupes +BuildRequires: libusb-1_0-0 >= 1.0.21 +BuildRequires: python-rpm-macros +Requires: libusb-1_0-0 >= 1.0.21 +BuildArch: noarch +%python_subpackages + +%description +This is a pure python wrapper for libusb-1.0. + +%prep +%autosetup -p1 -n libusb1-%{version} +sed -i '/wheel/d' setup.py + +sed -i '1{/^#!/d}' examples/*.py +chmod a-x examples/*.py + +%build +%python_build + +%install +%python_install +%python_expand %fdupes %{buildroot}%{$python_sitelib} + +%check +%python_exec -m usb1.testUSB1 -v + +%files %{python_files} +%doc README.rst examples/ +%license COPYING.LESSER +%{python_sitelib}/libusb1.py +%{python_sitelib}/usb1 +%pycache_only %{python_sitelib}/__pycache__/libusb1* +%{python_sitelib}/libusb1-%{version}*info + +%changelog