Beispiel #1
0
    def build(self, version):
        project = version.project
        os.chdir(project.conf_dir(version.slug))
        if project.use_virtualenv and project.whitelisted:
            latex_results = run('%s -b latex -d _build/doctrees   . _build/latex' % project.venv_bin(version=version.slug, bin='sphinx-build'))
        else:
            latex_results = run('sphinx-build -b latex '
                            '-d _build/doctrees   . _build/latex')

        if latex_results[0] == 0:
            os.chdir('_build/latex')
            tex_globs = glob('*.tex')
            if tex_globs:
                tex_file = tex_globs[0]
            else:
                return False
            pdf_results = run('pdflatex -interaction=nonstopmode %s' % tex_file)
            pdf_match = pdf_re.search(pdf_results[1])
            if pdf_match:
                to_path = os.path.join(settings.MEDIA_ROOT,
                       'pdf',
                       project.slug,
                       version.slug)
                from_file = os.path.join(os.getcwd(), "*.pdf")
                to_file = os.path.join(to_path, '%s.pdf' % project.slug)
                if getattr(settings, "MULTIPLE_APP_SERVERS", None):
                    copy_file_to_app_servers(from_file, to_file)
                else:
                    if not os.path.exists(to_path):
                        os.makedirs(to_path)
                    run('mv -f %s %s' % (from_file, to_file))
        else:
            print "PDF Building failed. Moving on."
        return latex_results
Beispiel #2
0
    def move(self, **kwargs):
        project = self.version.project
        if project.full_build_path(self.version.slug):
            #Copy the html files.
            target = project.rtd_build_path(self.version.slug)
            if getattr(settings, "MULTIPLE_APP_SERVERS", None):
                log.info("Copying docs to remote server.")
                copy_to_app_servers(project.full_build_path(self.version.slug), target)
            else:
                if os.path.exists(target):
                    shutil.rmtree(target)
                log.info("Copying docs on the local filesystem")
                shutil.copytree(project.full_build_path(self.version.slug), target)

            #Copy the zip file.
            to_path = os.path.join(settings.MEDIA_ROOT,
                   'htmlzip',
                   project.slug,
                   self.version.slug)
            to_file = os.path.join(to_path, '%s.zip' % project.slug)
            from_path = project.checkout_path(self.version.slug)
            from_file = os.path.join(from_path, '%s.zip' % project.slug)
            if getattr(settings, "MULTIPLE_APP_SERVERS", None):
                copy_file_to_app_servers(from_file, to_file)
            else:
                if not os.path.exists(to_path):
                    os.makedirs(to_path)
                run('mv -f %s %s' % (from_file, to_file))
        else:
            log.warning("Not moving docs, because the build dir is unknown.")
    def build(self, **kwargs):
        project = self.version.project
        os.chdir(project.conf_dir(self.version.slug))
        force_str = " -E " if self.force else ""
        if project.use_virtualenv:
            html_build_command = "%s %s -b html . _build/html " % (
                project.venv_bin(version=self.version.slug,
                                 bin='sphinx-build'),
                force_str)
        else:
            html_build_command = ("sphinx-build %s -b html . _build/html"
                                  % (force_str))
        html_build_results = run(html_build_command, shell=True)
        if 'no targets are out of date.' in html_build_results[1]:
            self._changed = False

        if os.path.exists('_build/dash'):
            shutil.rmtree('_build/dash')
        os.makedirs('_build/dash')
        dash_build_command = ("doc2dash --name=\"%s\" --force "
                              "--destination=_build/dash _build/html"
                              % project.name)
        dash_build_results = run(dash_build_command, shell=True)
        self._zip_dash()
        return dash_build_results
Beispiel #4
0
    def build(self, **kwargs):
        project = self.version.project
        os.chdir(project.conf_dir(self.version.slug))
        force_str = " -E " if self.force else ""
        if project.use_virtualenv:
            html_build_command = "%s %s -b html . _build/html " % (
                project.venv_bin(version=self.version.slug,
                                 bin='sphinx-build'), force_str)
        else:
            html_build_command = ("sphinx-build %s -b html . _build/html" %
                                  (force_str))
        html_build_results = run(html_build_command, shell=True)
        if 'no targets are out of date.' in html_build_results[1]:
            self._changed = False

        if os.path.exists('_build/dash'):
            shutil.rmtree('_build/dash')
        os.makedirs('_build/dash')
        dash_build_command = ("doc2dash --name=\"%s\" --force "
                              "--destination=_build/dash _build/html" %
                              project.name)
        dash_build_results = run(dash_build_command, shell=True)
        self._zip_dash()
        self._write_feed()
        return dash_build_results
Beispiel #5
0
    def build(self, **kwargs):
        project = self.version.project
        os.chdir(project.conf_dir(self.version.slug))
        #Default to this so we can return it always.
        results = {}
        if project.use_virtualenv:
            latex_results = run('%s -b latex -D language=%s -d _build/doctrees . _build/latex'
                                % (project.venv_bin(version=self.version.slug,
                                                   bin='sphinx-build'), project.language))
        else:
            latex_results = run('sphinx-build -b latex -D language=%s -d _build/doctrees '
                                '. _build/latex' % project.language)

        if latex_results[0] == 0:
            os.chdir('_build/latex')
            tex_files = glob('*.tex')

            if tex_files:
                # Run LaTeX -> PDF conversions
                pdflatex_cmds = [('pdflatex -interaction=nonstopmode %s'
                                 % tex_file) for tex_file in tex_files]
                # Run twice because of https://github.com/rtfd/readthedocs.org/issues/749
                pdf_results = run(*pdflatex_cmds)
                pdf_results = run(*pdflatex_cmds)
            else:
                pdf_results = (0, "No tex files found", "No tex files found")

            results = [
                latex_results[0] + pdf_results[0],
                latex_results[1] + pdf_results[1],
                latex_results[2] + pdf_results[2],
            ]
        else:
            results = latex_results
        return results
Beispiel #6
0
def unzip_files(dest_file, html_path):
    if not os.path.exists(html_path):
        os.makedirs(html_path)
    else:
        shutil.rmtree(html_path)
        os.makedirs(html_path)
    run('unzip -o %s -d %s' % (dest_file, html_path))
