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

def create_tarball ( fileobj , path , callback = None ) : tar_cmd = ( 'tar -zc --directory=%(path)s .' % locals ( ) ) tar_proc = make_subprocess ( tar_cmd , stdout = True , stderr = True ) while True : chunk = tar_proc . stdout . read ( CHUNK_SIZE ) if ( chunk == '' ) : break if callback : callback ( chunk ) if fileobj : fileobj . write ( chunk ) finish_subprocess ( tar_proc , tar_cmd )
create a tarball from a given path .