python: use ipython in --interactive if it is available
authorNathan Binkert <nate@binkert.org>
Tue, 15 Jun 2010 06:24:46 +0000 (23:24 -0700)
committerNathan Binkert <nate@binkert.org>
Tue, 15 Jun 2010 06:24:46 +0000 (23:24 -0700)
src/python/m5/main.py

index fd58ce5005f7fb9bf3534bcecde7f657373bd867..cd139ccb39a723f433ec3df8d6b4ca37e32485d8 100644 (file)
@@ -360,8 +360,13 @@ def main():
 
     # once the script is done
     if options.interactive:
-        interact = code.InteractiveConsole(scope)
-        interact.interact("M5 Interactive Console")
+        banner = "M5 Interactive Console"
+        try:
+            from IPython.Shell import IPShellEmbed
+            ipshell = IPShellEmbed(banner=banner,user_ns=scope)
+            ipshell()
+        except ImportError:
+            code.InteractiveConsole(scope).interact(banner)
 
 if __name__ == '__main__':
     from pprint import pprint