How to use the hotdoc.core.exceptions.HotdocException function in hotdoc

To help you get started, we’ve selected a few hotdoc examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github hotdoc / hotdoc / hotdoc / extensions / git_upload / git_upload_extension.py View on Github external
import shutil
import subprocess
from subprocess import check_output as call
import urllib.parse

import appdirs
from hotdoc.utils.utils import recursive_overwrite
from hotdoc.core.extension import Extension
from hotdoc.core.exceptions import HotdocException
from hotdoc.utils.loggable import Logger, info, warn

Logger.register_warning_code('no-local-repository', HotdocException,
                             domain='git-uploader')
Logger.register_warning_code('dirty-local-repository', HotdocException,
                             domain='git-uploader')
Logger.register_warning_code('git-error', HotdocException,
                             domain='git-uploader')

DESCRIPTION =\
    """
An extension to upload the result of a hotdoc build
to git a repository.

It can be used to upload to github pages for example.
"""


def _split_repo_url(repo_url):
    sub_path = ''
    addr = urllib.parse.urlparse(repo_url)

    # Avoid blocking on password prompts
github hotdoc / hotdoc / hotdoc / extensions / git_upload / git_upload_extension.py View on Github external
"""GitUploadExtension"""

import os
import shutil
import subprocess
from subprocess import check_output as call
import urllib.parse

import appdirs
from hotdoc.utils.utils import recursive_overwrite
from hotdoc.core.extension import Extension
from hotdoc.core.exceptions import HotdocException
from hotdoc.utils.loggable import Logger, info, warn

Logger.register_warning_code('no-local-repository', HotdocException,
                             domain='git-uploader')
Logger.register_warning_code('dirty-local-repository', HotdocException,
                             domain='git-uploader')
Logger.register_warning_code('git-error', HotdocException,
                             domain='git-uploader')

DESCRIPTION =\
    """
An extension to upload the result of a hotdoc build
to git a repository.

It can be used to upload to github pages for example.
"""


def _split_repo_url(repo_url):
github hotdoc / hotdoc / hotdoc / core / exceptions.py View on Github external
class InvalidPageMetadata(HotdocException):
    """Invalid page metadata"""


class ConfigError(HotdocException):
    """Banana banana"""
    pass


class ParsingException(HotdocException):
    """Banana banana"""
    pass


class BadInclusionException(HotdocException):
    """Banana banana"""
    pass


class InvalidOutputException(HotdocException):
    """Banana banana"""
    pass


class MissingLinkException(HotdocException):
    """Banana banana"""
    pass


def _format_source_exception(filename, message, lineno, column):
    from hotdoc.utils.loggable import TERMC
github hotdoc / hotdoc / hotdoc / extensions / edit_on_github / edit_on_github_extension.py View on Github external
"""
Extension to add links to edit pages on github
"""
import os
import shutil
import subprocess

from hotdoc.utils.loggable import Logger, warn
from hotdoc.core.exceptions import HotdocException
from hotdoc.core.extension import Extension

HERE = os.path.abspath(os.path.dirname(__file__))
PNAME = 'edit-on-github'

Logger.register_warning_code('source-not-in-git-repo', HotdocException,
                             domain=PNAME)


class EditOnGitHubExtension(Extension):
    """Extension to upload generated doc to a git repository"""
    extension_name = PNAME
    argument_prefix = PNAME

    def __init__(self, app, project):
        self.__repo = None
        self.__repo_root = None
        self.__branch = None
        Extension.__init__(self, app, project)

    @staticmethod
    def add_arguments(parser):
github hotdoc / hotdoc / hotdoc / core / database.py View on Github external
"""Banana banana
"""
import os
import json

from collections import defaultdict, OrderedDict

# pylint: disable=import-error
# pylint: disable=import-error
from hotdoc.core.exceptions import HotdocException
from hotdoc.core.symbols import Symbol, ProxySymbol
from hotdoc.utils.signals import Signal
from hotdoc.utils.loggable import debug, warn, Logger


class RedefinedSymbolException(HotdocException):
    '''
    Exception raised when a symbol is defined twice in the same run
    '''
    pass


Logger.register_warning_code(
    'symbol-redefined', RedefinedSymbolException, 'extension')

# pylint: disable=too-few-public-methods


def serialize(obj):
    try:
        return obj.__getstate__()
    except AttributeError:
