-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat --apiscan #129
base: master
Are you sure you want to change the base?
Feat --apiscan #129
Conversation
Signed-off-by: Parth Pratim Chatterjee <[email protected]>
Signed-off-by: Parth Pratim Chatterjee <[email protected]>
Signed-off-by: Parth Pratim Chatterjee <[email protected]>
@@ -15,8 +15,11 @@ from waflib.Errors import WafError | |||
# after = TaskGen.after | |||
|
|||
# https://github.com/gjcarneiro/pybindgen | |||
REQUIRED_PYBINDGEN_VERSION = '0.17.0.post41+ngd10fa60' | |||
REQUIRED_PYGCCXML_VERSION = (0, 9, 5) | |||
REQUIRED_PYBINDGEN_VERSION = '0.21.0.post20+ng71852b1' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are at pybindgen 0.22.0 now (which is also what is in ns-3-dev/bindings/python/wscript). I see now that ns-3-dev/bindings/python/wscript is out of date with what we are using for CastXML (0.43) and pygccxml (2.2.1) now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sir, should I then update this to 0.22.0 for now ?
bindings/python/wscript
Outdated
ns3waf._report_optional_feature(conf, "pygccxml", "Python API Scanning Support", False, | ||
"pygccxml too old") | ||
ns3waf._report_optional_feature(conf, "castxml", "Python API Scanning Support", False, | ||
"pygccxml Python module too old") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This failure string (pygccxml) no longer matches what is checked (castxml). 'gccxml' and 'pygccxml' are separate things; pygccxml continues even though gccxml is superseded by castxml.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for that Sir. I tried to fix this in 3ebf1ae
bindings/python/wscript
Outdated
for h in ns3headers.to_list(ns3headers.headers): | ||
headers_map[os.path.basename(h)] = ns3headers.module | ||
return headers_map | ||
module_headers = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason we need to enumerate headers? It seems fragile to do it this way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm sorry for the patch code there. I was using this initially while testing. I've updated the setup code in 6ebb5b6
We actually require to iterate the headers as we need to pass a header map to Apiscan Task for it to identify the ns-3 classes we use in DCE, and since in DCE's taskgen we don't have access to ns3's headers, we need to iterate the headers. For DCE, it gets stored in the taskgen ./lib/ns3-dce and can be loaded directly.
Sir, does this setup code look good enough ?
bindings/python/wscript
Outdated
print("import warnings", file=outfile) | ||
print('warnings.warn("the ns3 module is a compatibility layer '\ | ||
'and should not be used in newly written code", DeprecationWarning, stacklevel=2)', file=outfile) | ||
print(file=outfile) | ||
for module in self.bld.env['PYTHON_MODULES_BUILT']: | ||
for module in ['antenna', 'aodv', 'applications', 'bridge', 'buildings', 'config-store', 'core', 'csma', 'csma-layout', 'dsdv', 'dsr', 'energy', 'fd-net-device', 'flow-monitor', 'internet', 'internet-apps', 'lr-wpan', 'lte', 'mesh', 'mobility', 'netanim', 'network', 'nix-vector-routing', 'olsr', 'point-to-point', 'point-to-point-layout', 'propagation', 'sixlowpan', 'spectrum', 'stats', 'tap-bridge', 'topology-read', 'traffic-control', 'uan', 'virtual-net-device', 'wave', 'wifi', 'wimax','dce']: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is this enumeration of ns-3 modules used for? Again, it is fragile to do it this way; it doesn't account for modules that may be in 'contrib' directory, or modules that may be disabled in the ns-3 build.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fa725ff
I never really use this method run, as we depend on the bake/build/lib/python3.8/site-packages/ns3/init.py (which is blank). Even if we make our own __init__.py
in bindings, python3.8 would first check this directory and stop here, not discovering other ns3 cpython libraries which are present in another path which is already added to PYTHONPATH. This is why I had to change the PYTHONPATH lookup orderring in this b454fcb
Signed-off-by: Parth Pratim Chatterjee <[email protected]>
Signed-off-by: Parth Pratim Chatterjee <[email protected]>
…ges/ns3/__init__.py Signed-off-by: Parth Pratim Chatterjee <[email protected]>
Signed-off-by: Parth Pratim Chatterjee [email protected]
Enables --apiscan feature for Python Bindings.
This PR was made as a part of Google Summer of Code 2021 for the project Direct Code Execution Modernization