Beispiel #7
0
    def move(self, **kwargs):
        project = self.version.project
        if project.full_build_path(self.version.slug):
            # Copy the html files.
            target = project.rtd_build_path(self.version.slug)
            if "_" in project.slug:
                new_slug = project.slug.replace("_", "-")
                new_target = target.replace(project.slug, new_slug)
                # Only replace 1, so user_builds doesn't get replaced >:x
                targets = [target, new_target]
            else:
                targets = [target]
            for target in targets:
                if getattr(settings, "MULTIPLE_APP_SERVERS", None):
                    log.info("Copying docs to remote server.")
                    copy_to_app_servers(project.full_build_path(self.version.slug), target)
                else:
                    if os.path.exists(target):
                        shutil.rmtree(target)
                    log.info("Copying docs on the local filesystem")
                    shutil.copytree(project.full_build_path(self.version.slug), target)

                # Copy the zip file.
                to_path = os.path.join(settings.MEDIA_ROOT, "htmlzip", project.slug, self.version.slug)
                to_file = os.path.join(to_path, "%s.zip" % project.slug)
                from_path = project.checkout_path(self.version.slug)
                from_file = os.path.join(from_path, "%s.zip" % project.slug)
                if getattr(settings, "MULTIPLE_APP_SERVERS", None):
                    copy_file_to_app_servers(from_file, to_file)
                else:
                    if not os.path.exists(to_path):
                        os.makedirs(to_path)
                    run("mv -f %s %s" % (from_file, to_file))
        else:
            log.warning("Not moving docs, because the build dir is unknown.")
    def build(self):
        project = self.version.project
        os.chdir(project.conf_dir(self.version.slug))
        # Default to this so we can return it always.
        pdf_results = (1, "", "")
        if project.use_virtualenv:
            latex_results = run(
                "%s -b latex -d _build/doctrees   . _build/latex"
                % project.venv_bin(version=self.version.slug, bin="sphinx-build")
            )
        else:
            latex_results = run("sphinx-build -b latex " "-d _build/doctrees   . _build/latex")

        if latex_results[0] == 0:
            os.chdir("_build/latex")
            tex_globs = glob("*.tex")
            if tex_globs:
                tex_file = tex_globs[0]
                pdf_results = run("pdflatex -interaction=nonstopmode %s" % tex_file)
                pdf_match = pdf_re.search(pdf_results[1])
                if pdf_match:
                    to_path = os.path.join(settings.MEDIA_ROOT, "pdf", project.slug, self.version.slug)
                    from_file = os.path.join(os.getcwd(), "*.pdf")
                    to_file = os.path.join(to_path, "%s.pdf" % project.slug)
                    if getattr(settings, "MULTIPLE_APP_SERVERS", None):
                        copy_file_to_app_servers(from_file, to_file)
                    else:
                        if not os.path.exists(to_path):
                            os.makedirs(to_path)
                        run("mv -f %s %s" % (from_file, to_file))
        else:
            print "PDF Building failed. Moving on."
        return (latex_results, pdf_results)
Beispiel #9
0
    def build(self, **kwargs):
        project = self.version.project
        os.chdir(project.conf_dir(self.version.slug))
        #Default to this so we can return it always.
        pdf_results = (1, '', '')
        if project.use_virtualenv:
            latex_results = run(
                '%s -b latex -D language=%s -d _build/doctrees . _build/latex'
                % (project.venv_bin(version=self.version.slug,
                                    bin='sphinx-build'), project.language))
        else:
            latex_results = run(
                'sphinx-build -b latex -D language=%s -d _build/doctrees '
                '. _build/latex' % project.language)

        if latex_results[0] == 0:
            os.chdir('_build/latex')
            tex_files = glob('*.tex')

            if tex_files:
                # Run LaTeX -> PDF conversions
                pdflatex_cmds = [
                    ('pdflatex -interaction=nonstopmode %s' % tex_file)
                    for tex_file in tex_files
                ]
                pdf_results = run(*pdflatex_cmds)
            else:
                pdf_results = (0, "No tex files found", "No tex files found")

        if latex_results[0] != 0 or pdf_results[0] != 0:
            log.warning("PDF Building failed. Moving on.")
        return (latex_results, pdf_results)
Beispiel #10
0
    def move(self, **kwargs):
        project = self.version.project
        outputted_path = self.version.project.checkout_path(self.version.slug)
        to_path = os.path.join(settings.MEDIA_ROOT, 'dash', project.slug,
                               self.version.slug)

        from_globs = glob(os.path.join(outputted_path, "*.tgz"))
        if from_globs:
            from_file = from_globs[0]
            to_file = os.path.join(to_path, "%s.tgz" % project.doc_name)
            if getattr(settings, "MULTIPLE_APP_SERVERS", None):
                copy_file_to_app_servers(from_file, to_file)
            else:
                if not os.path.exists(to_path):
                    os.makedirs(to_path)
                run('mv -f %s %s' % (from_file, to_file))

        xml_globs = glob(os.path.join(outputted_path, "*.xml"))
        if xml_globs:
            from_file = xml_globs[0]
            to_file = os.path.join(to_path, "%s.xml" % project.doc_name)
            if getattr(settings, "MULTIPLE_APP_SERVERS", None):
                copy_file_to_app_servers(from_file, to_file)
            else:
                if not os.path.exists(to_path):
                    os.makedirs(to_path)
                run('mv -f %s %s' % (from_file, to_file))
Beispiel #11
0
    def build(self, version):
        project = version.project
        os.chdir(project.conf_dir(version.slug))
        if project.use_virtualenv and project.whitelisted:
            latex_results = run('%s -b latex -d _build/doctrees   . _build/latex' % project.venv_bin(version=version.slug, bin='sphinx-build'))
        else:
            latex_results = run('sphinx-build -b latex '
                            '-d _build/doctrees   . _build/latex')

        if latex_results[0] == 0:
            os.chdir('_build/latex')
            tex_globs = glob('*.tex')
            if tex_globs:
                tex_file = tex_globs[0]
            else:
                return False
            pdf_results = run('pdflatex -interaction=nonstopmode %s' % tex_file)
            pdf_match = pdf_re.search(pdf_results[1])
            if pdf_match:
                from_file = os.path.join(os.getcwd(),
                                         "%s" % pdf_match.group(1).strip())
                to_path = os.path.join(settings.MEDIA_ROOT,
                                       'pdf',
                                       project.slug,
                                       version.slug)
                if not os.path.exists(to_path):
                    os.makedirs(to_path)
                to_file = os.path.join(to_path, '%s.pdf' % project.slug)
                if os.path.exists(from_file):
                    run('mv -f %s %s' % (from_file, to_file))
                else:
                    print "File doesn't exist, not symlinking."
            return True
        print "PDF Building failed. Moving on."
        return False
