forked from pool/python-libusb1
Accepting request 1227781 from devel:languages:python
OBS-URL: https://build.opensuse.org/request/show/1227781 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-libusb1?expand=0&rev=6
This commit is contained in:
57
py313.patch
Normal file
57
py313.patch
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
From e8fdf43ff4b0ba55edbbb83a6822d62f0f755e64 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Antoine Damhet <xdbob@xdbob.net>
|
||||||
|
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 <xdbob@xdbob.net>
|
||||||
|
---
|
||||||
|
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:
|
||||||
@@ -1,3 +1,8 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Mon Dec 2 12:43:40 UTC 2024 - Markéta Machová <mmachova@suse.com>
|
||||||
|
|
||||||
|
- Add upstream py313.patch to fix build with new python
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Fri Dec 8 08:19:05 UTC 2023 - Dirk Müller <dmueller@suse.com>
|
Fri Dec 8 08:19:05 UTC 2023 - Dirk Müller <dmueller@suse.com>
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# spec file for package python-libusb1
|
# spec file for package python-libusb1
|
||||||
#
|
#
|
||||||
# Copyright (c) 2023 SUSE LLC
|
# Copyright (c) 2024 SUSE LLC
|
||||||
#
|
#
|
||||||
# All modifications and additions to the file contributed by third parties
|
# All modifications and additions to the file contributed by third parties
|
||||||
# remain the property of their copyright owners, unless otherwise agreed
|
# remain the property of their copyright owners, unless otherwise agreed
|
||||||
@@ -16,7 +16,6 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
|
|
||||||
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
|
|
||||||
Name: python-libusb1
|
Name: python-libusb1
|
||||||
Version: 3.1.0
|
Version: 3.1.0
|
||||||
Release: 0
|
Release: 0
|
||||||
@@ -26,6 +25,8 @@ Summary: Python wrapper for libusb-1.0
|
|||||||
License: LGPL-2.1-or-later
|
License: LGPL-2.1-or-later
|
||||||
URL: https://github.com/vpelletier/%{name}
|
URL: https://github.com/vpelletier/%{name}
|
||||||
Source: https://files.pythonhosted.org/packages/source/l/libusb1/libusb1-%{version}.tar.gz
|
Source: https://files.pythonhosted.org/packages/source/l/libusb1/libusb1-%{version}.tar.gz
|
||||||
|
# PATCH-FIX-UPSTREAM https://github.com/vpelletier/python-libusb1/pull/104 testUSB1: fix python 3.13 support
|
||||||
|
Patch: py313.patch
|
||||||
BuildRequires: %{python_module setuptools}
|
BuildRequires: %{python_module setuptools}
|
||||||
BuildRequires: fdupes
|
BuildRequires: fdupes
|
||||||
BuildRequires: libusb-1_0-0 >= 1.0.21
|
BuildRequires: libusb-1_0-0 >= 1.0.21
|
||||||
@@ -38,7 +39,7 @@ BuildArch: noarch
|
|||||||
This is a pure python wrapper for libusb-1.0.
|
This is a pure python wrapper for libusb-1.0.
|
||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q -n libusb1-%{version}
|
%autosetup -p1 -n libusb1-%{version}
|
||||||
sed -i '/wheel/d' setup.py
|
sed -i '/wheel/d' setup.py
|
||||||
|
|
||||||
sed -i '1{/^#!/d}' examples/*.py
|
sed -i '1{/^#!/d}' examples/*.py
|
||||||
@@ -57,6 +58,9 @@ chmod a-x examples/*.py
|
|||||||
%files %{python_files}
|
%files %{python_files}
|
||||||
%doc README.rst examples/
|
%doc README.rst examples/
|
||||||
%license COPYING.LESSER
|
%license COPYING.LESSER
|
||||||
%{python_sitelib}/*
|
%{python_sitelib}/libusb1.py
|
||||||
|
%{python_sitelib}/usb1
|
||||||
|
%pycache_only %{python_sitelib}/__pycache__/libusb1*
|
||||||
|
%{python_sitelib}/libusb1-%{version}*info
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
|||||||
Reference in New Issue
Block a user