3 # Wrapper for python2 and python3 around compileall to raise exception
4 # when a python byte code generation failed.
7 # http://stackoverflow.com/questions/615632/how-to-detect-errors-from-compileall-compile-dir
9 from __future__
import print_function
15 def __nonzero__(self
):
16 type, value
, traceback
= sys
.exc_info()
17 if type is not None and issubclass(type, py_compile
.PyCompileError
):
18 print("Cannot compile %s" %value
.file)
22 report_problem
= ReportProblem()
24 compileall
.compile_dir(sys
.argv
[1], quiet
=report_problem
)