Beispiel #12
0
    def move(self, **kwargs):
        project = self.version.project
        outputted_path = self.version.project.checkout_path(self.version.slug)
        to_path = os.path.join(settings.MEDIA_ROOT,
                               'dash',
                               project.slug,
                               self.version.slug)
        
        from_globs = glob(os.path.join(outputted_path, "*.tgz"))
        if from_globs:
            from_file = from_globs[0]
            to_file = os.path.join(to_path, "%s.tgz" % project.doc_name)
            if getattr(settings, "MULTIPLE_APP_SERVERS", None):
                copy_file_to_app_servers(from_file, to_file)
            else:
                if not os.path.exists(to_path):
                    os.makedirs(to_path)
                run('mv -f %s %s' % (from_file, to_file))

        xml_globs = glob(os.path.join(outputted_path, "*.xml"))
        if xml_globs:
            from_file = xml_globs[0]
            to_file = os.path.join(to_path, "%s.xml" % project.doc_name)
            if getattr(settings, "MULTIPLE_APP_SERVERS", None):
                copy_file_to_app_servers(from_file, to_file)
            else:
                if not os.path.exists(to_path):
                    os.makedirs(to_path)
                run('mv -f %s %s' % (from_file, to_file))
    def build(self, **kwargs):
        project = self.version.project
        os.chdir(project.conf_dir(self.version.slug))
        #Default to this so we can return it always.
        pdf_results = (1, '', '')
        if project.use_virtualenv:
            latex_results = run('%s -b latex -d _build/doctrees   . _build/latex' %
                                project.venv_bin(version=self.version.slug, bin='sphinx-build'))
        else:
            latex_results = run('sphinx-build -b latex '
                            '-d _build/doctrees   . _build/latex')

        if latex_results[0] == 0:
            os.chdir('_build/latex')
            tex_files = glob('*.tex')

            if tex_files:
                # Run LaTeX -> PDF conversions
                pdflatex_cmds = ['pdflatex -interaction=nonstopmode %s' % tex_file
                                 for tex_file in tex_files]
                pdf_results = run(*pdflatex_cmds)
            else:
                pdf_results = (0, "No tex files found", "No tex files found")


        if latex_results[0] != 0 or pdf_results[0] != 0:
            log.warning("PDF Building failed. Moving on.")
        return (latex_results, pdf_results)
Beispiel #14
0
    def move(self, **kwargs):
        if not os.path.exists(self.target):
            os.makedirs(self.target)

        exact = os.path.join(self.old_artifact_path,
                             "%s.pdf" % self.version.project.slug)
        exact_upper = os.path.join(
            self.old_artifact_path,
            "%s.pdf" % self.version.project.slug.capitalize())

        if self.pdf_file_name and os.path.exists(self.pdf_file_name):
            from_file = self.pdf_file_name
        if os.path.exists(exact):
            from_file = exact
        elif os.path.exists(exact_upper):
            from_file = exact_upper
        else:
            from_globs = glob(os.path.join(self.old_artifact_path, "*.pdf"))
            if from_globs:
                from_file = from_globs[0]
            else:
                from_file = None
        if from_file:
            to_file = os.path.join(self.target,
                                   "%s.pdf" % self.version.project.slug)
            run('mv -f %s %s' % (from_file, to_file))
Beispiel #15
0
    def build(self, **kwargs):
        project = self.version.project
        os.chdir(project.conf_dir(self.version.slug))
        #Default to this so we can return it always.
        results = {}
        if project.use_virtualenv:
            latex_results = run('%s -b latex -D language=%s -d _build/doctrees . _build/latex'
                                % (project.venv_bin(version=self.version.slug,
                                                   bin='sphinx-build'), project.language))
        else:
            latex_results = run('sphinx-build -b latex -D language=%s -d _build/doctrees '
                                '. _build/latex' % project.language)

        if latex_results[0] == 0:
            os.chdir('_build/latex')
            tex_files = glob('*.tex')

            if tex_files:
                # Run LaTeX -> PDF conversions
                pdflatex_cmds = [('pdflatex -interaction=nonstopmode %s'
                                 % tex_file) for tex_file in tex_files]
                # Run twice because of https://github.com/rtfd/readthedocs.org/issues/749
                pdf_results = run(*pdflatex_cmds)
                pdf_results = run(*pdflatex_cmds)
            else:
                pdf_results = (0, "No tex files found", "No tex files found")

            results = [
                latex_results[0] + pdf_results[0],
                latex_results[1] + pdf_results[1],
                latex_results[2] + pdf_results[2],
            ]
        else:
            results = latex_results
        return results
Beispiel #16
0
    def move(self):
        project = self.version.project
        if project.full_build_path(self.version.slug):
            #Copy the html files.
            target = project.rtd_build_path(self.version.slug)
            if getattr(settings, "MULTIPLE_APP_SERVERS", None):
                log.info("Copying docs to remote server.")
                copy_to_app_servers(project.full_build_path(self.version.slug),
                                    target)
            else:
                if os.path.exists(target):
                    shutil.rmtree(target)
                log.info("Copying docs on the local filesystem")
                shutil.copytree(project.full_build_path(self.version.slug),
                                target)

            #Copy the zip file.
            to_path = os.path.join(settings.MEDIA_ROOT, 'htmlzip',
                                   project.slug, self.version.slug)
            to_file = os.path.join(to_path, '%s.zip' % project.slug)
            from_path = project.checkout_path(self.version.slug)
            from_file = os.path.join(from_path, '%s.zip' % project.slug)
            if getattr(settings, "MULTIPLE_APP_SERVERS", None):
                copy_file_to_app_servers(from_file, to_file)
            else:
                if not os.path.exists(to_path):
                    os.makedirs(to_path)
                run('mv -f %s %s' % (from_file, to_file))
        else:
            log.warning("Not moving docs, because the build dir is unknown.")
Beispiel #17
0
def unzip_files(dest_file, html_path):
    if not os.path.exists(html_path):
        os.makedirs(html_path)
    else:
        shutil.rmtree(html_path)
        os.makedirs(html_path)
    run("unzip -o %s -d %s" % (dest_file, html_path))
    copy_to_app_servers(html_path, html_path)
