scons: Check for known buggy version of SWIG (2.0.9)
SWIG version 2.0.9 uses fully qualified module names despite of the importing module being in the same package as the imported module. This has the unfortunate consequence of causing the following error when importing m5.internal.event: Traceback (most recent call last): File "<string>", line 1, in <module> File "src/python/importer.py", line 75, in load_module exec code in mod.__dict__ File "src/python/m5/__init__.py", line 35, in <module> import internal File "src/python/importer.py", line 75, in load_module exec code in mod.__dict__ File "src/python/m5/internal/__init__.py", line 32, in <module> import event File "src/python/importer.py", line 75, in load_module exec code in mod.__dict__ File "build/X86/python/swig/event.py", line 107, in <module> class Event(m5.internal.serialize.Serializable): AttributeError: 'module' object has no attribute 'internal' When 'event' is loaded, it triggers 'serialize' to be loaded. However, it seems like the dictionary of 'm5' isn't updated until after __init__.py terminates, which means that 'event' never sees the 'internal' attribute on 'm5'. Older versions of SWIG didn't include the fully qualified module name if the modules were in the same package.
This commit is contained in:
parent
fc6f569d94
commit
9544e8fbe0
1 changed files with 9 additions and 0 deletions
|
@ -713,6 +713,15 @@ if compareVersions(swig_version[2], min_swig_version) < 0:
|
|||
print ' Installed version:', swig_version[2]
|
||||
Exit(1)
|
||||
|
||||
if swig_version[2] == "2.0.9":
|
||||
print '\n' + termcap.Yellow + termcap.Bold + \
|
||||
'Warning: SWIG version 2.0.9 sometimes generates broken code.\n' + \
|
||||
termcap.Normal + \
|
||||
'This problem only affects some platforms and some Python\n' + \
|
||||
'versions. See the following SWIG bug report for details:\n' + \
|
||||
'http://sourceforge.net/p/swig/bugs/1297/\n'
|
||||
|
||||
|
||||
# Set up SWIG flags & scanner
|
||||
swig_flags=Split('-c++ -python -modern -templatereduce $_CPPINCFLAGS')
|
||||
main.Append(SWIGFLAGS=swig_flags)
|
||||
|
|
Loading…
Reference in a new issue