git: fixed py3 compat for submodule read.
This commit is contained in:
parent
7541caf065
commit
337400c423
1 changed files with 6 additions and 5 deletions
|
|
@ -466,13 +466,14 @@ class GitCommit(base.BaseCommit):
|
|||
except NodeDoesNotExistError:
|
||||
return None
|
||||
|
||||
content = submodules_node.content
|
||||
|
||||
# ConfigParser fails if there are whitespaces
|
||||
content = '\n'.join(l.strip() for l in content.split('\n'))
|
||||
# ConfigParser fails if there are whitespaces, also it needs an iterable
|
||||
# file like content
|
||||
def iter_content(_content):
|
||||
for line in _content.splitlines():
|
||||
yield line
|
||||
|
||||
parser = configparser.ConfigParser()
|
||||
parser.readfp(StringIO(content))
|
||||
parser.read_file(iter_content(submodules_node.content))
|
||||
|
||||
for section in parser.sections():
|
||||
path = parser.get(section, 'path')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue