view roundup/dist/command/build_doc.py @ 8528:fed0f839c260

fix: replace except: with except Exception: (by haosenwang1018@github) Remove bare 'except:' statements replace with 'except Exception'. In roundup_xmlrpc_server.py I changed Exception to BaseException so the database gets closed on signals as well. The rest of the changes do not look like they affect data integrity and are commited as supplied.
author John Rouillard <rouilj@ieee.org>
date Thu, 26 Feb 2026 09:46:02 -0500
parents d2ca7b1bfc6b
children
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

try:
    from setuptools.command.install import install as _build_py
except ImportError:
    from distutils.command.build import build as _build_py  # try/except clause
    orig_build = _build_py

try:
    # would be nice to use setuptools.Command.spawn() as it
    # obeys the dry-run flag.
    from subprocess import run as spawn
except ImportError:
    from distutils.spawn import spawn  # try/except: in except for subprocess

try:
    from distutils.spawn import find_executable # try/except: in try local find
except ImportError:
    from roundup.dist.command import find_executable

class build_doc(_build_py):
    """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_base, 'temp.doc')
        cmd = sphinx + ['-d', temp_dir, 'doc', doc_dir]
        spawn(cmd)

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