Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: Help older Python parse new Git dates #3721

Merged
merged 1 commit into from
May 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions utils/mkhtml.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,9 +342,18 @@ def format_git_commit_date_from_local_git(

:return str: output formatted commit datetime
"""
return datetime.fromisoformat(
commit_datetime,
).strftime(datetime_format)
try:
date = datetime.fromisoformat(
commit_datetime,
)
except ValueError:
if commit_datetime.endswith("Z"):
# Python 3.10 and older does not support Z in time, while recent versions
# of Git (2.45.1) use it. Try to help the parsing if Z is in the string.
date = datetime.fromisoformat(commit_datetime[:-1] + "+00:00")
else:
raise
return date.strftime(datetime_format)


def has_src_code_git(src_dir, is_addon):
Expand Down
Loading