-
Notifications
You must be signed in to change notification settings - Fork 91
/
fdsGetAdditionalVersionByName.py
30 lines (26 loc) · 1.01 KB
/
fdsGetAdditionalVersionByName.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import os, re, subprocess;
from mBugId import cBugId;
rbVersion = re.compile(b"^cdb version (.*)\n$");
def fdsGetAdditionalVersionByName():
dsVersion_by_sName = {};
for sISA in ["x86", "x64"]:
s0CdbBinaryPath = cBugId.fs0GetCdbBinaryPath(sISA);
if s0CdbBinaryPath is None:
dsVersion_by_sName["cdb.exe (%s)" % sISA] = "not available";
elif not os.path.isfile(s0CdbBinaryPath):
dsVersion_by_sName["cdb.exe (%s)" % sISA] = "not found";
else:
try:
oCdbProcess = subprocess.run(
args = [s0CdbBinaryPath, "-version"],
capture_output = True,
);
except Exception as oException:
dsVersion_by_sName["cdb.exe (%s)" % sISA] = "unknown";
else:
obVersionMatch = rbVersion.match(oCdbProcess.stdout);
if obVersionMatch:
dsVersion_by_sName["cdb.exe (%s)" % sISA] = str(obVersionMatch.group(1), "ascii", "strict");
else:
dsVersion_by_sName["cdb.exe (%s)" % sISA] = "unknown";
return dsVersion_by_sName;