# Sphinx configuration for the libCEC Python (SWIG) API.
#
# The `cec` module is generated by SWIG from src/libcec/libcec.i, which
# %include's cec.h and cectypes.h. The docs pipeline (docs.yml) runs
#   swig -python -py3 -doxygen ... -o <gen>/cec_wrap.cxx src/libcec/libcec.i
# so SWIG carries cec.h's Doxygen comments into `cec.py` as Python docstrings.
# We do NOT compile/link the native `_cec` extension here — importing the pure
# Python wrapper is enough for autodoc, so the C extension is mocked. The path
# to the generated cec.py is passed in via the CEC_PY_MODULE_DIR env var.

import os
import sys

gen_dir = os.environ.get("CEC_PY_MODULE_DIR")
if gen_dir:
    sys.path.insert(0, gen_dir)

project = "libCEC Python API"
copyright = "Pulse-Eight Limited"
author = "Pulse-Eight Limited"
release = os.environ.get("LIBCEC_VERSION", "")

extensions = [
    "sphinx.ext.autodoc",
    "sphinx.ext.napoleon",
    "sphinx.ext.viewcode",
]

# The compiled SWIG extension is not built for the docs; mock it so `import cec`
# (which does `from . import _cec` / `import _cec`) succeeds during autodoc.
autodoc_mock_imports = ["_cec"]

autodoc_default_options = {
    "members": True,
    "undoc-members": True,
    "show-inheritance": True,
}
autodoc_member_order = "bysource"

templates_path = []
exclude_patterns = ["_build"]

# furo is a clean, responsive theme with light/dark support.
html_theme = "furo"
html_title = "libCEC Python API"
html_logo = "../assets/pulse-eight-logo.png"
html_static_path = []