Beispiel #18
0
 def move(self, **kwargs):
     from_globs = glob(os.path.join(self.old_artifact_path, "*.pdf"))
     if not os.path.exists(self.target):
         os.makedirs(self.target)
     if from_globs:
         from_file = from_globs[0]
         to_file = os.path.join(self.target, "%s.pdf" % self.version.project.slug)
         run('mv -f %s %s' % (from_file, to_file))
 def move(self, **kwargs):
     from_globs = glob(os.path.join(self.old_artifact_path, "*.epub"))
     if not os.path.exists(self.target):
         os.makedirs(self.target)
     if from_globs:
         from_file = from_globs[0]
         to_file = os.path.join(self.target, "%s.epub" % self.version.project.slug)
         run('mv -f %s %s' % (from_file, to_file))
Beispiel #20
0
def unzip_files(dest_file, html_path):
    if not os.path.exists(html_path):
        os.makedirs(html_path)
    else:
        shutil.rmtree(html_path)
        os.makedirs(html_path)
    run('unzip -o %s -d %s' % (dest_file, html_path))
    copy_to_app_servers(html_path, html_path)
Beispiel #21
0
    def install(self, project_data):

        if utils.dir_exists(project_data['dir']):
            return

        git = project_data['git']

        utils.run('git clone %s %s' % (git['repo'], project_data['dir']))
Beispiel #22
0
 def run_make_command(self, project, command, backup_command):
     try:
         self._cd_makefile(project)
         results = run(command)
         if results[0] != 0:
             raise OSError
     except (IndexError, OSError):
         os.chdir(project.path)
         results = run(backup_command)
     return results
Beispiel #23
0
    def install(self, project_data):

        dest = os.path.join(os.environ["WORKON_HOME"], project_data["virtualenv"]["name"])

        if not utils.dir_exists(dest):
            utils.run("virtualenv %s" % dest)

        with utils.cd(project_data["dir"]):
            with utils.workon(project_data["virtualenv"]["name"]):
                for file in project_data["virtualenv"]["files"]:
                    utils.run("pip install -r %s" % file)
Beispiel #24
0
 def move(self, **kwargs):
     if not os.path.exists(self.target):
         os.makedirs(self.target)
     exact = os.path.join(self.old_artifact_path, "%s.pdf" % self.version.project.slug)
     if os.path.exists(exact):
         from_file = exact
     else:
         from_globs = glob(os.path.join(self.old_artifact_path, "*.pdf"))
         if from_globs:
             from_file = from_globs[0]
     if from_file:
         to_file = os.path.join(self.target, "%s.pdf" % self.version.project.slug)
         run('mv -f %s %s' % (from_file, to_file))
Beispiel #25
0
    def build(self, **kwargs):
        project = self.version.project
        os.chdir(project.conf_dir(self.version.slug))
        #Default to this so we can return it always.
        pdf_results = (1, '', '')
        if project.use_virtualenv:
            latex_results = run(
                '%s -b latex -d _build/doctrees   . _build/latex' %
                project.venv_bin(version=self.version.slug,
                                 bin='sphinx-build'))
        else:
            latex_results = run('sphinx-build -b latex '
                                '-d _build/doctrees   . _build/latex')

        if latex_results[0] == 0:
            os.chdir('_build/latex')
            #if project.whitelisted:
            # For whitelisted projects, read LaTeX sources from conf.py
            #conf_py_file = project.conf_file(self.version.slug)
            #conf = {}
            #execfile(conf_py_file, conf, conf)
            #tex_files = [d[1] for d in conf.get('latex_documents', [])]
            #else:
            # Otherwise treat all .tex files as sources
            tex_files = glob('*.tex')

            # Run LaTeX -> PDF conversions
            pdflatex_cmds = [
                'pdflatex -interaction=nonstopmode %s' % tex_file
                for tex_file in tex_files
            ]
            pdf_results = run(*pdflatex_cmds)

            if pdf_results[0] == 0:
                for tex_file in tex_files:
                    to_path = os.path.join(settings.MEDIA_ROOT, 'pdf',
                                           project.slug, self.version.slug)
                    to_file = os.path.join(to_path, '%s.pdf' % project.slug)
                    # pdflatex names its output predictably: foo.tex -> foo.pdf
                    pdf_filename = os.path.splitext(tex_file)[0] + '.pdf'
                    from_file = os.path.join(os.getcwd(), pdf_filename)
                    if getattr(settings, "MULTIPLE_APP_SERVERS", None):
                        copy_file_to_app_servers(from_file, to_file)
                    else:
                        if not os.path.exists(to_path):
                            os.makedirs(to_path)
                        run('mv -f %s %s' % (from_file, to_file))

        if latex_results[0] != 0 or pdf_results[0] != 0:
            log.warning("PDF Building failed. Moving on.")
        return (latex_results, pdf_results)
Beispiel #26
0
 def move(self):
     project = self.version.project
     outputted_path = os.path.join(project.conf_dir(self.version.slug),
                                   '_build', 'epub')
     to_path = os.path.join(settings.MEDIA_ROOT, 'epub', project.slug,
                            self.version.slug)
     from_file = os.path.join(outputted_path, "*.epub")
     to_file = os.path.join(to_path, "%s.epub" % project.slug)
     if getattr(settings, "MULTIPLE_APP_SERVERS", None):
         copy_file_to_app_servers(from_file, to_file)
     else:
         if not os.path.exists(to_path):
             os.makedirs(to_path)
         run('mv -f %s %s' % (from_file, to_file))
Beispiel #27
0
    def build(self, **kwargs):
        project = self.version.project
        os.chdir(project.conf_dir(self.version.slug))
        #Default to this so we can return it always.
        pdf_results = (1, '', '')
        if project.use_virtualenv:
            latex_results = run('%s -b latex -d _build/doctrees   . _build/latex' %
                                project.venv_bin(version=self.version.slug, bin='sphinx-build'))
        else:
            latex_results = run('sphinx-build -b latex '
                            '-d _build/doctrees   . _build/latex')

        if latex_results[0] == 0:
            os.chdir('_build/latex')
            #if project.whitelisted:
                # For whitelisted projects, read LaTeX sources from conf.py
                #conf_py_file = project.conf_file(self.version.slug)
                #conf = {}
                #execfile(conf_py_file, conf, conf)
                #tex_files = [d[1] for d in conf.get('latex_documents', [])]
            #else:
                # Otherwise treat all .tex files as sources
            tex_files = glob('*.tex')

            # Run LaTeX -> PDF conversions
            pdflatex_cmds = ['pdflatex -interaction=nonstopmode %s' % tex_file
                             for tex_file in tex_files]
            pdf_results = run(*pdflatex_cmds)

            if pdf_results[0] == 0:
                for tex_file in tex_files:
                    to_path = os.path.join(settings.MEDIA_ROOT,
                           'pdf',
                           project.slug,
                           self.version.slug)
                    to_file = os.path.join(to_path, '%s.pdf' % project.slug)
                    # pdflatex names its output predictably: foo.tex -> foo.pdf
                    pdf_filename = os.path.splitext(tex_file)[0] + '.pdf'
                    from_file = os.path.join(os.getcwd(), pdf_filename)
                    if getattr(settings, "MULTIPLE_APP_SERVERS", None):
                        copy_file_to_app_servers(from_file, to_file)
                    else:
                        if not os.path.exists(to_path):
                            os.makedirs(to_path)
                        run('mv -f %s %s' % (from_file, to_file))

        if latex_results[0] != 0 or pdf_results[0] != 0:
            log.warning("PDF Building failed. Moving on.")
        return (latex_results, pdf_results)
