From 2bcd88d55645f2ea702ff70336b33be4661c97a8 Mon Sep 17 00:00:00 2001 From: David Grayson Date: Wed, 22 Feb 2023 13:26:02 -0800 Subject: py/makeversionhdr.py: Optionally get git tag and git hash from env vars. This is handy when you are doing builds outside of the Git repository but still want to record that information. Signed-off-by: David Grayson --- py/makeversionhdr.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'py/makeversionhdr.py') diff --git a/py/makeversionhdr.py b/py/makeversionhdr.py index 5766330989..58c4421c59 100644 --- a/py/makeversionhdr.py +++ b/py/makeversionhdr.py @@ -86,8 +86,11 @@ def get_version_info_from_mpconfig(repo_path): def make_version_header(repo_path, filename): - # Get version info using git, with fallback to py/mpconfig.h - info = get_version_info_from_git(repo_path) + info = None + if "MICROPY_GIT_TAG" in os.environ: + info = [os.environ["MICROPY_GIT_TAG"], os.environ["MICROPY_GIT_HASH"]] + if info is None: + info = get_version_info_from_git(repo_path) if info is None: info = get_version_info_from_mpconfig(repo_path) -- cgit v1.2.3