diff options
-rw-r--r-- | libs/stevedore/_cache.py | 11 | ||||
-rw-r--r-- | libs/stevedore/tests/test_driver.py | 7 | ||||
-rw-r--r-- | libs/stevedore/tests/test_extension.py | 8 | ||||
-rw-r--r-- | libs/stevedore/tests/test_sphinxext.py | 7 | ||||
-rw-r--r-- | libs/version.txt | 2 |
5 files changed, 29 insertions, 6 deletions
diff --git a/libs/stevedore/_cache.py b/libs/stevedore/_cache.py index 6a76bc830..63f612900 100644 --- a/libs/stevedore/_cache.py +++ b/libs/stevedore/_cache.py @@ -15,7 +15,6 @@ import errno import glob import hashlib -import importlib.metadata as importlib_metadata import itertools import json import logging @@ -24,6 +23,13 @@ import os.path import struct import sys +try: + # For python 3.8 and later + import importlib.metadata as importlib_metadata +except ImportError: + # For everyone else + import importlib_metadata + log = logging.getLogger('stevedore._cache') @@ -104,7 +110,8 @@ def _build_cacheable_data(): # importlib-metadata 4.0 or later (or stdlib importlib.metadata in # Python 3.9 or later) real_groups = { - name: real_groups.select(name=name) for name in real_groups.names + group: real_groups.select(group=group) + for group in real_groups.groups } # Convert the namedtuple values to regular tuples diff --git a/libs/stevedore/tests/test_driver.py b/libs/stevedore/tests/test_driver.py index 622c1718e..92308359e 100644 --- a/libs/stevedore/tests/test_driver.py +++ b/libs/stevedore/tests/test_driver.py @@ -13,7 +13,12 @@ """Tests for stevedore.extension """ -import importlib.metadata as importlib_metadata +try: + # For python 3.8 and later + import importlib.metadata as importlib_metadata +except ImportError: + # For everyone else + import importlib_metadata from stevedore import driver from stevedore import exception diff --git a/libs/stevedore/tests/test_extension.py b/libs/stevedore/tests/test_extension.py index 7d6c6b8bd..405fb88b6 100644 --- a/libs/stevedore/tests/test_extension.py +++ b/libs/stevedore/tests/test_extension.py @@ -13,10 +13,16 @@ """Tests for stevedore.extension """ -import importlib.metadata as importlib_metadata import operator from unittest import mock +try: + # For python 3.8 and later + import importlib.metadata as importlib_metadata +except ImportError: + # For everyone else + import importlib_metadata + from stevedore import exception from stevedore import extension from stevedore.tests import utils diff --git a/libs/stevedore/tests/test_sphinxext.py b/libs/stevedore/tests/test_sphinxext.py index 2315c4eb9..e90bd679d 100644 --- a/libs/stevedore/tests/test_sphinxext.py +++ b/libs/stevedore/tests/test_sphinxext.py @@ -12,7 +12,12 @@ """Tests for the sphinx extension """ -import importlib.metadata as importlib_metadata +try: + # For python 3.8 and later + import importlib.metadata as importlib_metadata +except ImportError: + # For everyone else + import importlib_metadata from stevedore import extension from stevedore import sphinxext diff --git a/libs/version.txt b/libs/version.txt index a66a9ed14..54977eaaa 100644 --- a/libs/version.txt +++ b/libs/version.txt @@ -103,7 +103,7 @@ babelfish==0.6.0 beautifulsoup4==4.11.1 chardet==5.0.0 pysrt==1.1.2 -stevedore==4.1.0 +#stevedore==3.5.2 # Do not upgrade. Version newer than that have issues with importlib on Python 3.7 # Required-by: subliminal_patch cloudscraper==1.2.58 |