Beispiel #28
0
def clear_artifacts(version_pk):
    """ Remove artifacts from the build server. """
    version_data = api.version(version_pk).get()
    version = make_api_version(version_data)
    run('rm -rf %s' % version.project.full_epub_path(version.slug))
    run('rm -rf %s' % version.project.full_man_path(version.slug))
    run('rm -rf %s' % version.project.full_build_path(version.slug))
    run('rm -rf %s' % version.project.full_latex_path(version.slug))
Beispiel #29
0
def build_docs(project):
    """
    A helper function for the celery task to do the actual doc building.
    """
    project.write_to_disk()

    try:
        makes = [makefile for makefile in project.find('Makefile') if 'doc' in makefile]
        make_dir = makes[0].replace('/Makefile', '')
        os.chdir(make_dir)
        (ret, out, err) = run('make html')
    except IndexError:
        os.chdir(project.path)
        (ret, out, err) = run('sphinx-build -b html . _build/html')
    return (ret, out, err)
Beispiel #30
0
def clear_artifacts(version_pk):
    """ Remove artifacts from the build server. """
    version_data = api.version(version_pk).get()
    version = make_api_version(version_data)
    run('rm -rf %s' % version.project.full_epub_path(version.slug))
    run('rm -rf %s' % version.project.full_man_path(version.slug))
    run('rm -rf %s' % version.project.full_build_path(version.slug))
    run('rm -rf %s' % version.project.full_latex_path(version.slug))
Beispiel #31
0
 def move(self, version):
     project = version.project
     outputted_path = os.path.join(project.conf_dir(version.slug),
                                 '_build', 'epub')
     to_path = os.path.join(settings.MEDIA_ROOT,
                            'epub',
                            project.slug,
                            version.slug)
     from_file = os.path.join(outputted_path, "*.epub")
     to_file = os.path.join(to_path, "%s.epub" % project.slug)
     if getattr(settings, "MULTIPLE_APP_SERVERS", None):
         copy_file_to_app_servers(from_file, to_file)
     else:
         if not os.path.exists(to_path):
             os.makedirs(to_path)
         run('mv -f %s %s' % (from_file, to_file))
Beispiel #32
0
 def build(self, **kwargs):
     self.clean()
     project = self.version.project
     os.chdir(project.conf_dir(self.version.slug))
     force_str = " -E " if self._force else ""
     if project.use_virtualenv:
         build_command = "%s -T %s -b %s -D language=%s . %s " % (
             project.venv_bin(version=self.version.slug,
                              bin='sphinx-build'),
             force_str,
             self.sphinx_builder,
             project.language,
             self.sphinx_build_dir,
         )
     else:
         build_command = ("sphinx-build -T %s -b %s -D language=%s . %s"
                          % (
                              force_str,
                              self.sphinx_builder,
                              project.language,
                              self.sphinx_build_dir,
                          )
                          )
     results = run(build_command, shell=True)
     return results
Beispiel #33
0
 def move(self, **kwargs):
     project = self.version.project
     outputted_path = os.path.join(project.conf_dir(self.version.slug),
                                   '_build', 'man')
     to_path = os.path.join(settings.MEDIA_ROOT, 'man', project.slug,
                            self.version.slug)
     from_globs = glob(os.path.join(outputted_path, "*.1"))
     if from_globs:
         from_file = from_globs[0]
         to_file = os.path.join(to_path, '%s.1' % project.slug)
         if getattr(settings, "MULTIPLE_APP_SERVERS", None):
             copy_file_to_app_servers(from_file, to_file)
         else:
             if not os.path.exists(to_path):
                 os.makedirs(to_path)
             run('mv -f %s %s' % (from_file, to_file))
 def build(self, **kwargs):
     self.clean()
     project = self.version.project
     os.chdir(project.conf_dir(self.version.slug))
     force_str = " -E " if self._force else ""
     if project.use_virtualenv:
         build_command = "%s -T %s -b %s -D language=%s . %s " % (
             project.venv_bin(version=self.version.slug,
                              bin='sphinx-build'),
             force_str,
             self.sphinx_builder,
             project.language,
             self.sphinx_build_dir,
         )
     else:
         build_command = ("sphinx-build -T %s -b %s -D language=%s . %s"
                          % (
                              force_str,
                              self.sphinx_builder,
                              project.language,
                              self.sphinx_build_dir,
                          )
                          )
     results = run(build_command, shell=True)
     return results
Beispiel #35
0
    def build(self, **kwargs):
        project = self.version.project
        os.chdir(project.checkout_path(self.version.slug))
        user_config = yaml.safe_load(open('mkdocs.yml', 'r'))
        docs_dir = user_config.get('docs_dir', 'docs')
        READTHEDOCS_DATA = {
            'project':
            project.slug,
            'version':
            self.version.slug,
            'language':
            project.language,
            'page':
            "None",
            'theme':
            "readthedocs",
            'docroot':
            docs_dir,
            'source_suffix':
            ".md",
            'api_host':
            getattr(settings, 'SLUMBER_API_HOST', 'https://readthedocs.org'),
        }
        data_file = open(os.path.join(docs_dir, 'data.js'), 'w+')
        data_file.write("var READTHEDOCS_DATA = ")
        json.dump(READTHEDOCS_DATA, data_file)
        data_file.close()

        MEDIA_URL = getattr(settings, 'MEDIA_URL',
                            'https://media.readthedocs.org')
        if 'extra_javascript' in user_config:
            user_config['extra_javascript'].append(
                '%sjavascript/jquery/jquery-2.0.3.min.js' % MEDIA_URL)
            user_config['extra_javascript'].append('data.js')
            user_config['extra_javascript'].append(
                '%sjavascript/readthedocs-doc-embed.js' % MEDIA_URL)
        else:
            user_config['extra_javascript'] = [
                '%sjavascript/jquery/jquery-2.0.3.min.js' % MEDIA_URL,
                'data.js',
                '%sjavascript/readthedocs-doc-embed.js' % MEDIA_URL,
            ]
        if 'extra_css' in user_config:
            user_config['extra_css'].append(
                'https://media.readthedocs.org/css/badge_only.css')
            user_config['extra_css'].append(
                'https://media.readthedocs.org/css/readthedocs-doc-embed.css')
        else:
            user_config['extra_css'] = [
                'https://media.readthedocs.org/css/badge_only.css',
                'https://media.readthedocs.org/css/readthedocs-doc-embed.css',
            ]
        yaml.dump(user_config, open('mkdocs.yml', 'w'))
        if project.use_virtualenv:
            build_command = "%s build --theme=readthedocs" % (project.venv_bin(
                version=self.version.slug, bin='mkdocs'))
        else:
            build_command = "mkdocs build --theme=readthedocs"
        results = run(build_command, shell=True)
        return results
