Skip to content

Commit 2bcd88d

Browse files
DavidEGraysondpgeorge
authored andcommitted
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 <[email protected]>
1 parent 0098096 commit 2bcd88d

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

py/makeversionhdr.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,11 @@ def get_version_info_from_mpconfig(repo_path):
8686

8787

8888
def make_version_header(repo_path, filename):
89-
# Get version info using git, with fallback to py/mpconfig.h
90-
info = get_version_info_from_git(repo_path)
89+
info = None
90+
if "MICROPY_GIT_TAG" in os.environ:
91+
info = [os.environ["MICROPY_GIT_TAG"], os.environ["MICROPY_GIT_HASH"]]
92+
if info is None:
93+
info = get_version_info_from_git(repo_path)
9194
if info is None:
9295
info = get_version_info_from_mpconfig(repo_path)
9396

0 commit comments

Comments
 (0)