Remove compatibility with Python < 3.8

... because this library now supports only Python 3.8 or newer
versions.

Change-Id: Ibb48af4c501946b62a244994ecea5bfcd998810c
This commit is contained in:
Takashi Kajinami 2023-10-07 12:00:31 +09:00
parent bfc32d5ad8
commit 2930db4892
3 changed files with 4 additions and 16 deletions

View File

@ -25,6 +25,7 @@ Tool for generating a sample configuration file. See
import collections
import copy
import importlib.metadata
import json
import logging
import operator
@ -42,12 +43,6 @@ except ImportError:
rst2txt = None
try:
# For Python 3.8 and later
import importlib.metadata as importlib_metadata
except ImportError:
# For everyone else
import importlib_metadata
import yaml
@ -822,7 +817,7 @@ def generate(conf, output_file=None):
def main(args=None):
"""The main function of oslo-config-generator."""
version = importlib_metadata.version('oslo.config')
version = importlib.metadata.version('oslo.config')
logging.basicConfig(level=logging.WARN)
conf = cfg.ConfigOpts()
register_cli_opts(conf)

View File

@ -21,17 +21,11 @@ the provided file. If there are any options set that are not defined in the
project then it returns those errors.
"""
import importlib.metadata
import logging
import re
import sys
try:
# For Python 3.8 and later
import importlib.metadata as importlib_metadata
except ImportError:
# For everyone else
import importlib_metadata
import yaml
from oslo_config import cfg
@ -224,7 +218,7 @@ def _validate(conf):
def main():
"""The main function of oslo-config-validator."""
version = importlib_metadata.version('oslo.config')
version = importlib.metadata.version('oslo.config')
logging.basicConfig(level=logging.INFO)
conf = cfg.ConfigOpts()
_register_cli_opts(conf)

View File

@ -9,4 +9,3 @@ oslo.i18n>=3.15.3 # Apache-2.0
rfc3986>=1.2.0 # Apache-2.0
PyYAML>=5.1 # MIT
requests>=2.18.0 # Apache-2.0
importlib_metadata>=1.7.0;python_version<'3.8' # Apache-2.0