Don't scan python bindings until the everything.h file to be scanned is generated. Closes #288.
1.1 --- a/bindings/python/wscript Mon Aug 18 16:03:31 2008 +0100
1.2 +++ b/bindings/python/wscript Mon Aug 18 23:04:49 2008 +0100
1.3 @@ -223,6 +223,7 @@
1.4 return 0
1.5
1.6
1.7 +
1.8 class all_ns3_headers_taskgen(Object.task_gen):
1.9 """Generates a 'everything.h' header file that includes some/all public ns3 headers.
1.10 This single header file is to be parsed only once by gccxml, for greater efficiency.
1.11 @@ -293,6 +294,33 @@
1.12 return retval
1.13
1.14
1.15 +
1.16 +class PythonScanTask(Task.TaskBase):
1.17 + """Uses gccxml to scan the file 'everything.h' and extract API definitions.
1.18 + """
1.19 + def __init__(self, curdirnode, env):
1.20 + self.m_display = 'python-scan'
1.21 + self.prio = 5 # everything.h has prio 4
1.22 + super(PythonScanTask, self).__init__()
1.23 + self.curdirnode = curdirnode
1.24 + self.env = env
1.25 +
1.26 + def run(self):
1.27 + #print "Rescanning the python bindings..."
1.28 + argv = [
1.29 + self.env['PYTHON'],
1.30 + os.path.join(self.curdirnode.abspath(), 'ns3modulescan.py'), # scanning script
1.31 + self.curdirnode.find_dir('../..').abspath(self.env), # include path (where the ns3 include dir is)
1.32 + self.curdirnode.find_build('everything.h').abspath(self.env),
1.33 + os.path.join(self.curdirnode.abspath(), 'ns3modulegen_generated.py'), # output file
1.34 + ]
1.35 + scan = subprocess.Popen(argv, stdin=subprocess.PIPE)
1.36 + scan.stdin.write(repr(get_modules_and_headers()))
1.37 + scan.stdin.close()
1.38 + if scan.wait():
1.39 + raise SystemExit(1)
1.40 +
1.41 +
1.42 def build(bld):
1.43 if Params.g_options.python_disable:
1.44 return
1.45 @@ -307,22 +335,7 @@
1.46 if Params.g_options.python_scan:
1.47 if not env['ENABLE_PYTHON_SCANNING']:
1.48 Params.fatal("Cannot re-scan python bindings: (py)gccxml not available")
1.49 - print "Rescanning the python bindings..."
1.50 - curdir = bld.m_curdirnode.abspath()
1.51 - argv = [
1.52 - env['PYTHON'],
1.53 - os.path.join(curdir, 'ns3modulescan.py'), # scanning script
1.54 - bld.m_curdirnode.find_dir('../..').abspath(env), # include path (where the ns3 include dir is)
1.55 - bld.m_curdirnode.find_build('everything.h').abspath(env),
1.56 - os.path.join(curdir, 'ns3modulegen_generated.py'), # output file
1.57 - ]
1.58 - scan = subprocess.Popen(argv, stdin=subprocess.PIPE)
1.59 - scan.stdin.write(repr(get_modules_and_headers()))
1.60 - scan.stdin.close()
1.61 - if scan.wait():
1.62 - raise SystemExit(1)
1.63 - print "Rescanning the python bindings done."
1.64 - raise SystemExit
1.65 + PythonScanTask(bld.m_curdirnode, env)
1.66
1.67 ## Get a list of scanned modules; the set of scanned modules
1.68 ## may be smaller than the set of all modules, in case a new