diff -r 51712ef0d573 -r bbc1988e86b9 src/python/m5/main.py --- a/src/python/m5/main.py Thu Feb 07 12:36:06 2013 +0100 +++ b/src/python/m5/main.py Thu Feb 07 12:37:12 2013 +0100 @@ -129,11 +129,40 @@ def interact(scope): banner = "gem5 Interactive Console" + + ipshell = None + prompt_in1 = "gem5 \\#> " + prompt_out = "gem5 \\#: " + + # Is IPython version 0.10 or earlier available? try: from IPython.Shell import IPShellEmbed - ipshell = IPShellEmbed(argv=[], banner=banner, user_ns=scope) + ipshell = IPShellEmbed(argv=["-prompt_in1", prompt_in1, + "-prompt_out", prompt_out], + banner=banner, user_ns=scope) + except ImportError: + pass + + # Is IPython version 0.11 or later available? + if not ipshell: + try: + import IPython + from IPython.config.loader import Config + from IPython.frontend.terminal.embed import InteractiveShellEmbed + + cfg = Config() + cfg.PromptManager.in_template = prompt_in1 + cfg.PromptManager.out_template = prompt_out + ipshell = InteractiveShellEmbed(config=cfg, user_ns=scope, + banner1=banner) + except ImportError: + pass + + if ipshell: ipshell() - except ImportError: + else: + # Use the Python shell in the standard library if IPython + # isn't available. code.InteractiveConsole(scope).interact(banner) def main(*args):