Skip to content

Commit

Permalink
Versioned file for kicad variables
Browse files Browse the repository at this point in the history
  • Loading branch information
scottbez1 committed Mar 9, 2024
1 parent cb9bbe5 commit 6f066b8
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions electronics/scripts/export_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,19 @@ def recorded_xvfb(video_filename, **xvfb_args):
def get_versioned_contents(filename):
with open(filename, 'r') as f:
original_contents = f.read()
date = rev_info.current_date()
date = rev_info.git_date()
date_long = rev_info.git_date(short=False)
rev = rev_info.git_short_rev()
logger.info('Replacing placeholders with %s and %s' % (date, rev))
return original_contents, original_contents \
.replace('Date ""', 'Date "%s"' % date) \
.replace('Date ""', 'Date "%s"' % date_long) \
.replace('DATE: YYYY-MM-DD HH:MM:SS TZ', 'DATE: %s' % date_long) \
.replace('${COMMIT_DATE_LONG}', date_long) \
.replace('DATE: YYYY-MM-DD', 'DATE: %s' % date) \
.replace('${COMMIT_DATE}', date) \
.replace('Rev ""', 'Rev "%s"' % rev) \
.replace('COMMIT: deadbeef', 'COMMIT: %s' % rev)
.replace('COMMIT: deadbeef', 'COMMIT: %s' % rev) \
.replace('${COMMIT_HASH}', rev) \


@contextmanager
Expand Down

0 comments on commit 6f066b8

Please sign in to comment.