python: figure out if the m5.internal package exists even with demandimport
authorNathan Binkert <nate@binkert.org>
Fri, 15 Apr 2011 17:37:28 +0000 (10:37 -0700)
committerNathan Binkert <nate@binkert.org>
Fri, 15 Apr 2011 17:37:28 +0000 (10:37 -0700)
src/python/m5/__init__.py

index 9f9459ae8b80b8dd8253cfadb7d19a7d8e5870d0..b5af7a80fe24a7dddefed1d2e3369ce1d4670359 100644 (file)
 # scripts while allowing new SCons code to operate properly.
 
 try:
-    import internal
+    # Try to import something that's generated by swig
+    import internal.core
+
+    # Try to grab something from it in case demandimport is being used
+    internal.core.__package__
 except ImportError:
+    # The import failed
     internal = None
 
 if internal: