def symlink(project):
    """This is here to avoid circular imports in models.py"""
    from readthedocs.projects import symlinks
    log.info("Symlinking %s", project)
    symlinks.symlink_cnames(project)
    symlinks.symlink_translations(project)
    symlinks.symlink_subprojects(project)
    if project.single_version:
        symlinks.symlink_single_version(project)
    else:
        symlinks.remove_symlink_single_version(project)
Exemple #2
0
def symlink(project):
    """This is here to avoid circular imports in models.py"""
    from readthedocs.projects import symlinks
    log.info("Symlinking %s", project)
    symlinks.symlink_cnames(project)
    symlinks.symlink_translations(project)
    symlinks.symlink_subprojects(project)
    if project.single_version:
        symlinks.symlink_single_version(project)
    else:
        symlinks.remove_symlink_single_version(project)
Exemple #3
0
def finish_build(version_pk,
                 build_pk,
                 hostname=None,
                 html=False,
                 localmedia=False,
                 search=False,
                 pdf=False,
                 epub=False):
    """
    Build Finished, do house keeping bits
    """
    version = Version.objects.get(pk=version_pk)
    build = Build.objects.get(pk=build_pk)

    if html:
        version.active = True
        version.built = True
        version.save()

    if not pdf:
        clear_pdf_artifacts(version)
    if not epub:
        clear_epub_artifacts(version)

    move_files(
        version_pk=version_pk,
        hostname=hostname,
        html=html,
        localmedia=localmedia,
        search=search,
        pdf=pdf,
        epub=epub,
    )

    symlinks.symlink_cnames(version)
    symlinks.symlink_translations(version)
    symlinks.symlink_subprojects(version)
    if version.project.single_version:
        symlinks.symlink_single_version(version)
    else:
        symlinks.remove_symlink_single_version(version)

    # Delayed tasks
    update_static_metadata.delay(version.project.pk)
    fileify.delay(version.pk, commit=build.commit)
    update_search.delay(version.pk, commit=build.commit)
    if not html and version.slug != STABLE and build.exit_code != 423:
        send_notifications.delay(version.pk, build_pk=build.pk)
Exemple #4
0
def finish_build(version_pk, build_pk, hostname=None, html=False,
                 localmedia=False, search=False, pdf=False, epub=False):
    """
    Build Finished, do house keeping bits
    """
    version = Version.objects.get(pk=version_pk)
    build = Build.objects.get(pk=build_pk)

    if html:
        version.active = True
        version.built = True
        version.save()

    if not pdf:
        clear_pdf_artifacts(version)
    if not epub:
        clear_epub_artifacts(version)

    move_files(
        version_pk=version_pk,
        hostname=hostname,
        html=html,
        localmedia=localmedia,
        search=search,
        pdf=pdf,
        epub=epub,
    )

    symlinks.symlink_cnames(version)
    symlinks.symlink_translations(version)
    symlinks.symlink_subprojects(version)
    if version.project.single_version:
        symlinks.symlink_single_version(version)
    else:
        symlinks.remove_symlink_single_version(version)

    # Delayed tasks
    update_static_metadata.delay(version.project.pk)
    fileify.delay(version.pk, commit=build.commit)
    update_search.delay(version.pk, commit=build.commit)
    if not html and version.slug != STABLE and build.exit_code != 423:
        send_notifications.delay(version.pk, build_pk=build.pk)