diff --git a/scripts/genpinctrl/genpinctrl.py b/scripts/genpinctrl/genpinctrl.py index a7f6d3ab2..17cd4c768 100644 --- a/scripts/genpinctrl/genpinctrl.py +++ b/scripts/genpinctrl/genpinctrl.py @@ -17,7 +17,7 @@ from pathlib import Path import re import shutil -from subprocess import check_output +from subprocess import check_output, STDOUT, CalledProcessError import xml.etree.ElementTree as ET from jinja2 import Environment, FileSystemLoader @@ -598,8 +598,11 @@ def main(data_path, output): ) # write readme file - commit_raw = check_output(["git", "rev-parse", "HEAD"], cwd=data_path) - commit = commit_raw.decode("utf-8").strip() + try: + commit_raw = check_output(["git", "rev-parse", "HEAD"], cwd=data_path, stderr=STDOUT) + commit = commit_raw.decode("utf-8").strip() + except CalledProcessError: + commit = "" with open(output / "README.rst", "w") as f: f.write(readme_template.render(commit=commit))