mirror of
https://github.com/CLIUtils/CLI11.git
synced 2025-05-03 05:53:52 +00:00
Allow MakeSingleHeader.py script to run from non-git source code (ie: an archive)
This commit is contained in:
parent
4e62a0a980
commit
09bff904e5
@ -7,7 +7,7 @@ from __future__ import print_function, unicode_literals
|
|||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import argparse
|
import argparse
|
||||||
from subprocess import check_output
|
from subprocess import check_output, CalledProcessError
|
||||||
|
|
||||||
includes_local = re.compile(r"""^#include "(.*)"$""", re.MULTILINE)
|
includes_local = re.compile(r"""^#include "(.*)"$""", re.MULTILINE)
|
||||||
includes_system = 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)
|
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):
|
def MakeHeader(out):
|
||||||
main_header = os.path.join(BDIR, 'CLI', 'CLI.hpp')
|
main_header = os.path.join(BDIR, 'CLI', 'CLI.hpp')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user