Skip to content

Commit

Permalink
Adjust extract_section_content_from_text for dnf5
Browse files Browse the repository at this point in the history
  • Loading branch information
glum23 committed Oct 24, 2023
1 parent 94ee514 commit 3924d4b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions dnf-behave-tests/dnf/steps/cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,14 @@ def extract_section_content_from_text(section_header, text):
parsed = ''
copy = False
for line in text.split('\n'):
if (not copy) and section_header == line:
strippedline = line.strip()
# in dnf5 there can be spaces after some section headers
# (e.g. 'Installing:', 'Upgrading:' etc.)
if (not copy) and section_header == strippedline:
copy = True
continue
if copy: # copy lines until hitting empty line or another known header
if line.strip() and line not in SECTION_HEADERS:
if strippedline and strippedline not in SECTION_HEADERS:
parsed += "%s\n" % line
else:
return parsed
Expand Down

0 comments on commit 3924d4b

Please sign in to comment.