import codecs
import shutil
from collections import namedtuple
-from configparser import SafeConfigParser, \
+from configparser import ConfigParser, \
MissingSectionHeaderError, Error
from gitbuildsys import errors
return base64.b64encode(codecs.encode(passwd.encode(), 'bz2')).decode()
-class BrainConfigParser(SafeConfigParser):
+class BrainConfigParser(ConfigParser):
"""Standard ConfigParser derived class which can reserve most of the
comments, indents, and other user customized stuff inside the ini file.
"""
def read_one(self, filename):
"""only support one input file"""
- return SafeConfigParser.read(self, filename)
+ return ConfigParser.read(self, filename)
def _read(self, fptr, fname):
"""Parse a sectioned setup file.
self._flines = fptr.readlines()
fptr.seek(0)
- return SafeConfigParser._read(self, fptr, fname)
+ return ConfigParser._read(self, fptr, fname)
def _set_into_file(self, section, option, value, replace_opt=None):
"""Set the value in the file contents
"""
if not self.has_section(section):
self.add_section(section)
- SafeConfigParser.set(self, section, option, value)
+ ConfigParser.set(self, section, option, value)
if replace_opt:
- SafeConfigParser.remove_option(self, section, replace_opt)
+ ConfigParser.remove_option(self, section, replace_opt)
# If the code reach here, it means the section and key are ok
try:
self._cfgparsers = []
for fpath in self._cfgfiles:
- cfgparser = BrainConfigParser()
+ cfgparser = BrainConfigParser(strict=False)
try:
cfgparser.read_one(fpath)
if cfgparser.has_section('general') and \
return profile
-class MappingConfigParser(SafeConfigParser):
+class MappingConfigParser(ConfigParser):
def __init__(self, file, defaults=None):
- SafeConfigParser.__init__(self, defaults=None)
+ ConfigParser.__init__(self, defaults=None)
self._obs_meta = {}
self._prefix_meta = {}
self._repo_meta = {}