diff options
author | Alfredo Moralejo <amoralej@redhat.com> | 2021-09-30 09:39:36 +0200 |
---|---|---|
committer | Alfredo Moralejo <amoralej@redhat.com> | 2021-10-11 09:48:54 +0200 |
commit | e1392feda59ed0fdcf10934d57f833c64e99c19a (patch) | |
tree | 1d282ecda9fc520ca673c9764ae8908789f3af76 /src/saml2/sigver.py | |
parent | f12ade09aa89211c42b7dc6ed94728f8aa69cffb (diff) | |
download | pysaml2-e1392feda59ed0fdcf10934d57f833c64e99c19a.tar.gz |
Use importlib.resources in python >= 3.7
importlib.resources was added to python standard library since python 3.7
[1]. This patch is implementing conditional to use it instead of the
importlib_resources backport when using python 3.7 or newer.
[1] https://docs.python.org/3/whatsnew/3.7.html
Diffstat (limited to 'src/saml2/sigver.py')
-rw-r--r-- | src/saml2/sigver.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/saml2/sigver.py b/src/saml2/sigver.py index 973d6245..c9c66b13 100644 --- a/src/saml2/sigver.py +++ b/src/saml2/sigver.py @@ -9,12 +9,12 @@ import logging import os import re import six +import sys from uuid import uuid4 as gen_random_key from time import mktime from tempfile import NamedTemporaryFile from subprocess import Popen from subprocess import PIPE -from importlib_resources import path as _resource_path from OpenSSL import crypto @@ -59,6 +59,11 @@ from saml2.xmlenc import EncryptedData from saml2.xml.schema import node_to_schema from saml2.xml.schema import XMLSchemaError +# importlib.resources was introduced in python 3.7 +if sys.version_info[:2] >= (3, 7): + from importlib.resources import path as _resource_path +else: + from importlib_resources import path as _resource_path logger = logging.getLogger(__name__) |