def get_amalgamation():
 if os.path.exists(AMALGAMATION_ROOT):
  return
 os.mkdir(AMALGAMATION_ROOT)
 print 'Downloading amalgation.'
 download_page = urllib.urlopen('http://sqlite.org/download.html').read()
 pattern = re.compile('(sqlite-amalgamation.*?\\.zip)')
 download_file = pattern.findall(download_page)[0]
 amalgamation_url = ('http://sqlite.org/' + download_file)
 urllib.urlretrieve(amalgamation_url, 'tmp.zip')
 zf = zipfile.ZipFile('tmp.zip')
 files = ['sqlite3.c', 'sqlite3.h']
 for fn in files:
  print 'Extracting', fn
  outf = open(((AMALGAMATION_ROOT + os.sep) + fn), 'wb')
  outf.write(zf.read(fn))
  outf.close()
 zf.close()
 os.unlink('tmp.zip')

def get_amalgamation ( ) : if os . path . exists ( AMALGAMATION_ROOT ) : return os . mkdir ( AMALGAMATION_ROOT ) print 'Downloading amalgation.' download_page = urllib . urlopen ( 'http://sqlite.org/download.html' ) . read ( ) pattern = re . compile ( '(sqlite-amalgamation.*?\\.zip)' ) download_file = pattern . findall ( download_page ) [ 0 ] amalgamation_url = ( 'http://sqlite.org/' + download_file ) urllib . urlretrieve ( amalgamation_url , 'tmp.zip' ) zf = zipfile . ZipFile ( 'tmp.zip' ) files = [ 'sqlite3.c' , 'sqlite3.h' ] for fn in files : print 'Extracting' , fn outf = open ( ( ( AMALGAMATION_ROOT + os . sep ) + fn ) , 'wb' ) outf . write ( zf . read ( fn ) ) outf . close ( ) zf . close ( ) os . unlink ( 'tmp.zip' )
download the sqlite amalgamation if it isnt there .