|
@@ -12,6 +12,7 @@ import py_compile
|
|
import compileall
|
|
import compileall
|
|
import argparse
|
|
import argparse
|
|
|
|
|
|
|
|
+
|
|
def check_for_errors(comparison):
|
|
def check_for_errors(comparison):
|
|
'''Wrap comparison operator with code checking for PyCompileError.
|
|
'''Wrap comparison operator with code checking for PyCompileError.
|
|
If PyCompileError was raised, re-raise it again to abort execution,
|
|
If PyCompileError was raised, re-raise it again to abort execution,
|
|
@@ -28,6 +29,7 @@ def check_for_errors(comparison):
|
|
|
|
|
|
return operator
|
|
return operator
|
|
|
|
|
|
|
|
+
|
|
class ReportProblem(int):
|
|
class ReportProblem(int):
|
|
'''Class that pretends to be an int() object but implements all of its
|
|
'''Class that pretends to be an int() object but implements all of its
|
|
comparison operators such that it'd detect being called in
|
|
comparison operators such that it'd detect being called in
|
|
@@ -55,6 +57,7 @@ class ReportProblem(int):
|
|
def __ne__(self, other):
|
|
def __ne__(self, other):
|
|
return not self == other
|
|
return not self == other
|
|
|
|
|
|
|
|
+
|
|
parser = argparse.ArgumentParser(description='Compile Python source files in a directory tree.')
|
|
parser = argparse.ArgumentParser(description='Compile Python source files in a directory tree.')
|
|
parser.add_argument("target", metavar='DIRECTORY',
|
|
parser.add_argument("target", metavar='DIRECTORY',
|
|
help='Directory to scan')
|
|
help='Directory to scan')
|