From 850845415e0b615fdc1b7f42cdb430e931ffcd5e Mon Sep 17 00:00:00 2001 From: Douglas Clowes Date: Mon, 29 Sep 2014 11:41:56 +1000 Subject: [PATCH] Reduce some of the noise in the logfile --- site_ansto/instrument/util/gen_sct.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/site_ansto/instrument/util/gen_sct.py b/site_ansto/instrument/util/gen_sct.py index b77a2b56..9b755782 100755 --- a/site_ansto/instrument/util/gen_sct.py +++ b/site_ansto/instrument/util/gen_sct.py @@ -1686,7 +1686,9 @@ def generate_driver(MyDriver): print "Function:", f, "Type:", MyDriver['Funcs'][f]['type'], '#Uses:', MyDriver['Funcs'][f]['reference_count'] for l in MyDriver['Funcs'][f]['text']: print " ", l - print "Produced file %s with %d lines." % ( MyDriver['filename'], NumberOfLinesOut) + if Verbose: + print "Produced file %s with %d lines." % \ + ( MyDriver['filename'], NumberOfLinesOut) # This block of code generates shell commands to help the old->new rename if Move: fd = open("git_mv.sh", "a") @@ -1718,6 +1720,7 @@ def process_drivers(TheDrivers): generate_driver(MyDriver) def process_source(source_files): + global lexer, yaccer global PathName global TheDrivers global NumberOfLinesIn @@ -1734,7 +1737,7 @@ def process_source(source_files): # Build the parser # #yaccer = yacc.yacc(tabmodule="gen_sct",outputdir="/tmp",write_tables=0,debug=0) - yaccer = yacc.yacc() + yaccer = yacc.yacc(debug=0) for source_file in source_files: PathName = os.path.realpath(os.path.abspath(os.path.dirname(source_file))) @@ -1745,8 +1748,9 @@ def process_source(source_files): start_line = lexer.lineno yaccer.parse(data) stop_line = lexer.lineno - print 'Consumed file %s with %d lines (%d, %d)' % (source_file, - NumberOfLinesIn, start_line, stop_line - 1) + if Verbose: + print 'Consumed file %s with %d lines (%d, %d)' % \ + (source_file, NumberOfLinesIn, start_line, stop_line - 1) lexer.lineno = 1 process_drivers(TheDrivers) @@ -1756,6 +1760,7 @@ def main(): global Move global DriverDump global CodeDump + global args import argparse parser = argparse.ArgumentParser() @@ -1769,7 +1774,8 @@ def main(): action="store_true") parser.add_argument("driver_source", help="driver source file", nargs="*") args = parser.parse_args() - print args + if args.verbose: + print args if args.code: CodeDump = True else: