view roundup/dist/command/build_doc.py @ 5074:7612b86bec69

Remove 'import *' statement from dist/command/build_doc.py There are various 'import *' statements scattered through the code which are generally not a good thing. These should be fairly safe changes, but I'll commit them one file at a time to make it easier to track down issues with a bisect if they crop up later.
author John Kristensen <john@jerrykan.com>
date Fri, 10 Jun 2016 17:24:39 +1000
parents 7b575e1f7368
children 42bf0a707763
line wrap: on
line source

#
# Copyright (C) 2009 Stefan Seefeld
# All rights reserved.
# For license terms see the file COPYING.txt.
#

import os, sys
import os.path
import glob

from distutils.command import build
from distutils.spawn import spawn, find_executable
from distutils.dep_util import newer, newer_group
from distutils.dir_util import copy_tree, remove_tree, mkpath
from distutils.file_util import copy_file
from distutils import sysconfig

class build_doc(build.build):
    """Defines the specific procedure to build roundup's documentation."""

    description = "build documentation"

    def run(self):
        """Run this command, i.e. do the actual document generation."""

        sphinx = find_executable('sphinx-build')
        if sphinx:
            sphinx = [sphinx]
        else:
            try:  # try to find version installed with Python tools
                  # tested with Sphinx 1.1.3
                import sphinx as sp
            except ImportError:
                pass
            else:
                sphinx = [sys.executable, sp.__file__]

        if not sphinx:
            self.warn("could not find sphinx-build in PATH")
            self.warn("cannot build documentation")
            return

        doc_dir = os.path.join('share', 'doc', 'roundup', 'html')
        temp_dir = os.path.join(self.build_temp, 'doc')
        cmd = sphinx + ['-d', temp_dir, 'doc', doc_dir]
        spawn(cmd)

Roundup Issue Tracker: http://roundup-tracker.org/