Skip to content

Commit

Permalink
setuptools_scm.git: fix handling of dates in isoformat ending with Z
Browse files Browse the repository at this point in the history
  • Loading branch information
ap-- committed May 2, 2024
1 parent 9645373 commit 49a89c9
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/setuptools_scm/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import os
import re
import shlex
import sys
import warnings

from datetime import date
Expand Down Expand Up @@ -119,6 +120,8 @@ def parse_timestamp(timestamp_text: str) -> date | None:
if "%c" in timestamp_text:
log.warning("git too old -> timestamp is %r", timestamp_text)
return None
if sys.version_info < (3, 11) and timestamp_text.endswith("Z"):
timestamp_text = timestamp_text[:-1] + "+00:00"
return datetime.fromisoformat(timestamp_text).date()

res = run_git(
Expand Down

0 comments on commit 49a89c9

Please sign in to comment.