Beispiel #36
0
    def build(self, **kwargs):
        self.clean()
        project = self.version.project
        os.chdir(project.conf_dir(self.version.slug))
        # Default to this so we can return it always.
        results = {}
        if project.use_virtualenv:
            latex_results = run(
                '%s -b latex -D language=%s -d _build/doctrees . _build/latex'
                % (project.venv_bin(version=self.version.slug,
                                    bin='sphinx-build'), project.language))
        else:
            latex_results = run(
                'sphinx-build -b latex -D language=%s -d _build/doctrees '
                '. _build/latex' % project.language)

        if latex_results[0] == 0:
            os.chdir('_build/latex')
            tex_files = glob('*.tex')

            if tex_files:
                # Run LaTeX -> PDF conversions
                pdflatex_cmds = [
                    ('pdflatex -interaction=nonstopmode %s' % tex_file)
                    for tex_file in tex_files
                ]
                makeindex_cmds = [('makeindex -s python.ist %s.idx' %
                                   os.path.splitext(tex_file)[0])
                                  for tex_file in tex_files]
                pdf_results = run(*pdflatex_cmds)
                ind_results = run(*makeindex_cmds)
                pdf_results = run(*pdflatex_cmds)
            else:
                pdf_results = (0, "No tex files found", "No tex files found")
                ind_results = (0, "No tex files found", "No tex files found")

            results = [
                latex_results[0] + ind_results[0] + pdf_results[0],
                latex_results[1] + ind_results[1] + pdf_results[1],
                latex_results[2] + ind_results[2] + pdf_results[2],
            ]
            pdf_match = PDF_RE.search(results[1])
            if pdf_match:
                self.pdf_file_name = pdf_match.group(1).strip()
        else:
            results = latex_results
        return results
Beispiel #37
0
 def build(self, **kwargs):
     project = self.version.project
     os.chdir(project.checkout_path(self.version.slug))
     results = {}
     build_command = "%s build " % (project.venv_bin(
         version=self.version.slug, bin='asciidoctor'))
     results['html'] = run(build_command, shell=True)
     return results
    def build(self):
        project = self.version.project
        os.chdir(project.conf_dir(self.version.slug))
        if project.use_virtualenv and project.whitelisted:
            latex_results = run('%s -b latex -d _build/doctrees   . _build/latex' %
                                project.venv_bin(version=self.version.slug, bin='sphinx-build'))
        else:
            latex_results = run('sphinx-build -b latex '
                            '-d _build/doctrees   . _build/latex')

        if latex_results[0] == 0:
            os.chdir('_build/latex')
            tex_globs = glob('*.tex')
            if tex_globs:
                tex_file = tex_globs[0]
            else:
                return False
            pdf_results = run('pdflatex -interaction=nonstopmode %s' % tex_file)
            pdf_match = pdf_re.search(pdf_results[1])
            if pdf_match:
                to_path = os.path.join(settings.MEDIA_ROOT,
                       'pdf',
                       project.slug,
                       self.version.slug)
                from_file = os.path.join(os.getcwd(), "*.pdf")
                to_file = os.path.join(to_path, '%s.pdf' % project.slug)
                if getattr(settings, "MULTIPLE_APP_SERVERS", None):
                    copy_file_to_app_servers(from_file, to_file)
                else:
                    if not os.path.exists(to_path):
                        os.makedirs(to_path)
                    if os.path.exists(to_file):
                        os.unlink(to_file)

                    # Get a list of files that match the wildcard, and then only
                    # move the first one. Seems to be more reliable than mv
                    # command.
                    from_files = glob(from_file)
                    if len(from_files):
                        shutil.move(from_files[0], to_file)
                    else:
                        print "Failed to move pdf file"
        else:
            print "PDF Building failed. Moving on."
        return latex_results
 def move(self, **kwargs):
     project = self.version.project
     outputted_path = os.path.join(project.conf_dir(self.version.slug),
                                 '_build', 'man')
     to_path = os.path.join(settings.MEDIA_ROOT,
                            'man',
                            project.slug,
                            self.version.slug)
     from_globs = glob(os.path.join(outputted_path, "*.1"))
     if from_globs:
         from_file = from_globs[0]
         to_file = os.path.join(to_path, '%s.1' % project.slug)
         if getattr(settings, "MULTIPLE_APP_SERVERS", None):
             copy_file_to_app_servers(from_file, to_file)
         else:
             if not os.path.exists(to_path):
                 os.makedirs(to_path)
             run('mv -f %s %s' % (from_file, to_file))
