Make pdb debugging of openreviews possible.

This allows dropping into pdb while still using genresults-openreviews
which I found useful.

Change-Id: I2dbd2ce773b097248291c7c0897fa02539f1eddc
This commit is contained in:
Robert Collins 2014-09-03 12:43:07 +12:00
parent bff6394a8a
commit 2924696365
2 changed files with 17 additions and 5 deletions

View File

@ -26,8 +26,8 @@ metadata() {
for project in ${projects} ; do
project_base=$(basename $(echo ${project} | cut -f1 -d'.'))
(metadata && openreviews -p ${project} -l 15 ${EXTRA_ARGS}) > results/${project_base}-openreviews.txt
openreviews -p ${project} --html -l 15 ${EXTRA_ARGS} > results/${project_base}-openreviews.html
(metadata > results/${project_base}-openreviews.txt && openreviews -p ${project} -l 15 ${EXTRA_ARGS} -o results/${project_base}-openreviews.txt)
openreviews -p ${project} --html -l 15 ${EXTRA_ARGS} -o results/${project_base}-openreviews.html
(metadata && openapproved -p ${project} ${EXTRA_ARGS}) > results/${project_base}-openapproved.txt
done

View File

@ -270,6 +270,10 @@ def main(argv=None):
optparser.add_option(
'--projects-dir', default='./projects',
help='Directory where to locate the project files')
optparser.add_option(
'--output', '-o', default='-',
help="Where to write output. - for stdout. The file will be appended"
" if it exists.")
options, args = optparser.parse_args()
@ -329,7 +333,15 @@ def main(argv=None):
stats = gen_stats(projects, waiting_on_reviewer, waiting_on_submitter,
options)
if options.html:
print_stats_html(stats)
if options.output == '-':
output = sys.stdout
else:
print_stats_txt(stats)
output = open(options.output, 'at')
try:
if options.html:
print_stats_html(stats, f=output)
else:
print_stats_txt(stats, f=output)
finally:
if output is not sys.stdout:
output.close()