-
Notifications
You must be signed in to change notification settings - Fork 86
/
Copy pathcompatability.py
30 lines (26 loc) · 1.28 KB
/
compatability.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
"""Contains logic for checking ESDK and Python Version"""
import sys
import warnings
DEPRECATION_DATE_MAP = {"1.x": "2022-06-30", "2.x": "2022-07-01"}
def _warn_deprecated_python():
"""Template for deprecation of Python warning."""
deprecated_versions = {
(2, 7): {"date": DEPRECATION_DATE_MAP["2.x"]},
(3, 4): {"date": DEPRECATION_DATE_MAP["2.x"]},
(3, 5): {"date": "2021-11-10"},
(3, 7): {"date": "2024-03-04"},
}
py_version = (sys.version_info.major, sys.version_info.minor)
minimum_version = (3, 8)
if py_version in deprecated_versions:
params = deprecated_versions[py_version]
warning = (
"aws-encryption-sdk will no longer support Python {}.{} "
"starting {}. To continue receiving service updates, "
"bug fixes, and security updates please upgrade to Python {}.{} or "
"later. For more information, see SUPPORT_POLICY.rst: "
"https://github.com/aws/aws-encryption-sdk-python/blob/master/SUPPORT_POLICY.rst"
).format(py_version[0], py_version[1], params["date"], minimum_version[0], minimum_version[1])
warnings.warn(warning, DeprecationWarning)