<s> """<STR_LIT>""" <EOL> import logging <EOL> import os <EOL> import subprocess <EOL> def MakeProto ( ) : <EOL> """<STR_LIT>""" <EOL> cwd = os . path . dirname ( os . path . abspath ( __file__ ) ) <EOL> protos_to_compile = [ ] <EOL> for ( root , _ , files ) in os . walk ( cwd ) : <EOL> for filename in files : <EOL> full_filename = os . path . join ( root , filename ) <EOL> if full_filename . endswith ( "<STR_LIT>" ) : <EOL> proto_stat = os . stat ( full_filename ) <EOL> try : <EOL> pb2_stat = os . stat ( full_filename . rsplit ( "<STR_LIT:.>" , <NUM_LIT:1> ) [ <NUM_LIT:0> ] + "<STR_LIT>" ) <EOL> if pb2_stat . st_mtime >= proto_stat . st_mtime : <EOL> continue <EOL> except ( OSError , IOError ) : <EOL> pass <EOL> protos_to_compile . append ( full_filename ) <EOL> if protos_to_compile : <EOL> protoc = os . environ . get ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> try : <EOL> output = subprocess . check_output ( [ protoc , "<STR_LIT>" ] ) <EOL> except ( IOError , OSError ) : <EOL> raise RuntimeError ( "<STR_LIT>" <EOL> "<STR_LIT>" , protoc ) <EOL> if "<STR_LIT>" not in output : <EOL> raise RuntimeError ( "<STR_LIT>" <EOL> "<STR_LIT>" % output ) <EOL> for proto in protos_to_compile : <EOL> logging . info ( "<STR_LIT>" , proto ) <EOL> subprocess . check_call ( <EOL> [ protoc , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , <EOL> os . path . relpath ( proto , cwd ) <EOL> ] , cwd = cwd ) <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> root_logger = logging . getLogger ( ) <EOL> root_logger . setLevel ( logging . INFO ) <EOL> MakeProto ( ) </s>
