bindings: Replace gccxml usage with castxml

This commit is contained in:
Ankit Deepak
2017-07-06 11:49:29 -07:00
parent c6614ad000
commit 0cfaf415f4
4 changed files with 46 additions and 36 deletions

View File

@@ -15,7 +15,8 @@ from waflib.Errors import WafError
# https://github.com/gjcarneiro/pybindgen
REQUIRED_PYBINDGEN_VERSION = '0.17.0.post58+ngcf00cc0'
REQUIRED_PYGCCXML_VERSION = (0, 9, 5)
REQUIRED_PYGCCXML_VERSION = (1, 9, 0)
REQUIRED_CASTXML_VERSION = '0.1'
RUN_ME=-3
@@ -268,7 +269,7 @@ int main ()
try:
conf.check_python_module('pygccxml')
except Errors.ConfigurationError:
conf.report_optional_feature("pygccxml", "Python API Scanning Support", False,
conf.report_optional_feature("castxml", "Python API Scanning Support", False,
"Missing 'pygccxml' Python module")
return
@@ -285,40 +286,43 @@ int main ()
"automatic scanning of API definitions will not be possible" %
(pygccxml_version_str,
'.'.join([str(x) for x in REQUIRED_PYGCCXML_VERSION])))
conf.report_optional_feature("pygccxml", "Python API Scanning Support", False,
"pygccxml too old")
conf.report_optional_feature("castxml", "Python API Scanning Support", False,
"pygccxml Python module too old")
return
## Check gccxml version
## Check castxml version
try:
gccxml = conf.find_program('gccxml', var='GCCXML')
castxml = conf.find_program('castxml', var='CASTXML')
except WafError:
gccxml = None
if not gccxml:
Logs.warn("gccxml missing; automatic scanning of API definitions will not be possible")
conf.report_optional_feature("pygccxml", "Python API Scanning Support", False,
"gccxml missing")
castxml = None
if not castxml:
Logs.warn("castxml missing; automatic scanning of API definitions will not be possible")
conf.report_optional_feature("castxml", "Python API Scanning Support", False,
"castxml missing")
return
gccxml_version_line = os.popen(gccxml[0] + " --version").readline().strip()
m = re.match( "^GCC-XML version (\d\.\d(\.\d)?)$", gccxml_version_line)
out = subprocess.Popen([castxml[0], '--version'],
stdout=subprocess.PIPE).communicate()[0]
castxml_version_line = maybe_decode(out).split('\n', 1)[0].strip()
## Expecting version string such as 'castxml version 0.1-gfab9c47'
m = re.match( "^castxml version (\d\.\d)(-)?(\w+)?", castxml_version_line)
try:
gccxml_version = m.group(1)
gccxml_version_ok = ([int(s) for s in gccxml_version.split('.')] >= [0, 9])
castxml_version = m.group(1)
castxml_version_ok = castxml_version >= REQUIRED_CASTXML_VERSION
except AttributeError:
gccxml_version = gccxml_version_line
gccxml_version_ok = False
conf.msg('Checking for gccxml version', gccxml_version)
if not gccxml_version_ok:
Logs.warn("gccxml version unknown or too old, need version >= 0.9; automatic scanning of API definitions will not be possible")
conf.report_optional_feature("pygccxml", "Python API Scanning Support", False,
"gccxml too old")
castxml_version = castxml_version_line
castxml_version_ok = False
conf.msg('Checking for castxml version', castxml_version)
if not castxml_version_ok:
Logs.warn("castxml version unknown or too old, need version >= %s; automatic scanning of API definitions will not be possible" % REQUIRED_CASTXML_VERSION)
conf.report_optional_feature("castxml", "Python API Scanning Support", False,
"castxml too old")
return
## If we reached
conf.env['ENABLE_PYTHON_SCANNING'] = True
conf.report_optional_feature("pygccxml", "Python API Scanning Support", True, None)
conf.report_optional_feature("castxml", "Python API Scanning Support", True, None)
# ---------------------
@@ -342,7 +346,7 @@ def get_module_path(bld, module):
return ns3headers.path.abspath()
class apiscan_task(Task.Task):
"""Uses gccxml to scan the file 'everything.h' and extract API definitions.
"""Uses castxml to scan the file 'everything.h' and extract API definitions.
"""
after = 'gen_ns3_module_header ns3header'
before = 'cxx command'