Skip to content

Commit a5e6fdf

Browse files
Merge pull request #81 from packit/changelog-timestamps
Accept any number of whitespaces when parsing %changelog entry timestamp Fixes #80. Reviewed-by: None <None>
2 parents b39a2ee + bda8de3 commit a5e6fdf

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

specfile/changelog.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,17 @@ def __repr__(self) -> str:
5555
def extended_timestamp(self) -> bool:
5656
"""Whether the timestamp present in the entry header is extended (date and time)."""
5757
try:
58-
arrow.get(self.header, ["ddd MMM D YYYY", "ddd MMM DD YYYY"])
58+
arrow.get(
59+
self.header,
60+
[
61+
r"ddd[\s+]MMM[\s+]D[\s+]HH:mm:ss[\s+][\w+][\s+]YYYY",
62+
r"ddd[\s+]MMM[\s+]DD[\s+]HH:mm:ss[\s+][\w+][\s+]YYYY",
63+
],
64+
)
5965
except arrow.parser.ParserError:
60-
return True
61-
else:
6266
return False
67+
else:
68+
return True
6369

6470
@staticmethod
6571
def assemble(

tests/unit/test_changelog.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"header, extended",
1515
[
1616
("* Tue May 4 2021 Nikola Forró <[email protected]> - 0.1-1", False),
17+
("* Tue May 4 2021 Nikola Forró <[email protected]> - 0.1-1", False),
1718
(
1819
"* Thu Jul 22 2021 Fedora Release Engineering <[email protected]> - 0.1-2",
1920
False,

0 commit comments

Comments
 (0)