def update_md5(filenames):
 import re
 from md5 import md5
 for name in filenames:
  base = os.path.basename(name)
  f = open(name, 'rb')
  md5_data[base] = md5(f.read()).hexdigest()
  f.close()
 data = [('    %r: %r,\n' % it) for it in md5_data.items()]
 data.sort()
 repl = ''.join(data)
 import inspect
 srcfile = inspect.getsourcefile(sys.modules[__name__])
 f = open(srcfile, 'rb')
 src = f.read()
 f.close()
 match = re.search('\nmd5_data = {\n([^}]+)}', src)
 if (not match):
  print >>sys.stderr, 'Internal error!'
  sys.exit(2)
 src = ((src[:match.start(1)] + repl) + src[match.end(1):])
 f = open(srcfile, 'w')
 f.write(src)
 f.close()

def update_md5 ( filenames ) : import re from md5 import md5 for name in filenames : base = os . path . basename ( name ) f = open ( name , 'rb' ) md5_data [ base ] = md5 ( f . read ( ) ) . hexdigest ( ) f . close ( ) data = [ ( '    %r: %r,\n' % it ) for it in md5_data . items ( ) ] data . sort ( ) repl = '' . join ( data ) import inspect srcfile = inspect . getsourcefile ( sys . modules [ __name__ ] ) f = open ( srcfile , 'rb' ) src = f . read ( ) f . close ( ) match = re . search ( '\nmd5_data = {\n([^}]+)}' , src ) if ( not match ) : print >> sys . stderr , 'Internal error!' sys . exit ( 2 ) src = ( ( src [ : match . start ( 1 ) ] + repl ) + src [ match . end ( 1 ) : ] ) f = open ( srcfile , 'w' ) f . write ( src ) f . close ( )
update our built-in md5 registry .