Beispiel #40
0
def update_imported_docs(project):
    """
    Check out or update the given project's repository.
    """
    path = project.user_doc_path
    os.chdir(path)
    repo = project.repo

    # Commands to be run to checkout/update
    cmds = []

    # If project directory already exists, do an update/fetch/merge
    if os.path.exists(os.path.join(path, project.slug)):
        os.chdir(project.slug)
        if project.repo_type == 'hg':
            cmds.append('hg pull')
            cmds.append('hg update -C .')

        elif project.repo_type == 'git':
            cmds.append('git --git-dir=.git fetch')
            cmds.append('git --git-dir=.git reset --hard origin/master')

        elif project.repo_type == 'svn':
            cmds.append('svn revert --recursive .')
            cmds.append('svn up --accept theirs-full')

        elif project.repo_type == 'bzr':
            cmds.append('bzr revert')
            cmds.append('bzr up')

        else:
            raise ProjectImportError("Repo type '%s' unknown" % project.repo_type)

    # Project directory doesn't exist, so do a clone/checkout/branch
    else:
        if project.repo_type == 'hg':
            cmds.append('hg clone %s %s' % (repo, project.slug))

        elif project.repo_type == 'git':
            repo = repo.replace('.git', '').strip('/')
            cmds.append('git clone --depth=1 %s.git %s' % (repo, project.slug))

        elif project.repo_type == 'svn':
            cmds.append('svn checkout %s %s' % (repo, project.slug))

        elif project.repo_type == 'bzr':
            cmds.append('bzr checkout %s %s' % (repo, project.slug))

        else:
            raise ProjectImportError("Repo type '%s' unknown" % project.repo_type)

    # Run the command(s) and raise an exception on error
    status, out, err = run(*cmds)
    if status != 0:
        raise ProjectImportError("Failed to get code from repo: '%s'" % repo)

    fileify(project_slug=project.slug)
Beispiel #41
0
 def build(self, version):
     project = version.project
     os.chdir(version.project.conf_dir(version.slug))
     if project.use_virtualenv and project.whitelisted:
         build_command = '%s -b html . _build/html' % project.venv_bin(version=version.slug, bin='sphinx-build')
     else:
         build_command = "sphinx-build -b html . _build/html"
     build_results = run(build_command)
     return build_results
 def build(self):
     project = self.version.project
     os.chdir(project.conf_dir(self.version.slug))
     if project.use_virtualenv and project.whitelisted:
         build_command = '%s -b pdf . _build/pdf' % project.venv_bin(
             version=self.version.slug, bin='sphinx-build')
     else:
         build_command = "sphinx-build -b pdf . _build/pdf"
     build_results = run(build_command)
     return build_results
Beispiel #43
0
 def build(self, **kwargs):
     project = self.version.project
     os.chdir(project.checkout_path(self.version.slug))
     if project.use_virtualenv:
         build_command = "%s build --theme=readthedocs" % (project.venv_bin(
             version=self.version.slug, bin='mkdocs'))
     else:
         build_command = "mkdocs build --theme=readthedocs"
     results = run(build_command, shell=True)
     return results
Beispiel #44
0
 def build(self, id=None, **kwargs):
     id_dir = "/tmp/"
     id_file = "docs-build-%s" % id
     id_path = os.path.join(id_dir, id_file)
     project = self.version.project
     os.chdir(project.conf_dir(self.version.slug))
     force_str = " -E " if self.force else ""
     if project.use_virtualenv:
         build_command = "%s %s -b html . _build/html " % (project.venv_bin(
             version=self.version.slug, bin='sphinx-build'), force_str)
     else:
         build_command = "sphinx-build %s -b html . _build/html" % (
             force_str)
     build_results = run(build_command, shell=True)
     remove_results = run('rm %s' % id_path)
     self._zip_html()
     if 'no targets are out of date.' in build_results[1]:
         self._changed = False
     return build_results
Beispiel #45
0
 def build(self, **kwargs):
     project = self.version.project
     os.chdir(project.checkout_path(self.version.slug))
     results = {}
     build_command = "%s build " % (
         project.venv_bin(version=self.version.slug,
                          bin='asciidoctor')
         )
     results['html'] = run(build_command, shell=True)
     return results
Beispiel #46
0
 def build(self):
     project = self.version.project
     os.chdir(self.version.project.conf_dir(self.version.slug))
     if project.use_virtualenv and project.whitelisted:
         build_command = '%s -b man  -d _build/doctrees . _build/man' % project.venv_bin(
             version=self.version.slug, bin='sphinx-build')
     else:
         build_command = "sphinx-build -b man . _build/man"
     build_results = run(build_command)
     return build_results
Beispiel #47
0
 def build(self, version):
     project = version.project
     os.chdir(version.project.conf_dir(version.slug))
     if project.use_virtualenv and project.whitelisted:
         build_command = '%s -b html . _build/html' % project.venv_bin(
             version=version.slug, bin='sphinx-build')
     else:
         build_command = "sphinx-build -b html . _build/html"
     build_results = run(build_command)
     return build_results
Beispiel #48
0
 def build(self, id=None, **kwargs):
     id_dir = "/tmp/"
     id_file = "docs-build-%s" % id
     id_path = os.path.join(id_dir, id_file)
     project = self.version.project
     os.chdir(project.conf_dir(self.version.slug))
     force_str = " -E " if self.force else ""
     if project.use_virtualenv:
         build_command = "%s %s -b html . _build/html " % (
                 project.venv_bin( version=self.version.slug, bin='sphinx-build'),
                 force_str)
     else:
         build_command = "sphinx-build %s -b html . _build/html" % (force_str)
     build_results = run(build_command, shell=True)
     remove_results = run('rm %s' % id_path)
     self._zip_html()
     if 'no targets are out of date.' in build_results[1]:
         self._changed = False
     return build_results
 def build(self):
     project = self.version.project
     os.chdir(self.version.project.conf_dir(self.version.slug))
     if project.use_virtualenv:
         build_command = '%s -b man  -d _build/doctrees . _build/man' % project.venv_bin(
             version=self.version.slug, bin='sphinx-build')
     else:
         build_command = "sphinx-build -b man . _build/man"
     build_results = run(build_command)
     return build_results
Beispiel #50
0
 def build(self, **kwargs):
     project = self.version.project
     os.chdir(project.conf_dir(self.version.slug))
     if project.use_virtualenv:
         build_command = '%s -b epub . _build/epub' % project.venv_bin(
             version=self.version.slug, bin='sphinx-build')
     else:
         build_command = "sphinx-build -b epub . _build/epub"
     build_results = run(build_command)
     return build_results
Beispiel #51
0
 def move(self, **kwargs):
     #This needs to be thought about more because of all the state above.
     #We could just shove the filename on the instance or something.
     project = self.version.project
     os.chdir(os.path.join(project.conf_dir(self.version.slug), '_build',
                           'latex'))
     tex_files = glob('*.tex')
     for tex_file in tex_files:
         to_path = os.path.join(settings.MEDIA_ROOT, 'pdf', project.slug,
                                self.version.slug)
         to_file = os.path.join(to_path, '%s.pdf' % project.slug)
         # pdflatex names its output predictably: foo.tex -> foo.pdf
         pdf_filename = os.path.splitext(tex_file)[0] + '.pdf'
         from_file = os.path.join(os.getcwd(), pdf_filename)
         if getattr(settings, "MULTIPLE_APP_SERVERS", None):
             copy_file_to_app_servers(from_file, to_file)
         else:
             if not os.path.exists(to_path):
                 os.makedirs(to_path)
             run('mv -f %s %s' % (from_file, to_file))
