def AddAdditionalOptions(self, parser): """Add any additional options besides the default for all *_dir.py scripts.""" cmd_options.processor(parser, '') cmd_options.simhome(parser, '') cmd_options.sim_options(parser, '') cmd_options.verify(parser, '')
def AddVerifyOptions(self, parser): """ Add the options which used for LIT file verification. @param parser Optparse object @return No return value """ # Top level command line options which only apply to the LIT file verification phase. # verify_LIT_group = cmd_options.VerifyLITPhaseGroup(parser) # cmd_options.archsim_cf_file(parser, verify_LIT_group) cmd_options.archsim_config_dir(parser, verify_LIT_group) cmd_options.simhome(parser, verify_LIT_group) cmd_options.sim_options(parser, verify_LIT_group) cmd_options.processor(parser, verify_LIT_group) parser.add_option_group(verify_LIT_group)
def GetOptions(): """Get users command line options.""" version = '$Revision: 1.20 $' version = version.replace(' ', '') ver = version.replace(' $', '') us = '%prog [options] app_version compiler_version input_name platform program_name' desc = \ 'Renames tracing files generated by PinPlay tools to conform to the GTR requirements. ' \ 'There are 5 arguments required to run the script. Details are given below in the ' \ 'section \'Required arguments\'.' # Print arguments passed to the script. # # import pdb; pdb.set_trace() msg.PrintMsgNoCR('Script args: '), for string in sys.argv[1:]: msg.PrintMsgNoCR(string + ' '), msg.PrintMsg('') msg.PrintMsg('') util.CheckNonPrintChar(sys.argv) parser = optparse.OptionParser( usage=us, version=ver, description=desc, formatter=cmd_options.BlankLinesIndentedHelpFormatter()) # Command line options to control the scripts behavior. # # import pdb; pdb.set_trace() cmd_options.config_file(parser) cmd_options.debug(parser) cmd_options.date(parser, '') cmd_options.processor(parser, '') cmd_options.verbose(parser) # Define a separate option group for the require arguments. # required_opts = cmd_options.RenameRequiredOpts(parser) cmd_options.app_version(parser, required_opts) cmd_options.compiler_version(parser, required_opts) cmd_options.input_name(parser, required_opts) cmd_options.platform(parser, required_opts) cmd_options.program_name(parser, required_opts) parser.add_option_group(required_opts) (options, args) = parser.parse_args() # Read in the configuration file. # Config.GetCfgGlobals(options, True) # 2 required parameters are needed # Ensure the required variables are defined. # CheckRequiredVariables(options) # If the user didn't give a date, use the current date. # if options.date == '': today = datetime.date.today() options.date = today.strftime('%y%m') CheckField(options.date) # If user didn't give a separate processor name, get it from the platform info. # if options.processor == '': # Use the first 3 char as the processor type options.processor = options.platform[:3] CheckField(options.processor) return options
def ParseCommandLine(self): """ Process command line arguments. Generate pin and tool options, and their paths. """ # import pdb; pdb.set_trace() version = '$Revision: 1.14 $' version = version.replace(' ', '') ver = version.replace(' $', '') us = '%prog [options] trace_basename \nVersion: ' + ver desc = 'Run a simulator on a trace.' util.CheckNonPrintChar(sys.argv) parser = optparse.OptionParser(usage=us, version=ver, description=desc) # Define the command line options which control the behavior of the # script. # # Some of these methods take a 2nd argument which is the empty string # ''. If this script used option groups, then the 2nd parameter would # be the group. However, this script does not use option groups, so # the argument is empty. # cmd_options.config_file(parser) cmd_options.debug(parser) cmd_options.global_file(parser) cmd_options.list(parser, '') cmd_options.processor(parser, '') cmd_options.save_global(parser) cmd_options.simhome(parser, '') cmd_options.sim_options(parser, '') cmd_options.trace_basename(parser) cmd_options.verbose(parser) cmd_options.verify(parser, '') self.AddAdditionalCmdOptions(parser) # import pdb; pdb.set_trace() (options, args) = parser.parse_args() # Check to make sure the trace basename has been given as an argument. # # import pdb; pdb.set_trace() if len(sys.argv) == 1 or len(args) == 0: msg.PrintMsg( "ERROR: Must have a trace basename on the command line.\n" "Usage: %s [options] trace_basename" % os.path.basename(sys.argv[0])) util.CheckResult(-1, options, 'Checking command line options') options.trace_basename = args[0] # Read in optional configuration files and set global variables. # config_obj = config.ConfigClass() config_obj.GetCfgGlobals(options, False) # Don't need all 4 required parameters # Just need this parameter. # self.Config.CheckRequiredParameter('processor') # Initialize the kit after reading in parameters, in case the user # specified anything which is used to intialize the kit. # self.kit = self.GetKit() return options