def extract_tarball(fileobj, path, callback=None):
 tar_cmd = ('tar -zx --directory=%(path)s' % locals())
 tar_proc = make_subprocess(tar_cmd, stderr=True, stdin=True)
 while True:
  chunk = fileobj.read(CHUNK_SIZE)
  if (chunk == ''):
   break
  if callback:
   callback(chunk)
  tar_proc.stdin.write(chunk)
 finish_subprocess(tar_proc, tar_cmd)

def extract_tarball ( fileobj , path , callback = None ) : tar_cmd = ( 'tar -zx --directory=%(path)s' % locals ( ) ) tar_proc = make_subprocess ( tar_cmd , stderr = True , stdin = True ) while True : chunk = fileobj . read ( CHUNK_SIZE ) if ( chunk == '' ) : break if callback : callback ( chunk ) tar_proc . stdin . write ( chunk ) finish_subprocess ( tar_proc , tar_cmd )
extract a tarball to a given path .