Beispiel #52
0
    def build(self, version):
        project = version.project
        os.chdir(project.conf_dir(version.slug))
        if project.use_virtualenv and project.whitelisted:
            latex_results = run(
                '%s -b latex -d _build/doctrees   . _build/latex' %
                project.venv_bin(version=version.slug, bin='sphinx-build'))
        else:
            latex_results = run('sphinx-build -b latex '
                                '-d _build/doctrees   . _build/latex')

        if latex_results[0] == 0:
            os.chdir('_build/latex')
            tex_globs = glob('*.tex')
            if tex_globs:
                tex_file = tex_globs[0]
            else:
                return False
            pdf_results = run('pdflatex -interaction=nonstopmode %s' %
                              tex_file)
            pdf_match = pdf_re.search(pdf_results[1])
            if pdf_match:
                from_file = os.path.join(os.getcwd(),
                                         "%s" % pdf_match.group(1).strip())
                to_path = os.path.join(settings.MEDIA_ROOT, 'pdf',
                                       project.slug, version.slug)
                if not os.path.exists(to_path):
                    os.makedirs(to_path)
                to_file = os.path.join(to_path, '%s.pdf' % project.slug)
                if os.path.exists(from_file):
                    if getattr(settings, "MULTIPLE_APP_SERVERS", None):
                        copy_to_app_servers(
                            '/'.join(from_file.split('/')[0:-1]),
                            '/'.join(to_file.split('/')[0:-1]))
                    else:
                        run('mv -f %s %s' % (from_file, to_file))
                else:
                    print "File doesn't exist, not symlinking."
            return True
        print "PDF Building failed. Moving on."
        return False
Beispiel #53
0
 def build(self, **kwargs):
     project = self.version.project
     os.chdir(self.version.project.conf_dir(self.version.slug))
     if project.use_virtualenv:
         build_command = (
             '%s -b man -D language=%s -d _build/doctrees . _build/man' %
             (project.venv_bin(version=self.version.slug,
                               bin='sphinx-build'), project.language))
     else:
         build_command = "sphinx-build -D language=%s -b man . _build/man" % project.language
     build_results = run(build_command)
     return build_results
 def build(self, **kwargs):
     project = self.version.project
     os.chdir(self.version.project.conf_dir(self.version.slug))
     if project.use_virtualenv:
         build_command = '%s -b readthedocsdirhtml -D language=%s . _build/html' % (project.venv_bin(
             version=self.version.slug, bin='sphinx-build'), project.language)
     else:
         build_command = "sphinx-build -D language=%s -b readthedocsdirhtml . _build/html" % project.language
     build_results = run(build_command)
     if 'no targets are out of date.' in build_results[1]:
         self._changed = False
     return build_results
Beispiel #55
0
 def build(self):
     project = self.version.project
     os.chdir(project.conf_dir(self.version.slug))
     if project.use_virtualenv and project.whitelisted:
         build_command = '%s -b html . _build/html' % project.venv_bin(
             version=self.version.slug, bin='sphinx-build')
     else:
         build_command = "sphinx-build -b html . _build/html"
     build_results = run(build_command)
     if 'no targets are out of date.' in build_results[1]:
         self._changed = False
     return build_results
 def build(self, **kwargs):
     project = self.version.project
     os.chdir(self.version.project.conf_dir(self.version.slug))
     if project.use_virtualenv:
         build_command = '%s -b json . _build/json' % project.venv_bin(
             version=self.version.slug, bin='sphinx-build')
     else:
         build_command = "sphinx-build -b json . _build/json"
     build_results = run(build_command)
     if 'no targets are out of date.' in build_results[1]:
         self._changed = False
     return build_results
Beispiel #57
0
    def build(self):
        project = self.version.project
        os.chdir(project.conf_dir(self.version.slug))
        #Default to this so we can return it always.
        pdf_results = (1, '', '')
        if project.use_virtualenv:
            latex_results = run(
                '%s -b latex -d _build/doctrees   . _build/latex' %
                project.venv_bin(version=self.version.slug,
                                 bin='sphinx-build'))
        else:
            latex_results = run('sphinx-build -b latex '
                                '-d _build/doctrees   . _build/latex')

        if latex_results[0] == 0:
            os.chdir('_build/latex')
            tex_globs = glob('*.tex')
            if tex_globs:
                tex_file = tex_globs[0]
                pdf_results = run('pdflatex -interaction=nonstopmode %s' %
                                  tex_file)
                pdf_match = pdf_re.search(pdf_results[1])
                if pdf_match:
                    to_path = os.path.join(settings.MEDIA_ROOT, 'pdf',
                                           project.slug, self.version.slug)
                    from_globs = glob(os.path.join(os.getcwd(), "*.pdf"))
                    if from_globs:
                        from_file = from_globs[0]
                        to_file = os.path.join(to_path,
                                               '%s.pdf' % project.slug)
                        if getattr(settings, "MULTIPLE_APP_SERVERS", None):
                            copy_file_to_app_servers(from_file, to_file)
                        else:
                            if not os.path.exists(to_path):
                                os.makedirs(to_path)
                            run('mv -f %s %s' % (from_file, to_file))
        else:
            log.warning("PDF Building failed. Moving on.")
        return (latex_results, pdf_results)
Beispiel #58
0
 def build(self, **kwargs):
     checkout_path = self.version.project.checkout_path(self.version.slug)
     #site_path = os.path.join(checkout_path, 'site')
     os.chdir(checkout_path)
     # Actual build
     build_command = "{command} {builder} --site-dir={build_dir} --theme=readthedocs".format(
         command=self.version.project.venv_bin(version=self.version.slug,
                                               bin='mkdocs'),
         builder=self.builder,
         build_dir=self.build_dir,
     )
     results = run(build_command, shell=True)
     return results
Beispiel #59
0
 def build(self, **kwargs):
     project = self.version.project
     os.chdir(project.conf_dir(self.version.slug))
     if os.path.exists('_build/dash'):
         shutil.rmtree('_build/dash')
     os.makedirs('_build/dash')
     dash_build_command = ("doc2dash --name=\"%s\" --force "
                           "--destination=_build/dash _build/html" %
                           project.name)
     dash_build_results = run(dash_build_command, shell=True)
     self._zip_dash()
     self._write_feed()
     return dash_build_results