build: (fixes #2863) pygccxml version check compatibility with Python3

This commit is contained in:
Mathias Ettinger
2018-03-05 21:10:36 -08:00
parent dc1431522a
commit eecd507025

View File

@@ -273,10 +273,15 @@ int main ()
"Missing 'pygccxml' Python module")
return
out = subprocess.Popen([conf.env['PYTHON'][0], "-c",
"import pygccxml; print pygccxml.__version__"],
stdout=subprocess.PIPE).communicate()[0]
pygccxml_version_str = out.strip()
try:
import pygccxml as pygccxml_imported
pygccxml_version_str = pygccxml_imported.__version__
except (ImportError, AttributeError):
Logs.warn("pygccxml version cannot be determined")
conf.report_optional_feature("castxml", "Python API Scanning Support", False,
"pygccxml Python module version is unknown")
return
# Bug 2013: pygccxml versions > 1.0.0 prepend a 'v' to version number
pygccxml_version_str = pygccxml_version_str.lstrip('v')
pygccxml_version = tuple([int(x) for x in pygccxml_version_str.split('.')])