11 python -t -t -W all -c "import py_compile; py_compile.compile ('%(filename)s', doraise=False)" """
12 compileCommand = commandTemplate % {"filename": file}
13 (status, text) = commands.getstatusoutput (compileCommand)
15 passed = len(text) == 0
18 output = ("Syntax is correct for "+file) if verbose else ""
20 output = ("Syntax is invalid for %s\n" % file) if verbose else ""
22 return (passed, output)
25 if __name__ == "__main__":
30 opar = optparse.OptionParser()
31 opar.add_option("-v", "--verbose", dest="verbose", help="Toggle verbosity", action="store_true", default=False)
32 options, args = opar.parse_args(sys.argv[1:])
33 verbose = options.verbose
38 passed, output = syntax_test(filename)
42 completeOutput.append(output)
43 print "\n".join(completeOutput)
45 sys.exit(0 if allPassed else 1);