mirror of
https://github.com/openSUSE/osc.git
synced 2025-01-27 07:06:13 +01:00
compact empty lines
This commit is contained in:
parent
da0ccd5d8c
commit
4187a18de7
@ -317,15 +317,20 @@ class OscConfigParser(ConfigParser.SafeConfigParser):
|
|||||||
# XXX: simplify!
|
# XXX: simplify!
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
ret = []
|
ret = []
|
||||||
|
first = True
|
||||||
for line in self._sections._lines:
|
for line in self._sections._lines:
|
||||||
if line.type == 'section':
|
if line.type == 'section':
|
||||||
|
if first:
|
||||||
|
first = False
|
||||||
|
else:
|
||||||
|
ret.append('')
|
||||||
ret.append('[%s]' % line.name)
|
ret.append('[%s]' % line.name)
|
||||||
for sline in line._lines:
|
for sline in line._lines:
|
||||||
if sline.name == '__name__':
|
if sline.name == '__name__':
|
||||||
continue
|
continue
|
||||||
if sline.type == 'option':
|
if sline.type == 'option':
|
||||||
ret.append(sline.frmt % (sline.name, sline.value))
|
ret.append(sline.frmt % (sline.name, sline.value))
|
||||||
else:
|
elif str(sline) != '':
|
||||||
ret.append(str(sline))
|
ret.append(str(sline))
|
||||||
else:
|
else:
|
||||||
ret.append(str(line))
|
ret.append(str(line))
|
||||||
|
Loading…
Reference in New Issue
Block a user