From eecd50702593a2101f627901f46ea34f4b7b7bb2 Mon Sep 17 00:00:00 2001 From: Mathias Ettinger Date: Mon, 5 Mar 2018 21:10:36 -0800 Subject: [PATCH] build: (fixes #2863) pygccxml version check compatibility with Python3 --- bindings/python/wscript | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/bindings/python/wscript b/bindings/python/wscript index 1dd4a5785..d081e51a6 100644 --- a/bindings/python/wscript +++ b/bindings/python/wscript @@ -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('.')])