!6 修改“不建议使用int_from_bytes,改用int.from_bytes”提示的问题
From: @wu-leilei Reviewed-by: @small_leek Signed-off-by: @small_leek
This commit is contained in:
commit
8691d65109
56
0001-fix-int_from_bytes-is-deprecated.patch
Normal file
56
0001-fix-int_from_bytes-is-deprecated.patch
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
From b53448bb9ad17f8eadb47be3b5a8fb40492a1cb0 Mon Sep 17 00:00:00 2001
|
||||||
|
From: wu-leilei <wu18740459704@163.com>
|
||||||
|
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
|
||||||
|
|
||||||
@ -9,11 +9,12 @@ editing items, locking and unlocking collections (also support asynchronous unlo
|
|||||||
|
|
||||||
Name: python-SecretStorage
|
Name: python-SecretStorage
|
||||||
Version: 2.3.1
|
Version: 2.3.1
|
||||||
Release: 11
|
Release: 12
|
||||||
Summary: Python bindings to FreeDesktop.org Secret Service API
|
Summary: Python bindings to FreeDesktop.org Secret Service API
|
||||||
License: BSD
|
License: BSD
|
||||||
URL: http://launchpad.net/python-secretstorage
|
URL: http://launchpad.net/python-secretstorage
|
||||||
Source0: https://files.pythonhosted.org/packages/source/S/SecretStorage/SecretStorage-%{version}.tar.gz
|
Source0: https://files.pythonhosted.org/packages/source/S/SecretStorage/SecretStorage-%{version}.tar.gz
|
||||||
|
Patch0: 0001-fix-int_from_bytes-is-deprecated.patch
|
||||||
BuildArch: noarch
|
BuildArch: noarch
|
||||||
|
|
||||||
BuildRequires: python2-nose python2-devel python2-sphinx gnome-keyring python2-cryptography
|
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/*
|
%doc build/sphinx/html/*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Wed Dec 09 2021 wulei <wulei80@huawei.com> - 2.3.1-12
|
||||||
|
- int_from_bytes is deprecated, use int.from_bytes instead
|
||||||
|
|
||||||
* Mon Nov 25 2019 lihao <lihao129@huawei.com> - 2.3.1-11
|
* Mon Nov 25 2019 lihao <lihao129@huawei.com> - 2.3.1-11
|
||||||
- Package Init
|
- Package Init
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user