From 2930db4892e06e97c441d68574bac0930175a16a Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Sat, 7 Oct 2023 12:00:31 +0900 Subject: [PATCH] Remove compatibility with Python < 3.8 ... because this library now supports only Python 3.8 or newer versions. Change-Id: Ibb48af4c501946b62a244994ecea5bfcd998810c --- oslo_config/generator.py | 9 ++------- oslo_config/validator.py | 10 ++-------- requirements.txt | 1 - 3 files changed, 4 insertions(+), 16 deletions(-) diff --git a/oslo_config/generator.py b/oslo_config/generator.py index 5dd10446..ea12a922 100644 --- a/oslo_config/generator.py +++ b/oslo_config/generator.py @@ -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) diff --git a/oslo_config/validator.py b/oslo_config/validator.py index 28bd544e..01725547 100644 --- a/oslo_config/validator.py +++ b/oslo_config/validator.py @@ -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) diff --git a/requirements.txt b/requirements.txt index 58bd439a..e226de8e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -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