Commit 7c7b4e12 authored by Gustavo J. A. M. Carneiro 's avatar Gustavo J. A. M. Carneiro
Browse files

Don't scan python bindings until the everything.h file to be scanned is generated. Closes #288.

parent f051f8fb
Showing with 29 additions and 16 deletions
+29 -16
......@@ -223,6 +223,7 @@ __dummy_function_to_force_template_instantiation (Ptr<Object> obj, TypeId typeId
return 0
class all_ns3_headers_taskgen(Object.task_gen):
"""Generates a 'everything.h' header file that includes some/all public ns3 headers.
This single header file is to be parsed only once by gccxml, for greater efficiency.
......@@ -293,6 +294,33 @@ def get_modules_and_headers():
return retval
class PythonScanTask(Task.TaskBase):
"""Uses gccxml to scan the file 'everything.h' and extract API definitions.
"""
def __init__(self, curdirnode, env):
self.m_display = 'python-scan'
self.prio = 5 # everything.h has prio 4
super(PythonScanTask, self).__init__()
self.curdirnode = curdirnode
self.env = env
def run(self):
#print "Rescanning the python bindings..."
argv = [
self.env['PYTHON'],
os.path.join(self.curdirnode.abspath(), 'ns3modulescan.py'), # scanning script
self.curdirnode.find_dir('../..').abspath(self.env), # include path (where the ns3 include dir is)
self.curdirnode.find_build('everything.h').abspath(self.env),
os.path.join(self.curdirnode.abspath(), 'ns3modulegen_generated.py'), # output file
]
scan = subprocess.Popen(argv, stdin=subprocess.PIPE)
scan.stdin.write(repr(get_modules_and_headers()))
scan.stdin.close()
if scan.wait():
raise SystemExit(1)
def build(bld):
if Params.g_options.python_disable:
return
......@@ -307,22 +335,7 @@ def build(bld):
if Params.g_options.python_scan:
if not env['ENABLE_PYTHON_SCANNING']:
Params.fatal("Cannot re-scan python bindings: (py)gccxml not available")
print "Rescanning the python bindings..."
curdir = bld.m_curdirnode.abspath()
argv = [
env['PYTHON'],
os.path.join(curdir, 'ns3modulescan.py'), # scanning script
bld.m_curdirnode.find_dir('../..').abspath(env), # include path (where the ns3 include dir is)
bld.m_curdirnode.find_build('everything.h').abspath(env),
os.path.join(curdir, 'ns3modulegen_generated.py'), # output file
]
scan = subprocess.Popen(argv, stdin=subprocess.PIPE)
scan.stdin.write(repr(get_modules_and_headers()))
scan.stdin.close()
if scan.wait():
raise SystemExit(1)
print "Rescanning the python bindings done."
raise SystemExit
PythonScanTask(bld.m_curdirnode, env)
## Get a list of scanned modules; the set of scanned modules
## may be smaller than the set of all modules, in case a new
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment