Skip to content
Snippets Groups Projects
Select Git revision
  • 3ca87334942dccd7b22aeea3ae278728bfb4d323
  • master default
  • test
  • rahix/hw-lock-new-mutex
  • dx/somewhat-more-dynamic-config
  • schneider/sdk-0.2.1-7
  • schneider/bsec
  • dx/meh-bdf-to-stm
  • dx/flatten-config-module
  • genofire/ble-follow-py
  • schneider/ble-stability
  • schneider/ble-stability-new-phy
  • add_menu_vibration
  • plaetzchen/ios-workaround
  • blinkisync-as-preload
  • schneider/max30001-pycardium
  • schneider/max30001-epicaridum
  • schneider/max30001
  • schneider/stream-locks
  • schneider/fundamental-test
  • schneider/ble-buffers
  • v1.12
  • v1.11
  • v1.10
  • v1.9
  • v1.8
  • v1.7
  • v1.6
  • v1.5
  • v1.4
  • v1.3
  • v1.2
  • v1.1
  • v1.0
  • release-1
  • bootloader-v1
  • v0.0
37 results

conf.py

Blame
  • Forked from card10 / firmware
    1684 commits behind the upstream repository.
    ch3's avatar
    ch3 authored and Rahix committed
    Co-authored-by: default avatarRahix <rahix@rahix.de>
    3ca87334
    History
    conf.py 3.07 KiB
    import os
    import subprocess
    import sys
    import time
    import sphinx.util.logging
    
    # If extensions (or modules to document with autodoc) are in another directory,
    # add these directories to sys.path here. If the directory is relative to the
    # documentation root, use os.path.abspath to make it absolute, like shown here.
    #
    sys.path.insert(0, os.path.abspath("../pycardium/modules/py"))
    sys.path.insert(0, os.path.abspath("./"))
    
    logger = sphinx.util.logging.getLogger("card10/conf.py")
    
    
    # -- Project information -----------------------------------------------------
    
    project = "card10-firmware"
    copyright = "2019"
    
    # The full version, including alpha/beta/rc tags
    release = subprocess.check_output(
        ["git", "describe", "--long", "--always"]
    ).decode().strip()
    release += "<br />"
    release += time.strftime("%F %R")
    version = release
    
    
    # -- General configuration ---------------------------------------------------
    
    # Add any Sphinx extension module names here, as strings. They can be
    # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
    # ones.
    extensions = [
        "sphinx.ext.autodoc",
        "sphinx.ext.viewcode",
        "sphinx.ext.ifconfig",
    ]
    
    # List of patterns, relative to source directory, that match files and
    # directories to ignore when looking for source files.
    # This pattern also affects html_static_path and html_extra_path.
    exclude_patterns = ["output", "Thumbs.db", ".DS_Store", "hawkmoth"]
    
    # -- Options for HTML output ------------------------------------------------- {{{
    
    # The Read the Docs theme is available from
    # - https://github.com/snide/sphinx_rtd_theme
    # - https://pypi.python.org/pypi/sphinx_rtd_theme
    # - python-sphinx-rtd-theme package (on Debian)
    try:
        import sphinx_rtd_theme
        html_theme = "sphinx_rtd_theme"
        html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
        pygments_style = "monokai"
    except ImportError:
        logger.warning("The Sphinx \"sphinx_rtd_theme\" HTML theme was not found. Make sure you have the theme installed to produce pretty HTML output. Falling back to the default theme.")
    
    
    # Add any paths that contain custom static files (such as style sheets) here,
    # relative to this directory. They are copied after the builtin static files,
    # so a file named "default.css" will overwrite the builtin "default.css".
    html_static_path = ["static"]
    # }}}
    
    # -- Options for Auto-Doc ---------------------------------------------------- {{{
    autodoc_mock_imports = [
        "ucollections",
        "urandom",
        "utime",
    ]
    
    autodoc_member_order = "bysource"
    # }}}
    
    # -- Options for Hawkmoth ---------------------------------------------------- {{{
    has_hawkmoth = False
    try:
        # Attempt importing hawkmoth
        import hawkmoth  # noqa: F401
        extensions.append("hawkmoth")
    
        cautodoc_root = os.path.abspath("..")
        has_hawkmoth = True
    except ImportError as e:
        if e.name == "clang":
            logger.warning("hawkmoth requires the clang python module.  Documentation for Epicardium API will not be generated.")
    # }}}
    
    
    # -- Sphinx Setup ------------------------------------------------------------
    def setup(app):
        app.add_config_value("has_hawkmoth", has_hawkmoth, "")