From 49a89c9181f92c9e436b7b45a6388a536acac026 Mon Sep 17 00:00:00 2001 From: Andreas Poehlmann Date: Thu, 2 May 2024 11:37:16 +0200 Subject: [PATCH] setuptools_scm.git: fix handling of dates in isoformat ending with Z --- src/setuptools_scm/git.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/setuptools_scm/git.py b/src/setuptools_scm/git.py index 8f5c77e2..eb1d519a 100644 --- a/src/setuptools_scm/git.py +++ b/src/setuptools_scm/git.py @@ -5,6 +5,7 @@ import os import re import shlex +import sys import warnings from datetime import date @@ -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(