main.py (9495:ff4b1bde5f60) | main.py (9512:d367034c7e3c) |
---|---|
1# Copyright (c) 2005 The Regents of The University of Michigan 2# All rights reserved. 3# 4# Redistribution and use in source and binary forms, with or without 5# modification, are permitted provided that the following conditions are 6# met: redistributions of source code must retain the above copyright 7# notice, this list of conditions and the following disclaimer; 8# redistributions in binary form must reproduce the above copyright --- 115 unchanged lines hidden (view full) --- 124 scope = { 'options' : options } 125 execfile(options_file, scope) 126 127 arguments = options.parse_args() 128 return options,arguments 129 130def interact(scope): 131 banner = "gem5 Interactive Console" | 1# Copyright (c) 2005 The Regents of The University of Michigan 2# All rights reserved. 3# 4# Redistribution and use in source and binary forms, with or without 5# modification, are permitted provided that the following conditions are 6# met: redistributions of source code must retain the above copyright 7# notice, this list of conditions and the following disclaimer; 8# redistributions in binary form must reproduce the above copyright --- 115 unchanged lines hidden (view full) --- 124 scope = { 'options' : options } 125 execfile(options_file, scope) 126 127 arguments = options.parse_args() 128 return options,arguments 129 130def interact(scope): 131 banner = "gem5 Interactive Console" |
132 133 ipshell = None 134 prompt_in1 = "gem5 \\#> " 135 prompt_out = "gem5 \\#: " 136 137 # Is IPython version 0.10 or earlier available? |
|
132 try: 133 from IPython.Shell import IPShellEmbed | 138 try: 139 from IPython.Shell import IPShellEmbed |
134 ipshell = IPShellEmbed(argv=[], banner=banner, user_ns=scope) 135 ipshell() | 140 ipshell = IPShellEmbed(argv=["-prompt_in1", prompt_in1, 141 "-prompt_out", prompt_out], 142 banner=banner, user_ns=scope) |
136 except ImportError: | 143 except ImportError: |
144 pass 145 146 # Is IPython version 0.11 or later available? 147 if not ipshell: 148 try: 149 import IPython 150 from IPython.config.loader import Config 151 from IPython.frontend.terminal.embed import InteractiveShellEmbed 152 153 cfg = Config() 154 cfg.PromptManager.in_template = prompt_in1 155 cfg.PromptManager.out_template = prompt_out 156 ipshell = InteractiveShellEmbed(config=cfg, user_ns=scope, 157 banner1=banner) 158 except ImportError: 159 pass 160 161 if ipshell: 162 ipshell() 163 else: 164 # Use the Python shell in the standard library if IPython 165 # isn't available. |
|
137 code.InteractiveConsole(scope).interact(banner) 138 139def main(*args): 140 import m5 141 142 import core 143 import debug 144 import defines --- 230 unchanged lines hidden --- | 166 code.InteractiveConsole(scope).interact(banner) 167 168def main(*args): 169 import m5 170 171 import core 172 import debug 173 import defines --- 230 unchanged lines hidden --- |