From d55d6480b03ca0914fe926bdc71639b7b545807a Mon Sep 17 00:00:00 2001 From: Mike Castle Date: Sun, 27 Oct 2024 11:34:35 -0700 Subject: [PATCH] Update timestamps each time a build is done. Closes #740. --- build.py | 6 +++++- settings.py | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/build.py b/build.py index a02d77a69..131f62b85 100755 --- a/build.py +++ b/build.py @@ -118,7 +118,7 @@ def watch(build_cb, *args, interval=1, **kwargs): Every found dependancy (to be watched for changes) build_cb must append to deps_list, which is passed to it as additional keyword argument. """ - from time import ctime, sleep, time + from time import ctime, gmtime, sleep, strftime, time from traceback import print_exc basetime = None @@ -134,6 +134,10 @@ def watch(build_cb, *args, interval=1, **kwargs): else: continue basetime = time() + utc = gmtime(basetime) + # Keep formatting in sync with settings.load() + settings.build_date = strftime('%Y-%m-%d-%H%M%S', utc) + settings.build_timestamp = strftime('%Y%m%d.%H%M%S', utc) print('\nrebuild started [{}]'.format(ctime(basetime))) watch_list = [] try: diff --git a/settings.py b/settings.py index 841d5e523..25a9f42a6 100755 --- a/settings.py +++ b/settings.py @@ -40,6 +40,7 @@ def load(build_name, localfile=None): mod.pop('load') mod['build_name'] = build_name utc = time.gmtime() + # Keep formatting in sync with build.watch() mod['build_date'] = time.strftime('%Y-%m-%d-%H%M%S', utc) mod['build_timestamp'] = time.strftime('%Y%m%d.%H%M%S', utc) base = Path(localfile or __file__).parent