def parse_cmdline(self, args): usage = u""" pssh [options] pssh [user@site [cmd]] """ parser = OptionParser(self.chan, usage=usage) # add options from a mapping or a Registry callback self.add_cmdline_options(parser) return parser.parse_args(args)
def parse_options(): import config from options import OptionParser options = OptionParser(usage=usage, version=version, description=brief_copyright) option = options.add_option group = options.set_group # Help options option('-B', "--build-info", action="store_true", default=False, help="Show build information") option('-C', "--copyright", action="store_true", default=False, help="Show full copyright information") option('-R', "--readme", action="store_true", default=False, help="Show the readme") # Options for configuring the base simulator option('-d', "--outdir", metavar="DIR", default="m5out", help="Set the output directory to DIR [Default: %default]") option('-r', "--redirect-stdout", action="store_true", default=False, help="Redirect stdout (& stderr, without -e) to file") option('-e', "--redirect-stderr", action="store_true", default=False, help="Redirect stderr to file") option("--stdout-file", metavar="FILE", default="simout", help="Filename for -r redirection [Default: %default]") option("--stderr-file", metavar="FILE", default="simerr", help="Filename for -e redirection [Default: %default]") option('-i', "--interactive", action="store_true", default=False, help="Invoke the interactive interpreter after running the script") option("--pdb", action="store_true", default=False, help="Invoke the python debugger before running the script") option('-p', "--path", metavar="PATH[:PATH]", action='append', split=':', help="Prepend PATH to the system path when invoking the script") option('-q', "--quiet", action="count", default=0, help="Reduce verbosity") option('-v', "--verbose", action="count", default=0, help="Increase verbosity") # Statistics options group("Statistics Options") option("--stats-file", metavar="FILE", default="stats.txt", help="Sets the output file for statistics [Default: %default]") # Configuration Options group("Configuration Options") option("--dump-config", metavar="FILE", default="config.ini", help="Dump configuration output file [Default: %default]") # Debugging options group("Debugging Options") option("--debug-break", metavar="TIME[,TIME]", action='append', split=',', help="Cycle to create a breakpoint") option("--debug-help", action='store_true', help="Print help on trace flags") option("--debug-flags", metavar="FLAG[,FLAG]", action='append', split=',', help="Sets the flags for tracing (-FLAG disables a flag)") option("--remote-gdb-port", type='int', default=7000, help="Remote gdb base port (set to 0 to disable listening)") # Tracing options group("Trace Options") option("--trace-start", metavar="TIME", type='int', help="Start tracing at TIME (must be in ticks)") option("--trace-file", metavar="FILE", default="cout", help="Sets the output file for tracing [Default: %default]") option("--trace-ignore", metavar="EXPR", action='append', split=':', help="Ignore EXPR sim objects") # Help options group("Help Options") option("--list-sim-objects", action='store_true', default=False, help="List all built-in SimObjects, their params and default values") # load the options.py config file to allow people to set their own # default options options_file = config.get('options.py') if options_file: scope = { 'options' : options } execfile(options_file, scope) arguments = options.parse_args() return options,arguments
def parse_options(): import config from options import OptionParser options = OptionParser(usage=usage, version=version, description=brief_copyright) option = options.add_option group = options.set_group listener_modes = ("on", "off", "auto") # Help options option('-B', "--build-info", action="store_true", default=False, help="Show build information") option('-C', "--copyright", action="store_true", default=False, help="Show full copyright information") option('-R', "--readme", action="store_true", default=False, help="Show the readme") # Options for configuring the base simulator option('-d', "--outdir", metavar="DIR", default="m5out", help="Set the output directory to DIR [Default: %default]") option('-r', "--redirect-stdout", action="store_true", default=False, help="Redirect stdout (& stderr, without -e) to file") option('-e', "--redirect-stderr", action="store_true", default=False, help="Redirect stderr to file") option("--stdout-file", metavar="FILE", default="simout", help="Filename for -r redirection [Default: %default]") option("--stderr-file", metavar="FILE", default="simerr", help="Filename for -e redirection [Default: %default]") option("--listener-mode", metavar="{on,off,auto}", choices=listener_modes, default="auto", help="Port (e.g., gdb) listener mode (auto: Enable if running " \ "interactively) [Default: %default]") option("--listener-loopback-only", action="store_true", default=False, help="Port listeners will only accept connections over the " \ "loopback device") option('-i', "--interactive", action="store_true", default=False, help="Invoke the interactive interpreter after running the script") option("--pdb", action="store_true", default=False, help="Invoke the python debugger before running the script") option('-p', "--path", metavar="PATH[:PATH]", action='append', split=':', help="Prepend PATH to the system path when invoking the script") option('-q', "--quiet", action="count", default=0, help="Reduce verbosity") option('-v', "--verbose", action="count", default=0, help="Increase verbosity") # Statistics options group("Statistics Options") option("--stats-file", metavar="FILE", default="stats.txt", help="Sets the output file for statistics [Default: %default]") # Configuration Options group("Configuration Options") option("--dump-config", metavar="FILE", default="config.ini", help="Dump configuration output file [Default: %default]") option("--json-config", metavar="FILE", default="config.json", help="Create JSON output of the configuration [Default: %default]") option( "--dot-config", metavar="FILE", default="config.dot", help="Create DOT & pdf outputs of the configuration [Default: %default]" ) option("--dot-dvfs-config", metavar="FILE", default=None, help="Create DOT & pdf outputs of the DVFS configuration" + \ " [Default: %default]") # Debugging options group("Debugging Options") option("--debug-break", metavar="TICK[,TICK]", action='append', split=',', help="Create breakpoint(s) at TICK(s) " \ "(kills process if no debugger attached)") option("--debug-help", action='store_true', help="Print help on debug flags") option("--debug-flags", metavar="FLAG[,FLAG]", action='append', split=',', help="Sets the flags for debug output (-FLAG disables a flag)") option("--debug-start", metavar="TICK", type='int', help="Start debug output at TICK") option("--debug-end", metavar="TICK", type='int', help="End debug output at TICK") option("--debug-file", metavar="FILE", default="cout", help="Sets the output file for debug [Default: %default]") option("--debug-ignore", metavar="EXPR", action='append', split=':', help="Ignore EXPR sim objects") option("--remote-gdb-port", type='int', default=7000, help="Remote gdb base port (set to 0 to disable listening)") # Help options group("Help Options") option( "--list-sim-objects", action='store_true', default=False, help="List all built-in SimObjects, their params and default values") # load the options.py config file to allow people to set their own # default options options_file = config.get('options.py') if options_file: scope = {'options': options} execfile(options_file, scope) arguments = options.parse_args() return options, arguments
add_option("--trace-ignore", metavar="EXPR", action='append', split=':', help="Ignore EXPR sim objects") # Help options set_group("Help Options") add_option("--list-sim-objects", action='store_true', default=False, help="List all built-in SimObjects, their parameters and default values") # load the options.py config file to allow people to set their own # default options options_file = config.get('options.py') if options_file: scope = { 'options' : options } execfile(options_file, scope) arguments = options.parse_args() def main(): import core import debug import defines import event import info import stats import trace def check_tracing(): if defines.TRACING_ON: return fatal("Tracing is not enabled. Compile with TRACING_ON")
def parse_options(): import config from options import OptionParser options = OptionParser(usage=usage, version=version, description=brief_copyright) option = options.add_option group = options.set_group # Help options option('-B', "--build-info", action="store_true", default=False, help="Show build information") option('-C', "--copyright", action="store_true", default=False, help="Show full copyright information") option('-R', "--readme", action="store_true", default=False, help="Show the readme") # Options for configuring the base simulator option('-d', "--outdir", metavar="DIR", default="m5out", help="Set the output directory to DIR [Default: %default]") option('-r', "--redirect-stdout", action="store_true", default=False, help="Redirect stdout (& stderr, without -e) to file") option('-e', "--redirect-stderr", action="store_true", default=False, help="Redirect stderr to file") option("--stdout-file", metavar="FILE", default="simout", help="Filename for -r redirection [Default: %default]") option("--stderr-file", metavar="FILE", default="simerr", help="Filename for -e redirection [Default: %default]") option('-i', "--interactive", action="store_true", default=False, help="Invoke the interactive interpreter after running the script") option("--pdb", action="store_true", default=False, help="Invoke the python debugger before running the script") option('-p', "--path", metavar="PATH[:PATH]", action='append', split=':', help="Prepend PATH to the system path when invoking the script") option('-q', "--quiet", action="count", default=0, help="Reduce verbosity") option('-v', "--verbose", action="count", default=0, help="Increase verbosity") # Statistics options group("Statistics Options") option("--stats-file", metavar="FILE", default="stats.txt", help="Sets the output file for statistics [Default: %default]") # Configuration Options group("Configuration Options") option("--dump-config", metavar="FILE", default="config.ini", help="Dump configuration output file [Default: %default]") option("--json-config", metavar="FILE", default="config.json", help="Create JSON output of the configuration [Default: %default]") option( "--dot-config", metavar="FILE", default="config.dot", help="Create DOT & pdf outputs of the configuration [Default: %default]" ) # Debugging options group("Debugging Options") option("--debug-break", metavar="TIME[,TIME]", action='append', split=',', help="Cycle to create a breakpoint") option("--debug-help", action='store_true', help="Print help on trace flags") option("--debug-flags", metavar="FLAG[,FLAG]", action='append', split=',', help="Sets the flags for tracing (-FLAG disables a flag)") option("--remote-gdb-port", type='int', default=7000, help="Remote gdb base port (set to 0 to disable listening)") # Tracing options group("Trace Options") option("--trace-start", metavar="TIME", type='int', help="Start tracing at TIME (must be in ticks)") option("--trace-file", metavar="FILE", default="cout", help="Sets the output file for tracing [Default: %default]") option("--trace-ignore", metavar="EXPR", action='append', split=':', help="Ignore EXPR sim objects") # Help options group("Help Options") option( "--list-sim-objects", action='store_true', default=False, help="List all built-in SimObjects, their params and default values") # load the options.py config file to allow people to set their own # default options options_file = config.get('options.py') if options_file: scope = {'options': options} execfile(options_file, scope) arguments = options.parse_args() return options, arguments
def parse_options(): import config from options import OptionParser options = OptionParser(usage=usage, version=version, description=brief_copyright) option = options.add_option group = options.set_group listener_modes = ( "on", "off", "auto" ) # Help options option('-B', "--build-info", action="store_true", default=False, help="Show build information") option('-C', "--copyright", action="store_true", default=False, help="Show full copyright information") option('-R', "--readme", action="store_true", default=False, help="Show the readme") # Options for configuring the base simulator option('-d', "--outdir", metavar="DIR", default="m5out", help="Set the output directory to DIR [Default: %default]") option('-r', "--redirect-stdout", action="store_true", default=False, help="Redirect stdout (& stderr, without -e) to file") option('-e', "--redirect-stderr", action="store_true", default=False, help="Redirect stderr to file") option("--stdout-file", metavar="FILE", default="simout", help="Filename for -r redirection [Default: %default]") option("--stderr-file", metavar="FILE", default="simerr", help="Filename for -e redirection [Default: %default]") option("--listener-mode", metavar="{on,off,auto}", choices=listener_modes, default="auto", help="Port (e.g., gdb) listener mode (auto: Enable if running " \ "interactively) [Default: %default]") option("--listener-loopback-only", action="store_true", default=False, help="Port listeners will only accept connections over the " \ "loopback device") option('-i', "--interactive", action="store_true", default=False, help="Invoke the interactive interpreter after running the script") option("--pdb", action="store_true", default=False, help="Invoke the python debugger before running the script") option('-p', "--path", metavar="PATH[:PATH]", action='append', split=':', help="Prepend PATH to the system path when invoking the script") option('-q', "--quiet", action="count", default=0, help="Reduce verbosity") option('-v', "--verbose", action="count", default=0, help="Increase verbosity") # Statistics options group("Statistics Options") option("--stats-file", metavar="FILE", default="stats.txt", help="Sets the output file for statistics [Default: %default]") # Configuration Options group("Configuration Options") option("--dump-config", metavar="FILE", default="config.ini", help="Dump configuration output file [Default: %default]") option("--json-config", metavar="FILE", default="config.json", help="Create JSON output of the configuration [Default: %default]") option("--dot-config", metavar="FILE", default="config.dot", help="Create DOT & pdf outputs of the configuration [Default: %default]") option("--dot-dvfs-config", metavar="FILE", default=None, help="Create DOT & pdf outputs of the DVFS configuration" + \ " [Default: %default]") # Debugging options group("Debugging Options") option("--debug-break", metavar="TICK[,TICK]", action='append', split=',', help="Create breakpoint(s) at TICK(s) " \ "(kills process if no debugger attached)") option("--debug-help", action='store_true', help="Print help on debug flags") option("--debug-flags", metavar="FLAG[,FLAG]", action='append', split=',', help="Sets the flags for debug output (-FLAG disables a flag)") option("--debug-start", metavar="TICK", type='int', help="Start debug output at TICK") option("--debug-end", metavar="TICK", type='int', help="End debug output at TICK") option("--debug-file", metavar="FILE", default="cout", help="Sets the output file for debug [Default: %default]") option("--debug-ignore", metavar="EXPR", action='append', split=':', help="Ignore EXPR sim objects") option("--remote-gdb-port", type='int', default=7000, help="Remote gdb base port (set to 0 to disable listening)") # Help options group("Help Options") option("--list-sim-objects", action='store_true', default=False, help="List all built-in SimObjects, their params and default values") # load the options.py config file to allow people to set their own # default options options_file = config.get('options.py') if options_file: scope = { 'options' : options } execfile(options_file, scope) arguments = options.parse_args() return options,arguments
def parse_options(): import config from options import OptionParser options = OptionParser(usage=usage, version=version, description=brief_copyright) option = options.add_option group = options.set_group # Help options option('-B', "--build-info", action="store_true", default=False, help="Show build information") option('-C', "--copyright", action="store_true", default=False, help="Show full copyright information") option('-R', "--readme", action="store_true", default=False, help="Show the readme") # Options for configuring the base simulator option('-d', "--outdir", metavar="DIR", default="m5out", help="Set the output directory to DIR [Default: %default]") option('-r', "--redirect-stdout", action="store_true", default=False, help="Redirect stdout (& stderr, without -e) to file") option('-e', "--redirect-stderr", action="store_true", default=False, help="Redirect stderr to file") option("--stdout-file", metavar="FILE", default="simout", help="Filename for -r redirection [Default: %default]") option("--stderr-file", metavar="FILE", default="simerr", help="Filename for -e redirection [Default: %default]") option('-i', "--interactive", action="store_true", default=False, help="Invoke the interactive interpreter after running the script") option("--pdb", action="store_true", default=False, help="Invoke the python debugger before running the script") option('-p', "--path", metavar="PATH[:PATH]", action='append', split=':', help="Prepend PATH to the system path when invoking the script") option('-q', "--quiet", action="count", default=0, help="Reduce verbosity") option('-v', "--verbose", action="count", default=0, help="Increase verbosity") # Statistics options group("Statistics Options") option("--stats-file", metavar="FILE", default="stats.txt", help="Sets the output file for statistics [Default: %default]") option("--carbon-server", action="store", default="127.0.0.1", help="Set the carbon server ip for carbon statistics [Default: %default]") option("--carbon-catalog", action="store", default="gem5test", help="Set the catalog for carbon statistics [Default: %default]") option("--carbon-regex", action="store", default="^[A-Za-z_]*\.\(\(switch_\)*cpu[s]*[0-9]*\.ipc\)*\(l2\.\([A-Za-z_]*\.\)*guestCapacity\)*\(mem_ctrls[0-9]*\.\([A-Za-z_]*\.\)*bw_total\)*$", help="Set the filter regex for carbon statistics [Default: %default]") #"(\w+\.)((\w*cpu\d*\.ipc)|(l2\.(\w+\.)*guestCapacity)|(mem_ctrls\d*\.(\w+\.)*bw_total))" # Configuration Options group("Configuration Options") option("--dump-config", metavar="FILE", default="config.ini", help="Dump configuration output file [Default: %default]") option("--json-config", metavar="FILE", default="config.json", help="Create JSON output of the configuration [Default: %default]") option("--dot-config", metavar="FILE", default="config.dot", help="Create DOT & pdf outputs of the configuration [Default: %default]") # Debugging options group("Debugging Options") option("--debug-break", metavar="TIME[,TIME]", action='append', split=',', help="Tick to create a breakpoint") option("--debug-help", action='store_true', help="Print help on debug flags") option("--debug-flags", metavar="FLAG[,FLAG]", action='append', split=',', help="Sets the flags for debug output (-FLAG disables a flag)") option("--debug-start", metavar="TIME", type='int', help="Start debug output at TIME (must be in ticks)") option("--debug-file", metavar="FILE", default="cout", help="Sets the output file for debug [Default: %default]") option("--debug-ignore", metavar="EXPR", action='append', split=':', help="Ignore EXPR sim objects") option("--remote-gdb-port", type='int', default=7000, help="Remote gdb base port (set to 0 to disable listening)") # Help options group("Help Options") option("--list-sim-objects", action='store_true', default=False, help="List all built-in SimObjects, their params and default values") # load the options.py config file to allow people to set their own # default options options_file = config.get('options.py') if options_file: scope = { 'options' : options } execfile(options_file, scope) arguments = options.parse_args() return options,arguments
import logging import os import sys from __init__ import get_version from config import Config from episode import Episode from errors import * from logs import start_logging from main import TvRenamr from options import OptionParser log = logging.getLogger("Core") parser = OptionParser(usage="tvr [options] <file/folder>", version="Tv Renamr %s" % get_version()) options, args = parser.parse_args() class FrontEnd: def __init__(self, path): # start logging if options.debug: options.log_level = 10 start_logging(options.log_file, options.log_level, options.quiet) possible_config = ( options.config, os.path.expanduser("~/.tvrenamr/config.yml"), os.path.join(sys.path[0], "config.yml"), )
def parse_options(): import config from options import OptionParser options = OptionParser(usage=usage, version=version, description=brief_copyright) option = options.add_option group = options.set_group # Help options option('-B', "--build-info", action="store_true", default=False, help="Show build information") option('-C', "--copyright", action="store_true", default=False, help="Show full copyright information") option('-R', "--readme", action="store_true", default=False, help="Show the readme") # Options for configuring the base simulator option('-d', "--outdir", metavar="DIR", default="m5out", help="Set the output directory to DIR [Default: %default]") option('-r', "--redirect-stdout", action="store_true", default=False, help="Redirect stdout (& stderr, without -e) to file") option('-e', "--redirect-stderr", action="store_true", default=False, help="Redirect stderr to file") option("--stdout-file", metavar="FILE", default="simout", help="Filename for -r redirection [Default: %default]") option("--stderr-file", metavar="FILE", default="simerr", help="Filename for -e redirection [Default: %default]") option('-i', "--interactive", action="store_true", default=False, help="Invoke the interactive interpreter after running the script") option("--pdb", action="store_true", default=False, help="Invoke the python debugger before running the script") option('-p', "--path", metavar="PATH[:PATH]", action='append', split=':', help="Prepend PATH to the system path when invoking the script") option('-q', "--quiet", action="count", default=0, help="Reduce verbosity") option('-v', "--verbose", action="count", default=0, help="Increase verbosity") option('-m', "--m5mbridge", "--mcpat", metavar="[ARG,...]", action="append", split=',', dest="m5mbridge", help="Load the M5M-bridge module. See its documentation for details. Optionally you can pass arguments to the m5mbridge. To do this you have to use either -m'key1=val1,key2=val2 or --m5mbridge='key1=val1,key2=val2' notation. The key and value are standard optional arguments in standard UNIX notation. Only the comma is special, because it's use to split the optional arguments.") # optparse does not support optional arguments to parameters. To make the # common case easier where one does not need to pass any arguments to the # m5mbridge, we change the commands to the correct syntax here: if '--m5mbridge' in sys.argv or '--mcpat' in sys.argv: idx = sys.argv.index('--m5mbridge') sys.argv[idx] = '--m5mbridge=' if '-m' in sys.argv: idx = sys.argv.index('-m') sys.argv.insert(idx+1, '') # Statistics options group("Statistics Options") option("--stats-file", metavar="FILE", default="stats.txt", help="Sets the output file for statistics [Default: %default]") # Configuration Options group("Configuration Options") option("--dump-config", metavar="FILE", default="config.ini", help="Dump configuration output file [Default: %default]") option("--json-config", metavar="FILE", default="config.json", help="Create JSON output of the configuration [Default: %default]") option("--dot-config", metavar="FILE", default="config.dot", help="Create DOT & pdf outputs of the configuration [Default: %default]") # Debugging options group("Debugging Options") option("--debug-break", metavar="TIME[,TIME]", action='append', split=',', help="Cycle to create a breakpoint") option("--debug-help", action='store_true', help="Print help on trace flags") option("--debug-flags", metavar="FLAG[,FLAG]", action='append', split=',', help="Sets the flags for tracing (-FLAG disables a flag)") option("--remote-gdb-port", type='int', default=7000, help="Remote gdb base port (set to 0 to disable listening)") # Tracing options group("Trace Options") option("--trace-start", metavar="TIME", type='int', help="Start tracing at TIME (must be in ticks)") option("--trace-file", metavar="FILE", default="cout", help="Sets the output file for tracing [Default: %default]") option("--trace-ignore", metavar="EXPR", action='append', split=':', help="Ignore EXPR sim objects") # Help options group("Help Options") option("--list-sim-objects", action='store_true', default=False, help="List all built-in SimObjects, their params and default values") # load the options.py config file to allow people to set their own # default options options_file = config.get('options.py') if options_file: scope = { 'options' : options } execfile(options_file, scope) arguments = options.parse_args() return options,arguments