Merge "Replace deprecated readfp method with read_file"
This commit is contained in:
commit
cb2c15ea2b
|
@ -27,12 +27,13 @@ from pbr import util
|
|||
|
||||
def config_from_ini(ini):
|
||||
config = {}
|
||||
ini = textwrap.dedent(six.u(ini))
|
||||
if sys.version_info >= (3, 2):
|
||||
parser = configparser.ConfigParser()
|
||||
parser.read_file(io.StringIO(ini))
|
||||
else:
|
||||
parser = configparser.SafeConfigParser()
|
||||
ini = textwrap.dedent(six.u(ini))
|
||||
parser.readfp(io.StringIO(ini))
|
||||
parser.readfp(io.StringIO(ini))
|
||||
for section in parser.sections():
|
||||
config[section] = dict(parser.items(section))
|
||||
return config
|
||||
|
|
Loading…
Reference in New Issue