diff options
author | David Grayson <davidegrayson@gmail.com> | 2023-02-22 13:26:02 -0800 |
---|---|---|
committer | Damien George <damien@micropython.org> | 2023-03-02 23:19:30 +1100 |
commit | 2bcd88d55645f2ea702ff70336b33be4661c97a8 (patch) | |
tree | 701672db992d26b53f03ecef9175e438d218745e /py/makeversionhdr.py | |
parent | 009809668242438a8613ecb749999e740d624a94 (diff) | |
download | micropython-2bcd88d55645f2ea702ff70336b33be4661c97a8.tar.gz micropython-2bcd88d55645f2ea702ff70336b33be4661c97a8.zip |
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 <davidegrayson@gmail.com>
Diffstat (limited to 'py/makeversionhdr.py')
-rw-r--r-- | py/makeversionhdr.py | 7 |
1 files changed, 5 insertions, 2 deletions
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) |