<s> import os , glob <EOL> pythondirs = [ <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> ] <EOL> tcldirs = [ <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> ] <EOL> def find_in_file ( fn , search , column = None ) : <EOL> '''<STR_LIT>''' <EOL> r = False <EOL> if not os . path . exists ( fn ) : <EOL> return r <EOL> f = open ( fn , "<STR_LIT:r>" ) <EOL> for line in f : <EOL> if line [ : len ( search ) ] != search : <EOL> continue <EOL> r = True <EOL> if column is not None : <EOL> r = line . split ( ) [ column ] <EOL> break <EOL> f . close ( ) <EOL> return r <EOL> def main ( ) : <EOL> versions = [ ] <EOL> for d in pythondirs : <EOL> fn = "<STR_LIT>" % d <EOL> ver = find_in_file ( fn , '<STR_LIT>' , <NUM_LIT:2> ) <EOL> if ver : <EOL> ver = ver . strip ( '<STR_LIT:">' ) <EOL> versions . append ( ( d , ver ) ) <EOL> for e in glob . iglob ( "<STR_LIT>" % d ) : <EOL> ver = find_in_file ( e , '<STR_LIT>' , <NUM_LIT:1> ) <EOL> if ver : <EOL> versions . append ( ( e , ver ) ) <EOL> for e in glob . iglob ( "<STR_LIT>" % d ) : <EOL> ver = find_in_file ( e , '<STR_LIT>' , <NUM_LIT:1> ) <EOL> if ver : <EOL> versions . append ( ( e , ver ) ) <EOL> for d in tcldirs : <EOL> fn = "<STR_LIT>" % d <EOL> ver = find_in_file ( fn , '<STR_LIT>' , <NUM_LIT:2> ) <EOL> if ver : <EOL> versions . append ( ( d , ver ) ) <EOL> for ( d , ver ) in versions : <EOL> print "<STR_LIT>" % ( ver , d ) <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> main ( ) </s>
