(build, build_profile_id, include_multimedia_files=True, include_index_files=True,
                         download_id=None, compress_zip=False, filename="commcare.zip",
                         download_targeted_version=False, task=None)
return fpath
:param task: celery task whose progress needs to be set when being run asynchronously by celery
    :return: path to the ccz file
:param task: celery task whose progress needs to be set when being run asynchronously by celery
    :return: path to the ccz file
: param task : celery task whose progress needs to be set when being run asynchronously by celery : return : path to the ccz file
def create_files_for_ccz(build, build_profile_id, include_multimedia_files=True, include_index_files=True,
                         download_id=None, compress_zip=False, filename="commcare.zip",
                         download_targeted_version=False, task=None):
    """
    :param task: celery task whose progress needs to be set when being run asynchronously by celery
    :return: path to the ccz file
    """
    compression = zipfile.ZIP_DEFLATED if compress_zip else zipfile.ZIP_STORED
    current_progress = 10  # early on indicate something is happening
    file_progress = 50.0  # arbitrarily say building files takes half the total time

    DownloadBase.set_progress(task, current_progress, 100)

    fpath = _get_file_path(build, include_multimedia_files, include_index_files, build_profile_id,
                           download_targeted_version)

    # Don't rebuild the file if it is already there
    if not (os.path.isfile(fpath) and settings.SHARED_DRIVE_CONF.transfer_enabled):
        with build.timing_context("_build_ccz_files"):
            files, errors, file_count = _build_ccz_files(
                build, build_profile_id, include_multimedia_files, include_index_files,
                download_id, compress_zip, filename, download_targeted_version
            )
        with build.timing_context("_zip_files_for_ccz"):
            file_cache = _zip_files_for_ccz(fpath, files, current_progress, file_progress,
                                            file_count, compression, task)

        if include_index_files and toggles.LOCALE_ID_INTEGRITY.enabled(build.domain):
            with build.timing_context("find_missing_locale_ids_in_ccz"):
                locale_errors = find_missing_locale_ids_in_ccz(file_cache)
            if locale_errors:
                errors.extend(locale_errors)
                notify_exception(
                    None,
                    message="CCZ missing locale ids from default/app_strings.txt",
                    details={'domain': build.domain, 'app_id': build.id, 'errors': locale_errors}
                )
        if include_index_files and include_multimedia_files:
            with build.timing_context("check_ccz_multimedia_integrity"):
                multimedia_errors = check_ccz_multimedia_integrity(build.domain, fpath)
            if multimedia_errors:
                multimedia_errors.insert(0, _(
                    "Please try syncing multimedia files in multimedia tab under app settings to resolve "
                    "issues with missing media files. Report an issue if this persists."
                ))
            errors.extend(multimedia_errors)
            if multimedia_errors:
                notify_exception(
                    None,
                    message="CCZ missing multimedia files",
                    details={'domain': build.domain, 'app_id': build.id, 'errors': multimedia_errors}
                )

        if errors:
            os.remove(fpath)
            raise Exception('\t' + '\t'.join(errors))
    else:
        DownloadBase.set_progress(task, current_progress + file_progress, 100)
    with build.timing_context("_expose_download_link"):
        _expose_download_link(fpath, filename, compress_zip, download_id)
    DownloadBase.set_progress(task, 100, 100)
    return fpath
def create_files_for_ccz ( build , build_profile_id , include_multimedia_files = True , include_index_files = True , download_id = None , compress_zip = False , filename = "commcare.zip" , download_targeted_version = False , task = None ) : compression = zipfile . ZIP_DEFLATED if compress_zip else zipfile . ZIP_STORED current_progress = 10 # early on indicate something is happening file_progress = 50.0 # arbitrarily say building files takes half the total time DownloadBase . set_progress ( task , current_progress , 100 ) fpath = _get_file_path ( build , include_multimedia_files , include_index_files , build_profile_id , download_targeted_version ) # Don't rebuild the file if it is already there if not ( os . path . isfile ( fpath ) and settings . SHARED_DRIVE_CONF . transfer_enabled ) : with build . timing_context ( "_build_ccz_files" ) : files , errors , file_count = _build_ccz_files ( build , build_profile_id , include_multimedia_files , include_index_files , download_id , compress_zip , filename , download_targeted_version ) with build . timing_context ( "_zip_files_for_ccz" ) : file_cache = _zip_files_for_ccz ( fpath , files , current_progress , file_progress , file_count , compression , task ) if include_index_files and toggles . LOCALE_ID_INTEGRITY . enabled ( build . domain ) : with build . timing_context ( "find_missing_locale_ids_in_ccz" ) : locale_errors = find_missing_locale_ids_in_ccz ( file_cache ) if locale_errors : errors . extend ( locale_errors ) notify_exception ( None , message = "CCZ missing locale ids from default/app_strings.txt" , details = { 'domain' : build . domain , 'app_id' : build . id , 'errors' : locale_errors } ) if include_index_files and include_multimedia_files : with build . timing_context ( "check_ccz_multimedia_integrity" ) : multimedia_errors = check_ccz_multimedia_integrity ( build . domain , fpath ) if multimedia_errors : multimedia_errors . insert ( 0 , _ ( "Please try syncing multimedia files in multimedia tab under app settings to resolve " "issues with missing media files. Report an issue if this persists." ) ) errors . extend ( multimedia_errors ) if multimedia_errors : notify_exception ( None , message = "CCZ missing multimedia files" , details = { 'domain' : build . domain , 'app_id' : build . id , 'errors' : multimedia_errors } ) if errors : os . remove ( fpath ) raise Exception ( '\t' + '\t' . join ( errors ) ) else : DownloadBase . set_progress ( task , current_progress + file_progress , 100 ) with build . timing_context ( "_expose_download_link" ) : _expose_download_link ( fpath , filename , compress_zip , download_id ) DownloadBase . set_progress ( task , 100 , 100 ) return fpath