diff --git a/fix-deprecation-warning.patch b/fix-deprecation-warning.patch new file mode 100644 index 0000000..9526b95 --- /dev/null +++ b/fix-deprecation-warning.patch @@ -0,0 +1,59 @@ +From 5e2f862dd5ba61eadff341dbf0a1202e91b1b145 Mon Sep 17 00:00:00 2001 +From: Cary Zhao +Date: Mon, 22 Nov 2021 10:42:06 -0800 +Subject: [PATCH] fix DeprecationWarning for logging and fake_filesystem + +--- + pyu2f/hid/macos.py | 2 +- + 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): + ctypes.POINTER(ctypes.c_uint8), + CF_INDEX] + else: +- logger.warn('Not running on MacOS') ++ logger.warning('Not running on MacOS') + + + 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 @@ + + def AddDevice(fs, dev_name, product_name, + vendor_id, product_id, report_descriptor_b64): +- uevent = fs.CreateFile('/sys/class/hidraw/%s/device/uevent' % dev_name) +- rd = fs.CreateFile('/sys/class/hidraw/%s/device/report_descriptor' % dev_name) ++ uevent = fs.create_file('/sys/class/hidraw/%s/device/uevent' % dev_name) ++ rd = fs.create_file('/sys/class/hidraw/%s/device/report_descriptor' % dev_name) + report_descriptor = base64.b64decode(report_descriptor_b64) +- rd.SetContents(report_descriptor) ++ rd.set_contents(report_descriptor) + + buf = 'HID_NAME=%s\n' % product_name.encode('utf8') + buf += 'HID_ID=0001:%08X:%08X\n' % (vendor_id, product_id) +- uevent.SetContents(buf) ++ uevent.set_contents(buf) + + + class FakeDeviceOsModule(object): +@@ -79,10 +79,10 @@ def read(self, unused_dev, unused_length): # pylint: disable=invalid-name + class LinuxTest(unittest.TestCase): + def setUp(self): + self.fs = fake_filesystem.FakeFilesystem() +- self.fs.CreateDirectory('/sys/class/hidraw') ++ self.fs.create_dir('/sys/class/hidraw') + + def tearDown(self): +- self.fs.RemoveObject('/sys/class/hidraw') ++ self.fs.remove_object('/sys/class/hidraw') + + def testCallEnumerate(self): + AddDevice(self.fs, 'hidraw1', 'Logitech USB Keyboard', diff --git a/python-pyu2f.changes b/python-pyu2f.changes index e59de58..45b40d5 100644 --- a/python-pyu2f.changes +++ b/python-pyu2f.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Tue Nov 1 09:26:18 UTC 2022 - Markéta Machová + +- Add upstream fix-deprecation-warning.patch to fix compatibility + ------------------------------------------------------------------- Tue Apr 12 08:56:31 UTC 2022 - Markéta Machová diff --git a/python-pyu2f.spec b/python-pyu2f.spec index a392640..4ba9dff 100644 --- a/python-pyu2f.spec +++ b/python-pyu2f.spec @@ -24,6 +24,8 @@ Summary: U2F host library for interacting with a U2F device over USB License: Apache-2.0 URL: https://github.com/google/pyu2f/ Source: https://github.com/google/pyu2f/archive/refs/tags/%{version}.tar.gz#/pyu2f-%{version}.tar.gz +# PATCH-FIX-UPSTREAM https://github.com/google/pyu2f/pull/32 fix DeprecationWarning for logging and fake_filesystem +Patch: fix-deprecation-warning.patch BuildRequires: %{python_module setuptools} BuildRequires: python-rpm-macros # SECTION test requirements @@ -40,7 +42,7 @@ BuildArch: noarch U2F host library for interacting with a U2F device over USB. %prep -%setup -q -n pyu2f-%{version} +%autosetup -p1 -n pyu2f-%{version} sed -i 's/import mock/from unittest import mock/' pyu2f/tests/*_test.py pyu2f/tests/hid/*_test.py %build