From d4830f40f0fab7b2f8d36cb0d066b56267f6c7d5 Mon Sep 17 00:00:00 2001 From: rdb Date: Wed, 24 Feb 2021 15:51:14 +0100 Subject: [PATCH] makepanda: Fix strftime error using SOURCE_DATE_EPOCH on Windows Seems to occur when using Python 2.7 --- makepanda/makepanda.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/makepanda/makepanda.py b/makepanda/makepanda.py index 9c57b37129..14dbcbaa2d 100755 --- a/makepanda/makepanda.py +++ b/makepanda/makepanda.py @@ -3006,7 +3006,12 @@ def CreatePandaVersionFiles(): if source_date: # This matches the GCC / Clang format for __DATE__ __TIME__ source_date = time.gmtime(int(source_date)) - source_date = time.strftime('%b %e %Y %H:%M:%S', source_date) + try: + source_date = time.strftime('%b %e %Y %H:%M:%S', source_date) + except ValueError: + source_date = time.strftime('%b %d %Y %H:%M:%S', source_date) + if source_date[3:5] == ' 0': + source_date = source_date[:3] + ' ' + source_date[5:] pandaversion_h += "\n#define PANDA_BUILD_DATE_STR \"%s\"\n" % (source_date) if not RUNTIME: