Skip to content

Commit

Permalink
Update timestamps each time a build is done.
Browse files Browse the repository at this point in the history
Closes #740.
  • Loading branch information
Mike Castle committed Oct 27, 2024
1 parent 98b0b77 commit d55d648
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
6 changes: 5 additions & 1 deletion build.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down
1 change: 1 addition & 0 deletions settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d55d648

Please sign in to comment.