From 09bff904e5b18286bce7b9229815eaa853a4e73a Mon Sep 17 00:00:00 2001 From: Doug Johnston Date: Wed, 14 Feb 2018 16:43:42 -0800 Subject: [PATCH] Allow MakeSingleHeader.py script to run from non-git source code (ie: an archive) --- scripts/MakeSingleHeader.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/scripts/MakeSingleHeader.py b/scripts/MakeSingleHeader.py index 23c2de3f..e6985beb 100755 --- a/scripts/MakeSingleHeader.py +++ b/scripts/MakeSingleHeader.py @@ -7,7 +7,7 @@ from __future__ import print_function, unicode_literals import os import re import argparse -from subprocess import check_output +from subprocess import check_output, CalledProcessError includes_local = re.compile(r"""^#include "(.*)"$""", re.MULTILINE) includes_system = re.compile(r"""^#include \<(.*)\>$""", re.MULTILINE) @@ -17,7 +17,10 @@ BDIR = os.path.join(os.path.dirname(DIR), 'include') # DIR.parent / 'include' print("Git directory:", DIR) -TAG = check_output(['git', 'describe', '--tags', '--always'], cwd=str(DIR)).decode("utf-8") +try: + TAG = check_output(['git', 'describe', '--tags', '--always'], cwd=str(DIR)).decode("utf-8") +except CalledProcessError: + TAG = "A non-git source" def MakeHeader(out): main_header = os.path.join(BDIR, 'CLI', 'CLI.hpp')