def download_and_untar_files(source_url, target_parent_dir, tar_root_name, target_root_name):
 if (not os.path.exists(os.path.join(target_parent_dir, target_root_name))):
  print ('Downloading and untarring file %s to %s' % (tar_root_name, target_parent_dir))
  common.ensure_directory_exists(target_parent_dir)
  urllib.urlretrieve(source_url, TMP_UNZIP_PATH)
  with contextlib.closing(tarfile.open(TMP_UNZIP_PATH, 'r:gz')) as tfile:
   tfile.extractall(target_parent_dir)
  os.remove(TMP_UNZIP_PATH)
  os.rename(os.path.join(target_parent_dir, tar_root_name), os.path.join(target_parent_dir, target_root_name))

def download_and_untar_files ( source_url , target_parent_dir , tar_root_name , target_root_name ) : if ( not os . path . exists ( os . path . join ( target_parent_dir , target_root_name ) ) ) : print ( 'Downloading and untarring file %s to %s' % ( tar_root_name , target_parent_dir ) ) common . ensure_directory_exists ( target_parent_dir ) urllib . urlretrieve ( source_url , TMP_UNZIP_PATH ) with contextlib . closing ( tarfile . open ( TMP_UNZIP_PATH , 'r:gz' ) ) as tfile : tfile . extractall ( target_parent_dir ) os . remove ( TMP_UNZIP_PATH ) os . rename ( os . path . join ( target_parent_dir , tar_root_name ) , os . path . join ( target_parent_dir , target_root_name ) )
downloads a tar file .