<s> """<STR_LIT>""" <EOL> from __future__ import print_function , division <EOL> import sys <EOL> import os <EOL> import fnmatch <EOL> import datetime <EOL> tpl = """<STR_LIT>""" <EOL> def makeprj ( libpath ) : <EOL> prj = tpl . format ( <EOL> date = datetime . datetime . utcnow ( ) . strftime ( "<STR_LIT>" ) ) <EOL> count = <NUM_LIT:1> <EOL> for dirpath , dirnames , files in os . walk ( libpath ) : <EOL> dirnames . sort ( ) <EOL> for f in fnmatch . filter ( sorted ( files ) , "<STR_LIT>" ) : <EOL> path = os . path . join ( dirpath , os . path . splitext ( f ) [ <NUM_LIT:0> ] ) <EOL> path = path . replace ( "<STR_LIT:\\>" , "<STR_LIT:/>" ) <EOL> prj += "<STR_LIT>" . format ( count , path ) <EOL> count += <NUM_LIT:1> <EOL> return prj <EOL> def writeprj ( libpath , prjpath ) : <EOL> prj = makeprj ( libpath ) <EOL> with open ( prjpath , "<STR_LIT:w>" ) as f : <EOL> f . write ( prj ) <EOL> def checkprj ( libpath , prjpath ) : <EOL> prj = makeprj ( libpath ) . splitlines ( ) <EOL> with open ( prjpath , "<STR_LIT:r>" ) as f : <EOL> oldprj = f . read ( ) . splitlines ( ) <EOL> return prj [ <NUM_LIT:1> : ] == oldprj [ <NUM_LIT:1> : ] <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> if len ( sys . argv ) in ( <NUM_LIT:3> , <NUM_LIT:4> ) : <EOL> libpath = sys . argv [ <NUM_LIT:1> ] <EOL> prjpath = sys . argv [ <NUM_LIT:2> ] <EOL> if len ( sys . argv ) == <NUM_LIT:3> : <EOL> writeprj ( libpath , prjpath ) <EOL> elif len ( sys . argv ) == <NUM_LIT:4> and sys . argv [ <NUM_LIT:3> ] == "<STR_LIT>" : <EOL> if checkprj ( libpath , prjpath ) : <EOL> print ( "<STR_LIT>" <EOL> . format ( prjpath , libpath ) ) <EOL> sys . exit ( <NUM_LIT:0> ) <EOL> else : <EOL> print ( "<STR_LIT>" <EOL> . format ( prjpath , libpath ) , file = sys . stderr ) <EOL> print ( "<STR_LIT>" , <EOL> file = sys . stderr ) <EOL> sys . exit ( <NUM_LIT:1> ) <EOL> else : <EOL> print ( "<STR_LIT>" <EOL> . format ( sys . argv [ <NUM_LIT:0> ] ) ) <EOL> sys . exit ( <NUM_LIT:1> ) </s>
