main.py (5512:755fcaf7a4cf) | main.py (5524:e5fbd38bc828) |
---|---|
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 --- 68 unchanged lines hidden (view full) --- 77add_option('-R', "--readme", action="store_true", default=False, 78 help="Show the readme") 79add_option('-N', "--release-notes", action="store_true", default=False, 80 help="Show the release notes") 81 82# Options for configuring the base simulator 83add_option('-d', "--outdir", metavar="DIR", default=".", 84 help="Set the output directory to DIR [Default: %default]") | 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 --- 68 unchanged lines hidden (view full) --- 77add_option('-R', "--readme", action="store_true", default=False, 78 help="Show the readme") 79add_option('-N', "--release-notes", action="store_true", default=False, 80 help="Show the release notes") 81 82# Options for configuring the base simulator 83add_option('-d', "--outdir", metavar="DIR", default=".", 84 help="Set the output directory to DIR [Default: %default]") |
85add_option('-r', "--redirect-stdout", action="store_true", default=False, 86 help="Redirect stdout (& stderr, without -e) to file") 87add_option('-e', "--redirect-stderr", action="store_true", default=False, 88 help="Redirect stderr to file") 89add_option("--stdout-file", metavar="FILE", default="simout", 90 help="Filename for -r redirection [Default: %default]") 91add_option("--stderr-file", metavar="FILE", default="simerr", 92 help="Filename for -e redirection [Default: %default]") |
|
85add_option('-i', "--interactive", action="store_true", default=False, 86 help="Invoke the interactive interpreter after running the script") 87add_option("--pdb", action="store_true", default=False, 88 help="Invoke the python debugger before running the script") 89add_option('-p', "--path", metavar="PATH[:PATH]", action='append', split=':', 90 help="Prepend PATH to the system path when invoking the script") 91add_option('-q', "--quiet", action="count", default=0, 92 help="Reduce verbosity") --- 40 unchanged lines hidden (view full) --- 133 # default options 134 options_file = config.get('options.py') 135 if options_file: 136 scope = { 'options' : options } 137 execfile(options_file, scope) 138 139 arguments = options.parse_args() 140 | 93add_option('-i', "--interactive", action="store_true", default=False, 94 help="Invoke the interactive interpreter after running the script") 95add_option("--pdb", action="store_true", default=False, 96 help="Invoke the python debugger before running the script") 97add_option('-p', "--path", metavar="PATH[:PATH]", action='append', split=':', 98 help="Prepend PATH to the system path when invoking the script") 99add_option('-q', "--quiet", action="count", default=0, 100 help="Reduce verbosity") --- 40 unchanged lines hidden (view full) --- 141 # default options 142 options_file = config.get('options.py') 143 if options_file: 144 scope = { 'options' : options } 145 execfile(options_file, scope) 146 147 arguments = options.parse_args() 148 |
149 if not os.path.isdir(options.outdir): 150 os.makedirs(options.outdir) 151 152 # These filenames are used only if the redirect_std* options are set 153 stdout_file = os.path.join(options.outdir, options.stdout_file) 154 stderr_file = os.path.join(options.outdir, options.stderr_file) 155 156 # Print redirection notices here before doing any redirection 157 if options.redirect_stdout and not options.redirect_stderr: 158 print "Redirecting stdout and stderr to", stdout_file 159 else: 160 if options.redirect_stdout: 161 print "Redirecting stdout to", stdout_file 162 if options.redirect_stderr: 163 print "Redirecting stderr to", stderr_file 164 165 # Now redirect stdout/stderr as desired 166 if options.redirect_stdout: 167 redir_fd = os.open(stdout_file, os. O_WRONLY | os.O_CREAT | os.O_TRUNC) 168 os.dup2(redir_fd, sys.stdout.fileno()) 169 if not options.redirect_stderr: 170 os.dup2(redir_fd, sys.stderr.fileno()) 171 172 if options.redirect_stderr: 173 redir_fd = os.open(stderr_file, os. O_WRONLY | os.O_CREAT | os.O_TRUNC) 174 os.dup2(redir_fd, sys.stderr.fileno()) 175 |
|
141 done = False 142 143 if options.build_info: 144 done = True 145 print 'Build information:' 146 print 147 print 'compiled %s' % internal.core.cvar.compileDate; 148 print 'started %s' % datetime.datetime.now().ctime() --- 185 unchanged lines hidden --- | 176 done = False 177 178 if options.build_info: 179 done = True 180 print 'Build information:' 181 print 182 print 'compiled %s' % internal.core.cvar.compileDate; 183 print 'started %s' % datetime.datetime.now().ctime() --- 185 unchanged lines hidden --- |