Skip to content

Commit

Permalink
Merge pull request #81 from packit/changelog-timestamps
Browse files Browse the repository at this point in the history
Accept any number of whitespaces when parsing %changelog entry timestamp

Fixes #80.

Reviewed-by: None <None>
  • Loading branch information
softwarefactory-project-zuul[bot] authored Aug 10, 2022
2 parents b39a2ee + bda8de3 commit a5e6fdf
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
12 changes: 9 additions & 3 deletions specfile/changelog.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,17 @@ def __repr__(self) -> str:
def extended_timestamp(self) -> bool:
"""Whether the timestamp present in the entry header is extended (date and time)."""
try:
arrow.get(self.header, ["ddd MMM D YYYY", "ddd MMM DD YYYY"])
arrow.get(
self.header,
[
r"ddd[\s+]MMM[\s+]D[\s+]HH:mm:ss[\s+][\w+][\s+]YYYY",
r"ddd[\s+]MMM[\s+]DD[\s+]HH:mm:ss[\s+][\w+][\s+]YYYY",
],
)
except arrow.parser.ParserError:
return True
else:
return False
else:
return True

@staticmethod
def assemble(
Expand Down
1 change: 1 addition & 0 deletions tests/unit/test_changelog.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"header, extended",
[
("* Tue May 4 2021 Nikola Forró <[email protected]> - 0.1-1", False),
("* Tue May 4 2021 Nikola Forró <[email protected]> - 0.1-1", False),
(
"* Thu Jul 22 2021 Fedora Release Engineering <[email protected]> - 0.1-2",
False,
Expand Down

0 comments on commit a5e6fdf

Please sign in to comment.