Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
praich
Ns 3 Dev
Commits
7c7b4e12
Commit
7c7b4e12
authored
16 years ago
by
Gustavo J. A. M. Carneiro
Browse files
Options
Download
Email Patches
Plain Diff
Don't scan python bindings until the everything.h file to be scanned is generated. Closes #288.
parent
f051f8fb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bindings/python/wscript
+29
-16
bindings/python/wscript
with
29 additions
and
16 deletions
+29
-16
bindings/python/wscript
View file @
7c7b4e12
...
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help