def unpack_tarball(tar_filename, dest_path):
 if os.path.exists(tar_filename):
  if file_access_rights(dest_path, os.W_OK, check_above=False):
   try:
    this_tar_file = tarfile.open(tar_filename, 'r:bz2')
   except Exception as e:
    raise IOError(("[tar] cannot open '%s'" % tar_filename))
   else:
    try:
     this_tar_file.extractall(dest_path)
    except Exception as e:
     raise IOError(("[tar] error while extracting '%s'" % tar_filename))
    else:
     pass
  else:
   raise IOError(("[tar] no right access to '%s'" % dest_path))
 else:
  raise IOError(("'%s' not found" % tar_filename))

def unpack_tarball ( tar_filename , dest_path ) : if os . path . exists ( tar_filename ) : if file_access_rights ( dest_path , os . W_OK , check_above = False ) : try : this_tar_file = tarfile . open ( tar_filename , 'r:bz2' ) except Exception as e : raise IOError ( ( "[tar] cannot open '%s'" % tar_filename ) ) else : try : this_tar_file . extractall ( dest_path ) except Exception as e : raise IOError ( ( "[tar] error while extracting '%s'" % tar_filename ) ) else : pass else : raise IOError ( ( "[tar] no right access to '%s'" % dest_path ) ) else : raise IOError ( ( "'%s' not found" % tar_filename ) )
unpacks a tarball to a destination directory .