def move_files(version_pk, hostname, html=False, localmedia=False, search=False, pdf=False, epub=False): """ Task to move built documentation to web servers. :param version_pk: Version id to sync files for :param hostname: Hostname to sync to :param html: Sync HTML :type html: bool :param localmedia: Sync local media files :type localmedia: bool :param search: Sync search files :type search: bool :param pdf: Sync PDF files :type pdf: bool :param epub: Sync ePub files :type epub: bool """ version = Version.objects.get(pk=version_pk) log.debug(LOG_TEMPLATE.format(project=version.project.slug, version=version.slug, msg='Moving files')) if html: from_path = version.project.artifact_path( version=version.slug, type_=version.project.documentation_type) target = version.project.rtd_build_path(version.slug) Syncer.copy(from_path, target, host=hostname) if 'sphinx' in version.project.documentation_type: if search: from_path = version.project.artifact_path( version=version.slug, type_='sphinx_search') to_path = version.project.get_production_media_path( type_='json', version_slug=version.slug, include_file=False) Syncer.copy(from_path, to_path, host=hostname) if localmedia: from_path = version.project.artifact_path( version=version.slug, type_='sphinx_localmedia') to_path = version.project.get_production_media_path( type_='htmlzip', version_slug=version.slug, include_file=False) Syncer.copy(from_path, to_path, host=hostname) # Always move PDF's because the return code lies. if pdf: from_path = version.project.artifact_path(version=version.slug, type_='sphinx_pdf') to_path = version.project.get_production_media_path( type_='pdf', version_slug=version.slug, include_file=False) Syncer.copy(from_path, to_path, host=hostname) if epub: from_path = version.project.artifact_path(version=version.slug, type_='sphinx_epub') to_path = version.project.get_production_media_path( type_='epub', version_slug=version.slug, include_file=False) Syncer.copy(from_path, to_path, host=hostname)