X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/39236c6e673c41db228275375ab7fdb0f837b292..c18c124eaa464aaaa5549e99e5a70fc9cbb50944:/tools/lldbmacros/core/syntax_checker.py diff --git a/tools/lldbmacros/core/syntax_checker.py b/tools/lldbmacros/core/syntax_checker.py index 223b1e988..f9a7142b5 100755 --- a/tools/lldbmacros/core/syntax_checker.py +++ b/tools/lldbmacros/core/syntax_checker.py @@ -17,12 +17,12 @@ tabs_search_rex = re.compile("^\s*\t+",re.MULTILINE|re.DOTALL) if __name__ == "__main__": if len(sys.argv) < 2: - print "Error: Unknown arguments" + print >>sys.stderr, "Error: Unknown arguments" print helpdoc sys.exit(1) for fname in sys.argv[1:]: if not os.path.exists(fname): - print "Error: Cannot recognize %s as a file" % fname + print >>sys.stderr, "Error: Cannot recognize %s as a file" % fname sys.exit(1) if fname.split('.')[-1] != 'py': print "Note: %s is not a valid python file. Skipping." % fname @@ -34,17 +34,17 @@ if __name__ == "__main__": for linedata in strdata: lineno += 1 if len(tabs_search_rex.findall(linedata)) > 0 : - print "Error: Found a TAB character at %s:%d" % (fname, lineno) + print >>sys.stderr, "Error: Found a TAB character at %s:%d" % (fname, lineno) tab_check_status = False if tab_check_status == False: - print "Error: Syntax check failed. Please fix the errors and try again." + print >>sys.stderr, "Error: Syntax check failed. Please fix the errors and try again." sys.exit(1) #now check for error in compilation try: compile_result = py_compile.compile(fname, cfile="/dev/null", doraise=True) except py_compile.PyCompileError as exc: print str(exc) - print "Error: Compilation failed. Please fix the errors and try again." + print >>sys.stderr, "Error: Compilation failed. Please fix the errors and try again." sys.exit(1) print "Success: Checked %s. No syntax errors found." % fname sys.exit(0)