Commit 09bff904e5b18286bce7b9229815eaa853a4e73a

Authored by Doug Johnston
Committed by Henry Schreiner
1 parent 4e62a0a9

Allow MakeSingleHeader.py script to run from non-git source code (ie: an archive)

Showing 1 changed file with 5 additions and 2 deletions
scripts/MakeSingleHeader.py
@@ -7,7 +7,7 @@ from __future__ import print_function, unicode_literals @@ -7,7 +7,7 @@ from __future__ import print_function, unicode_literals
7 import os 7 import os
8 import re 8 import re
9 import argparse 9 import argparse
10 -from subprocess import check_output 10 +from subprocess import check_output, CalledProcessError
11 11
12 includes_local = re.compile(r"""^#include "(.*)"$""", re.MULTILINE) 12 includes_local = re.compile(r"""^#include "(.*)"$""", re.MULTILINE)
13 includes_system = re.compile(r"""^#include \<(.*)\>$""", re.MULTILINE) 13 includes_system = re.compile(r"""^#include \<(.*)\>$""", re.MULTILINE)
@@ -17,7 +17,10 @@ BDIR = os.path.join(os.path.dirname(DIR), &#39;include&#39;) # DIR.parent / &#39;include&#39; @@ -17,7 +17,10 @@ BDIR = os.path.join(os.path.dirname(DIR), &#39;include&#39;) # DIR.parent / &#39;include&#39;
17 17
18 print("Git directory:", DIR) 18 print("Git directory:", DIR)
19 19
20 -TAG = check_output(['git', 'describe', '--tags', '--always'], cwd=str(DIR)).decode("utf-8") 20 +try:
  21 + TAG = check_output(['git', 'describe', '--tags', '--always'], cwd=str(DIR)).decode("utf-8")
  22 +except CalledProcessError:
  23 + TAG = "A non-git source"
21 24
22 def MakeHeader(out): 25 def MakeHeader(out):
23 main_header = os.path.join(BDIR, 'CLI', 'CLI.hpp') 26 main_header = os.path.join(BDIR, 'CLI', 'CLI.hpp')