def download_manifest_files(filepath):
 validate_manifest(filepath)
 manifest_data = return_json(filepath)
 dependencies = manifest_data['dependencies']
 for (data, dependency) in dependencies.items():
  for (_, dependency_contents) in dependency.items():
   dependency_rev = dependency_contents['version']
   dependency_url = dependency_contents['url']
   download_format = dependency_contents['downloadFormat']
   if (download_format == _DOWNLOAD_FORMAT_FILES):
    dependency_files = dependency_contents['files']
    target_dirname = (dependency_contents['targetDirPrefix'] + dependency_rev)
    dependency_dst = os.path.join(TARGET_DOWNLOAD_DIRS[data], target_dirname)
    download_files(dependency_url, dependency_dst, dependency_files)
   elif (download_format == _DOWNLOAD_FORMAT_ZIP):
    if ('rootDir' in dependency_contents):
     dependency_zip_root_name = dependency_contents['rootDir']
    else:
     dependency_zip_root_name = (dependency_contents['rootDirPrefix'] + dependency_rev)
    if ('targetDir' in dependency_contents):
     dependency_target_root_name = dependency_contents['targetDir']
    else:
     dependency_target_root_name = (dependency_contents['targetDirPrefix'] + dependency_rev)
    download_and_unzip_files(dependency_url, TARGET_DOWNLOAD_DIRS[data], dependency_zip_root_name, dependency_target_root_name)
   elif (download_format == _DOWNLOAD_FORMAT_TAR):
    dependency_tar_root_name = (dependency_contents['tarRootDirPrefix'] + dependency_rev)
    dependency_target_root_name = (dependency_contents['targetDirPrefix'] + dependency_rev)
    download_and_untar_files(dependency_url, TARGET_DOWNLOAD_DIRS[data], dependency_tar_root_name, dependency_target_root_name)

def download_manifest_files ( filepath ) : validate_manifest ( filepath ) manifest_data = return_json ( filepath ) dependencies = manifest_data [ 'dependencies' ] for ( data , dependency ) in dependencies . items ( ) : for ( _ , dependency_contents ) in dependency . items ( ) : dependency_rev = dependency_contents [ 'version' ] dependency_url = dependency_contents [ 'url' ] download_format = dependency_contents [ 'downloadFormat' ] if ( download_format == _DOWNLOAD_FORMAT_FILES ) : dependency_files = dependency_contents [ 'files' ] target_dirname = ( dependency_contents [ 'targetDirPrefix' ] + dependency_rev ) dependency_dst = os . path . join ( TARGET_DOWNLOAD_DIRS [ data ] , target_dirname ) download_files ( dependency_url , dependency_dst , dependency_files ) elif ( download_format == _DOWNLOAD_FORMAT_ZIP ) : if ( 'rootDir' in dependency_contents ) : dependency_zip_root_name = dependency_contents [ 'rootDir' ] else : dependency_zip_root_name = ( dependency_contents [ 'rootDirPrefix' ] + dependency_rev ) if ( 'targetDir' in dependency_contents ) : dependency_target_root_name = dependency_contents [ 'targetDir' ] else : dependency_target_root_name = ( dependency_contents [ 'targetDirPrefix' ] + dependency_rev ) download_and_unzip_files ( dependency_url , TARGET_DOWNLOAD_DIRS [ data ] , dependency_zip_root_name , dependency_target_root_name ) elif ( download_format == _DOWNLOAD_FORMAT_TAR ) : dependency_tar_root_name = ( dependency_contents [ 'tarRootDirPrefix' ] + dependency_rev ) dependency_target_root_name = ( dependency_contents [ 'targetDirPrefix' ] + dependency_rev ) download_and_untar_files ( dependency_url , TARGET_DOWNLOAD_DIRS [ data ] , dependency_tar_root_name , dependency_target_root_name )
this download all files to the required folders args: filepath: the path to the json file .