diff --git a/fix-deprecation-warning.patch b/fix-deprecation-warning.patch index 9526b95..030b483 100644 --- a/fix-deprecation-warning.patch +++ b/fix-deprecation-warning.patch @@ -8,11 +8,11 @@ Subject: [PATCH] fix DeprecationWarning for logging and fake_filesystem pyu2f/tests/hid/linux_test.py | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) -diff --git a/pyu2f/hid/macos.py b/pyu2f/hid/macos.py -index 905bce2..919fd4d 100644 ---- a/pyu2f/hid/macos.py -+++ b/pyu2f/hid/macos.py -@@ -174,7 +174,7 @@ class _CFAllocator(_CFType): +Index: pyu2f-0.1.5a/pyu2f/hid/macos.py +=================================================================== +--- pyu2f-0.1.5a.orig/pyu2f/hid/macos.py ++++ pyu2f-0.1.5a/pyu2f/hid/macos.py +@@ -174,7 +174,7 @@ if sys.platform.startswith('darwin'): ctypes.POINTER(ctypes.c_uint8), CF_INDEX] else: @@ -21,11 +21,11 @@ index 905bce2..919fd4d 100644 def CFStr(s): -diff --git a/pyu2f/tests/hid/linux_test.py b/pyu2f/tests/hid/linux_test.py -index 1a299fa..610d200 100644 ---- a/pyu2f/tests/hid/linux_test.py -+++ b/pyu2f/tests/hid/linux_test.py -@@ -49,14 +49,14 @@ +Index: pyu2f-0.1.5a/pyu2f/tests/hid/linux_test.py +=================================================================== +--- pyu2f-0.1.5a.orig/pyu2f/tests/hid/linux_test.py ++++ pyu2f-0.1.5a/pyu2f/tests/hid/linux_test.py +@@ -49,14 +49,14 @@ KEYBOARD_RD = ( def AddDevice(fs, dev_name, product_name, vendor_id, product_id, report_descriptor_b64): @@ -44,7 +44,7 @@ index 1a299fa..610d200 100644 class FakeDeviceOsModule(object): -@@ -79,10 +79,10 @@ def read(self, unused_dev, unused_length): # pylint: disable=invalid-name +@@ -79,10 +79,10 @@ class FakeDeviceOsModule(object): class LinuxTest(unittest.TestCase): def setUp(self): self.fs = fake_filesystem.FakeFilesystem() diff --git a/python-pyu2f.changes b/python-pyu2f.changes index 703b376..ca271ec 100644 --- a/python-pyu2f.changes +++ b/python-pyu2f.changes @@ -1,3 +1,17 @@ +------------------------------------------------------------------- +Tue Oct 17 07:32:00 UTC 2023 - Daniel Garcia Moreno + +- Use upstream patches instead of custom one for python312 + compatibility. + - drop python312.patch + - add python312-1.patch gh#google/pyu2f@793acd9ff661 + - add python312-2.patch gh#google/pyu2f@dad654010a03 + +------------------------------------------------------------------- +Tue Oct 17 07:18:36 UTC 2023 - Daniel Garcia Moreno + +- Add python312.patch to fix tests in python3.12 + ------------------------------------------------------------------- Fri Apr 21 12:32:28 UTC 2023 - Dirk Müller diff --git a/python-pyu2f.spec b/python-pyu2f.spec index 3bca6aa..6ef18da 100644 --- a/python-pyu2f.spec +++ b/python-pyu2f.spec @@ -29,15 +29,17 @@ Source: https://github.com/google/pyu2f/archive/refs/tags/%{version}.tar Patch: fix-deprecation-warning.patch # https://github.com/google/pyu2f/issues/34 Patch1: python-pyu2f-no-six.patch +# PATCH-FIX-UPSTREAM python312-1.patch gh#google/pyu2f@793acd9ff661 +Patch2: python312-1.patch +# PATCH-FIX-UPSTREAM python312-2.patch gh#google/pyu2f@dad654010a03 +Patch3: python312-2.patch BuildRequires: %{python_module setuptools} BuildRequires: python-rpm-macros # SECTION test requirements -BuildRequires: %{python_module six} BuildRequires: %{python_module pyfakefs >= 2.4} BuildRequires: %{python_module pytest} # /SECTION BuildRequires: fdupes -Requires: python-six BuildArch: noarch %python_subpackages diff --git a/python312-1.patch b/python312-1.patch new file mode 100644 index 0000000..7360467 --- /dev/null +++ b/python312-1.patch @@ -0,0 +1,771 @@ +From dad654010a030f1038bd2df95a9647fb417e0447 Mon Sep 17 00:00:00 2001 +From: Felix Yan +Date: Mon, 2 Aug 2021 17:11:20 +0800 +Subject: [PATCH] Fix warnings about assertEquals + +Example: +``` +pyu2f/tests/hid/macos_test.py::MacOsTest::testInitHidDevice + /build/python-pyu2f/src/pyu2f-0.1.5/pyu2f/tests/hid/macos_test.py:61: DeprecationWarning: Please use assertEqual instead. + self.assertEquals(64, device.GetOutReportDataLength()) +``` +--- + pyu2f/tests/customauthenticator_test.py | 48 ++++++------ + pyu2f/tests/hardware_test.py | 56 ++++++------- + pyu2f/tests/hid/linux_test.py | 24 +++--- + pyu2f/tests/hid/macos_test.py | 18 ++--- + pyu2f/tests/hidtransport_test.py | 44 +++++------ + pyu2f/tests/localauthenticator_test.py | 34 ++++---- + pyu2f/tests/model_test.py | 16 ++-- + pyu2f/tests/u2f_test.py | 100 ++++++++++++------------ + pyu2f/tests/util_test.py | 12 +-- + 9 files changed, 176 insertions(+), 176 deletions(-) + +Index: pyu2f-0.1.5a/pyu2f/tests/customauthenticator_test.py +=================================================================== +--- pyu2f-0.1.5a.orig/pyu2f/tests/customauthenticator_test.py ++++ pyu2f-0.1.5a/pyu2f/tests/customauthenticator_test.py +@@ -122,44 +122,44 @@ class CustomAuthenticatorTest(unittest.T + + self.assertTrue(mock_communicate_method.called) + communicate_args = mock_communicate_method.call_args[0] +- self.assertEquals(len(communicate_args), 1, +- 'communicate() should have been called with two args') ++ self.assertEqual(len(communicate_args), 1, ++ 'communicate() should have been called with two args') + + communicate_stdin = communicate_args[0] + communicate_json_len_le = communicate_stdin[:4] + communicate_json_len = struct.unpack(' +Date: Fri, 15 Oct 2021 10:38:31 +0000 +Subject: [PATCH] Use assertRaisesRegex instead of assertRaisesRegexp for + Python 3.11 compatibility. + +--- + pyu2f/tests/hidtransport_test.py | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +Index: pyu2f-0.1.5a/pyu2f/tests/hidtransport_test.py +=================================================================== +--- pyu2f-0.1.5a.orig/pyu2f/tests/hidtransport_test.py ++++ pyu2f-0.1.5a/pyu2f/tests/hidtransport_test.py +@@ -128,8 +128,8 @@ class TransportTest(unittest.TestCase): + # the second will succeed on the second retry. + fake_hid_dev.SetChannelBusyCount(3) + with mock.patch.object(hidtransport, 'time') as _: +- self.assertRaisesRegexp(errors.HidError, '^Device Busy', t.SendMsgBytes, +- [0x00, 0x01, 0x00, 0x00]) ++ self.assertRaisesRegex(errors.HidError, '^Device Busy', t.SendMsgBytes, ++ [0x00, 0x01, 0x00, 0x00]) + + reply = t.SendMsgBytes([0x00, 0x01, 0x00, 0x00]) + self.assertEqual(reply, bytearray([0x01, 0x90, 0x00]))