Use ConfigParser instead of SafeConfigParser in Python 3
The SafeConfigParser class has been renamed to ConfigParser in Python 3.2 [1]. The alias SafeConfigParser maybe removed in future versions of Python 3. Use ConfigParser instead of SafeConfigParser in Python 3 [1] http://bugs.python.org/issue10627 Change-Id: I2fb67aa276f8895b9e16fea3440565218adbf426 Closes-Bug: #1618666
This commit is contained in:
parent
af90c22808
commit
2a16d1bdac
|
@ -21,7 +21,7 @@ import textwrap
|
|||
import getpass
|
||||
import shutil
|
||||
from subprocess import Popen, PIPE
|
||||
from six.moves.configparser import SafeConfigParser
|
||||
from six.moves import configparser
|
||||
|
||||
import cafe
|
||||
from cafe.engine.config import EngineConfig
|
||||
|
@ -479,7 +479,7 @@ class EngineConfigManager(object):
|
|||
|
||||
@staticmethod
|
||||
def read_config_file(path):
|
||||
config = SafeConfigParser()
|
||||
config = configparser.ConfigParser()
|
||||
cfp = open(path, 'r')
|
||||
config.readfp(cfp)
|
||||
cfp.close()
|
||||
|
@ -530,7 +530,7 @@ class EngineConfigManager(object):
|
|||
|
||||
@classmethod
|
||||
def generate_default_engine_config(cls):
|
||||
config = SafeConfigParser()
|
||||
config = configparser.ConfigParser()
|
||||
config.add_section('OPENCAFE_ENGINE')
|
||||
config.set(
|
||||
'OPENCAFE_ENGINE', 'config_directory',
|
||||
|
|
|
@ -323,7 +323,7 @@ class BrewFile(object):
|
|||
raise RunFileNotFoundError(msg)
|
||||
|
||||
# TODO: Add checks for duplicate sections among multiple files
|
||||
cfg = configparser.SafeConfigParser()
|
||||
cfg = configparser.ConfigParser()
|
||||
cfg.read(f)
|
||||
|
||||
# Check for incomplete sections, excluding reserved
|
||||
|
@ -342,6 +342,6 @@ class BrewFile(object):
|
|||
raise RunFileIncompleteBrewError(msg)
|
||||
|
||||
# config files are valid, return aggregate config parser object
|
||||
cfg = configparser.SafeConfigParser()
|
||||
cfg = configparser.ConfigParser()
|
||||
cfg.read(files)
|
||||
return cfg
|
||||
|
|
|
@ -68,6 +68,7 @@ def _get_path_from_env(os_env_var):
|
|||
" environment variable.".format(os_env_var))
|
||||
raise exception
|
||||
|
||||
|
||||
# Standard format to for flat key/value data sources
|
||||
CONFIG_KEY = 'CAFE_{section_name}_{key}'
|
||||
|
||||
|
@ -142,7 +143,7 @@ class ConfigParserDataSource(DataSource):
|
|||
cafe_env_var = {key: value for key, value in os.environ.iteritems()
|
||||
if key.startswith('CAFE_')}
|
||||
|
||||
self._data_source = configparser.SafeConfigParser(
|
||||
self._data_source = configparser.ConfigParser(
|
||||
defaults=cafe_env_var)
|
||||
self._section_name = section_name
|
||||
|
||||
|
|
Loading…
Reference in New Issue