Skip to content

Commit 0d5d160

Browse files
committed
py/makeversionhdr.py: Fallback to using docs version if no git repo.
Addresses issue micropython#1420.
1 parent 7027fd5 commit 0d5d160

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

py/makeversionhdr.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,11 @@ def get_version_info_from_git():
2121

2222
# Note: git describe doesn't work if no tag is available
2323
try:
24-
git_tag = subprocess.check_output(["git", "describe", "--dirty", "--always"], universal_newlines=True).strip()
25-
except subprocess.CalledProcessError:
24+
git_tag = subprocess.check_output(["git", "describe", "--dirty", "--always"], stderr=subprocess.STDOUT, universal_newlines=True).strip()
25+
except subprocess.CalledProcessError as er:
26+
if er.args[0] == 128:
27+
# git exit code of 128 means no repository found
28+
return None
2629
git_tag = ""
2730
except OSError:
2831
return None

0 commit comments

Comments
 (0)