Squashed 'libs/cli11/' content from commit dcbcb47
git-subtree-dir: libs/cli11 git-subtree-split: dcbcb4721dda5dab0a56d9faaaee50e6a30f7758
This commit is contained in:
17
scripts/ExtractVersion.py
Executable file
17
scripts/ExtractVersion.py
Executable file
@@ -0,0 +1,17 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import os
|
||||
import re
|
||||
|
||||
base_path = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
|
||||
config_h = os.path.join(base_path, "include", "CLI", "Version.hpp")
|
||||
data = {"MAJOR": 0, "MINOR": 0, "PATCH": 0}
|
||||
reg = re.compile(r"^\s*#define\s+CLI11_VERSION_([A-Z]+)\s+([0-9]+).*$")
|
||||
|
||||
with open(config_h, "r") as fp:
|
||||
for l in fp:
|
||||
m = reg.match(l)
|
||||
if m:
|
||||
data[m.group(1)] = int(m.group(2))
|
||||
|
||||
print("{}.{}.{}".format(data["MAJOR"], data["MINOR"], data["PATCH"]))
|
||||
Reference in New Issue
Block a user