#NEWLINE# def sync_main( file , apps ) : #NEWLINE# #INDENT# d = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# for app in apps : #NEWLINE# #INDENT# path = ( 'applications/%s/' % app ) #NEWLINE# findT ( path , file ) #NEWLINE# langfile = open ( os . path . join ( path , 'languages' , ( '%s.py' % file ) ) ) #NEWLINE# try : #NEWLINE# #INDENT# data = eval ( langfile . read ( ) ) #NEWLINE# #UNINDENT# finally : #NEWLINE# #INDENT# langfile . close ( ) #NEWLINE# #UNINDENT# d = sync_language ( d , data ) #NEWLINE# #UNINDENT# path = ( 'applications/%s/' % apps [ ( - 1 ) ] ) #NEWLINE# file1 = os . path . join ( path , 'languages' , ( '%s.py' % file ) ) #NEWLINE# f = open ( file1 , 'w' ) #NEWLINE# try : #NEWLINE# #INDENT# f . write ( '# coding: utf8\n' ) #NEWLINE# f . write ( '{\n' ) #NEWLINE# keys = d . keys ( ) #NEWLINE# keys . sort ( ) #NEWLINE# for key in keys : #NEWLINE# #INDENT# f . write ( ( "'''%s''':'''%s''',\n" % ( key . replace ( "'" , "\\'" ) , str ( d [ key ] . replace ( "'" , "\\'" ) ) ) ) ) #NEWLINE# #UNINDENT# f . write ( '}\n' ) #NEWLINE# #UNINDENT# finally : #NEWLINE# #INDENT# f . close ( ) #NEWLINE# #UNINDENT# oapps = reversed ( apps [ : ( - 1 ) ] ) #NEWLINE# for app in oapps : #NEWLINE# #INDENT# path2 = ( 'applications/%s/' % app ) #NEWLINE# file2 = os . path . join ( path2 , 'languages' , ( '%s.py' % file ) ) #NEWLINE# if ( file1 != file2 ) : #NEWLINE# #INDENT# shutil . copyfile ( apps , file2 )