From 011dc236d3d195a3a36ca573900571e907621063 Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Mon, 20 Sep 2021 16:51:52 -0700 Subject: [PATCH] python: Get rid of some unused cruft in main.py. There was some code at the end of main.py which would let you run it directly. This would parse options passed to the script, and show you what they equaled. Also, the "main" function would optionally let you pass in options to override whatever it would find with parse_arguments. This is no longer used. Change-Id: Ib0effa7ac2b4a51b68994372a7c7fcf1c9b4dc13 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/50707 Reviewed-by: Jason Lowe-Power Maintainer: Jason Lowe-Power Tested-by: kokoro --- src/python/m5/main.py | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/src/python/m5/main.py b/src/python/m5/main.py index f3be50f516..37a7002485 100644 --- a/src/python/m5/main.py +++ b/src/python/m5/main.py @@ -214,7 +214,7 @@ def _check_tracing(): fatal("Tracing is not enabled. Compile with TRACING_ON") -def main(*args): +def main(): import m5 import _m5.core @@ -229,12 +229,7 @@ def main(*args): from .util import inform, fatal, panic, isInteractive from m5.util.terminal_formatter import TerminalFormatter - if len(args) == 0: - options, arguments = parse_options() - elif len(args) == 2: - options, arguments = args - else: - raise TypeError("main() takes 0 or 2 arguments (%d given)" % len(args)) + options, arguments = parse_options() m5.options = options @@ -462,15 +457,3 @@ def main(*args): # once the script is done if options.interactive: interact(scope) - -if __name__ == '__main__': - from pprint import pprint - - options, arguments = parse_options() - - print('opts:') - pprint(options, indent=4) - print() - - print('args:') - pprint(arguments, indent=4)