Skip to content

Commit a6c3631

Browse files
authored
[PCS Client Tool] Migrate from deprecated pkg_resources to packaging (#485)
* [PCS Client Tool] Migrate from deprecated pkg_resources to packaging Version 14.0 is the first version that had the Version class. Ref: https://setuptools.pypa.io/en/latest/pkg_resources.html * [PCS Client Tool] Avoid needless indirection when contracting Version objects --------- Signed-off-by: Miro Hrončok <miro@hroncok.cz>
1 parent 717f2a9 commit a6c3631

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

tools/PcsClientTool/lib/intelsgx/pcs.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from lib.intelsgx.credential import Credentials
1111
from requests.adapters import HTTPAdapter
1212
from urllib3.util import Retry
13-
from pkg_resources import parse_version
13+
from packaging.version import Version
1414

1515
certBegin= '-----BEGIN CERTIFICATE-----'
1616
certEnd= '-----END CERTIFICATE-----'
@@ -58,7 +58,7 @@ def _get_request(self, url, needKey):
5858

5959
PARAMS = {}
6060
https = requests.Session()
61-
if parse_version(urllib3.__version__) < parse_version('1.26.0'):
61+
if Version(urllib3.__version__) < Version('1.26.0'):
6262
https.mount("https://", HTTPAdapter(max_retries=Retry(method_whitelist=["HEAD", "GET", "PUT", "POST", "DELETE", "OPTIONS", "TRACE"])))
6363
else:
6464
https.mount("https://", HTTPAdapter(max_retries=Retry(allowed_methods=["HEAD", "GET", "PUT", "POST", "DELETE", "OPTIONS", "TRACE"])))
@@ -76,7 +76,7 @@ def _post_request(self, url, data, needKey):
7676

7777
PARAMS = {}
7878
https = requests.Session()
79-
if parse_version(urllib3.__version__) < parse_version('1.26.0'):
79+
if Version(urllib3.__version__) < Version('1.26.0'):
8080
https.mount("https://", HTTPAdapter(max_retries=Retry(method_whitelist=["HEAD", "GET", "PUT", "POST", "DELETE", "OPTIONS", "TRACE"])))
8181
else:
8282
https.mount("https://", HTTPAdapter(max_retries=Retry(allowed_methods=["HEAD", "GET", "PUT", "POST", "DELETE", "OPTIONS", "TRACE"])))
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
asn1>=2.4.1
22
cryptography>=41.0.7,<44
33
keyring>=23.0.0
4+
packaging>=14.0
45
pyOpenSSL>=23.2.0,<24.3.0
56
pypac>=0.14.0
67
Requests>=2.31.0
7-
setuptools>=65.5.1,<81
88
urllib3>=1.26.18

0 commit comments

Comments
 (0)