From f925f9550be75e14564080dde711ffce6876d5dd Mon Sep 17 00:00:00 2001 From: wu-leilei Date: Wed, 8 Dec 2021 11:38:56 +0800 Subject: [PATCH] int_from_bytes is deprecated, use int.from_bytes instead --- 0001-fix-int_from_bytes-is-deprecated.patch | 56 +++++++++++++++++++++ python-SecretStorage.spec | 6 ++- 2 files changed, 61 insertions(+), 1 deletion(-) create mode 100644 0001-fix-int_from_bytes-is-deprecated.patch diff --git a/0001-fix-int_from_bytes-is-deprecated.patch b/0001-fix-int_from_bytes-is-deprecated.patch new file mode 100644 index 0000000..2cf2d16 --- /dev/null +++ b/0001-fix-int_from_bytes-is-deprecated.patch @@ -0,0 +1,56 @@ +From b53448bb9ad17f8eadb47be3b5a8fb40492a1cb0 Mon Sep 17 00:00:00 2001 +From: wu-leilei +Date: Wed, 8 Dec 2021 10:15:44 +0800 +Subject: [PATCH] fix int_from_bytes is deprecated + +--- + secretstorage/dhcrypto.py | 6 +++++- + secretstorage/util.py | 6 +++++- + 2 files changed, 10 insertions(+), 2 deletions(-) + +diff --git a/secretstorage/dhcrypto.py b/secretstorage/dhcrypto.py +index 90de2d8..4e4e9f0 100644 +--- a/secretstorage/dhcrypto.py ++++ b/secretstorage/dhcrypto.py +@@ -10,9 +10,13 @@ algorithm.''' + import hmac + import math + import os ++import sys + + from hashlib import sha256 +-from cryptography.utils import int_from_bytes ++if sys.version_info.major == 2: ++ from cryptography.utils import int_from_bytes ++else: ++ int_from_bytes = int.from_bytes + + # A standard 1024 bits (128 bytes) prime number for use in Diffie-Hellman exchange + DH_PRIME_1024_BYTES = ( +diff --git a/secretstorage/util.py b/secretstorage/util.py +index 44db909..546cb91 100644 +--- a/secretstorage/util.py ++++ b/secretstorage/util.py +@@ -8,6 +8,7 @@ normally be used by external applications.""" + + import dbus + import os ++import sys + from secretstorage.defines import DBUS_UNKNOWN_METHOD, DBUS_NO_SUCH_OBJECT, \ + DBUS_SERVICE_UNKNOWN, DBUS_NO_REPLY, DBUS_NOT_SUPPORTED, DBUS_EXEC_FAILED, \ + SS_PATH, SS_PREFIX, ALGORITHM_DH, ALGORITHM_PLAIN +@@ -16,7 +17,10 @@ from secretstorage.exceptions import ItemNotFoundException, \ + SecretServiceNotAvailableException + from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes + from cryptography.hazmat.backends import default_backend +-from cryptography.utils import int_from_bytes ++if sys.version_info.major == 2: ++ from cryptography.utils import int_from_bytes ++else: ++ int_from_bytes = int.from_bytes + + BUS_NAME = 'org.freedesktop.secrets' + SERVICE_IFACE = SS_PREFIX + 'Service' +-- +2.23.0 + diff --git a/python-SecretStorage.spec b/python-SecretStorage.spec index c4f3278..92a30c7 100644 --- a/python-SecretStorage.spec +++ b/python-SecretStorage.spec @@ -9,11 +9,12 @@ editing items, locking and unlocking collections (also support asynchronous unlo Name: python-SecretStorage Version: 2.3.1 -Release: 11 +Release: 12 Summary: Python bindings to FreeDesktop.org Secret Service API License: BSD URL: http://launchpad.net/python-secretstorage Source0: https://files.pythonhosted.org/packages/source/S/SecretStorage/SecretStorage-%{version}.tar.gz +Patch0: 0001-fix-int_from_bytes-is-deprecated.patch BuildArch: noarch BuildRequires: python2-nose python2-devel python2-sphinx gnome-keyring python2-cryptography @@ -100,6 +101,9 @@ PYTHONPATH=%{buildroot}%{python3_sitelib} xvfb-run -a %{__python3} -m unittest d %doc build/sphinx/html/* %changelog +* Wed Dec 09 2021 wulei - 2.3.1-12 +- int_from_bytes is deprecated, use int.from_bytes instead + * Mon Nov 25 2019 lihao - 2.3.1-11 - Package Init -- Gitee