Files
ResInsight/ThirdParty/Ert/devel/cmake/cmake_pyc_tree
Jacob Støren 4be58edf78 MSW code reverted. Regrettfully the work has to be reconsidered.
Both ERT and the resinsight code is rolled back to before MSW was introduced as refined.
p4#: 21999
2013-06-25 15:53:19 +02:00

32 lines
885 B
Python

#!/usr/bin/env python
import py_compile
import os
import sys
import os.path
# Small 'python compiler' used in the build system for ert. The
# commandline argument should be the top level name of directory
# containing python source code. The 'compiler' will walk through the
# tree and in-place compile all the python files.
root_path = sys.argv[1]
for (root , dir_list , file_list) in os.walk( root_path ):
for file in file_list:
full_path = os.path.join( root , file )
(tmp , ext) = os.path.splitext( full_path )
if ext == ".py":
py_file = full_path
try:
print "Compiling: %s" % py_file
py_compile.compile( py_file , doraise = True )
except Exception,error:
sys.exit("py_compile(%s) failed:%s" % (py_file , error))
sys.exit(0)