github hotdoc / hotdoc / hotdoc / core / exceptions.py View on Github external
class ConfigError(HotdocException):
    """Banana banana"""
    pass


class ParsingException(HotdocException):
    """Banana banana"""
    pass


class BadInclusionException(HotdocException):
    """Banana banana"""
    pass


class InvalidOutputException(HotdocException):
    """Banana banana"""
    pass


class MissingLinkException(HotdocException):
    """Banana banana"""
    pass


def _format_source_exception(filename, message, lineno, column):
    from hotdoc.utils.loggable import TERMC
    res = []

    diag = ''
    diag += TERMC.BOLD
    if lineno != -1:
github hotdoc / hotdoc / hotdoc / core / exceptions.py View on Github external
# You should have received a copy of the GNU Lesser General Public License
# along with this library.  If not, see .

"""Base Hotdoc Exceptions"""
import io


class HotdocException(Exception):
    """Base Hotdoc exception"""

    def __init__(self, message):
        self.message = message
        super(HotdocException, self).__init__(message)


class InvalidPageMetadata(HotdocException):
    """Invalid page metadata"""


class ConfigError(HotdocException):
    """Banana banana"""
    pass


class ParsingException(HotdocException):
    """Banana banana"""
    pass


class BadInclusionException(HotdocException):
    """Banana banana"""
    pass
github hotdoc / hotdoc / hotdoc / core / exceptions.py View on Github external
class ParsingException(HotdocException):
    """Banana banana"""
    pass


class BadInclusionException(HotdocException):
    """Banana banana"""
    pass


class InvalidOutputException(HotdocException):
    """Banana banana"""
    pass


class MissingLinkException(HotdocException):
    """Banana banana"""
    pass


def _format_source_exception(filename, message, lineno, column):
    from hotdoc.utils.loggable import TERMC
    res = []

    diag = ''
    diag += TERMC.BOLD
    if lineno != -1:
        diag += '%s:%d:%d: ' % (filename, lineno + 1, column + 1)
    else:
        diag += '%s: ' % (filename)
    diag += TERMC.NORMAL
    diag += message
github hotdoc / hotdoc / hotdoc / run_hotdoc.py View on Github external
parser.add_argument('--conf-file', help='Path to the config file',
                        dest='conf_file')
    tmpargs, _args = parser.parse_known_args(args)

    json_conf = None
    if tmpargs.conf_file:
        json_conf = load_config_json(tmpargs.conf_file)
        tmpargs.extra_extension_path += json_conf.get('extra_extension_path',
                                                      [])

    # We only get these once, doing this now means all
    # installed extensions will show up as Configurable subclasses.
    try:
        ext_classes = get_extension_classes(
            sort=True, extra_extension_paths=tmpargs.extra_extension_path)
    except HotdocException:
        return 1

    parser.add_argument('command', action="store",
                        choices=('run', 'conf', 'init', 'help'),
                        nargs="?")
    parser.add_argument('--output-conf-file',
                        help='Path where to save the updated conf'
                        ' file',
                        dest='output_conf_file')
    parser.add_argument('--init-dir',
                        help='Directory to initialize',
                        dest='init_dir')
    parser.add_argument('--version', help="Print version and exit",
                        action="store_true")
    parser.add_argument('--makefile-path',
                        help="Print path to includable "
github hotdoc / hotdoc / hotdoc / formatters / html_formatter.py View on Github external
StructSymbol, EnumSymbol, AliasSymbol, SignalSymbol, PropertySymbol,
     VFunctionSymbol, ClassSymbol, InterfaceSymbol)

from hotdoc.core.base_formatter import Formatter, _create_hierarchy_graph
from hotdoc.core.links import Link

from hotdoc.parsers.gtk_doc_parser import GtkDocStringFormatter

from hotdoc.utils.setup_utils import THEME_VERSION
from hotdoc.utils.utils import OrderedSet
from hotdoc.utils.utils import id_from_text
from hotdoc.core.exceptions import HotdocException
from hotdoc.utils.loggable import Logger, warn, info


class HtmlFormatterBadLinkException(HotdocException):
    """
    Raised when a produced html page contains an empty local link
    to nowhere.
    """
    pass


Logger.register_warning_code('bad-local-link', HtmlFormatterBadLinkException,
                             domain='html-formatter')


HERE = os.path.dirname(__file__)


# pylint: disable=too-few-public-methods
class TocSection(object):