Skip to content

Commit 49a89c9

Browse files
committed
setuptools_scm.git: fix handling of dates in isoformat ending with Z
1 parent 9645373 commit 49a89c9

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/setuptools_scm/git.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import os
66
import re
77
import shlex
8+
import sys
89
import warnings
910

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

124127
res = run_git(

0 commit comments

Comments
 (0)