# -*- coding: utf-8 -*-
#
# circuit documentation build configuration file, created by
# sphinx-quickstart on Mon Jun 29 10:27:08 2015.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are commented out
# serve to show the default.

from pathlib import Path
import json
import sys

# 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('.'))

local_path = Path(__file__).parent
package_json_path = local_path / '../package.json'
sys.path.insert(0, str(local_path / 'extensions'))

with open(package_json_path, encoding='utf-8') as fp:
    package_json_info = json.load(fp)
    VERSION = package_json_info['version']
    PROJECT_NAME = package_json_info['name']

# -- 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.intersphinx',
    'sphinx.ext.mathjax',
    'sphinx.ext.todo',
    'blueconfig_sphinx',
]

# General information about the project.
project = PROJECT_NAME

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = VERSION
# The full version, including alpha/beta/rc tags.
release = VERSION

# -- Options for HTML output ----------------------------------------------

# The theme to use for HTML and HTML Help pages.  See the documentation for
# a list of builtin themes.
html_theme = 'sphinx-bluebrain-theme'
html_theme_options = {'metadata_file': '../package.json'}

# The name for this set of Sphinx documents.  If None, it defaults to
# "<project> v<release> documentation".
html_title = 'Circuit documentation'

# 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']

# If true, links to the reST sources are added to the pages.
html_show_sourcelink = False

todo_include_todos = True

# to have a SONATA config version as a global substitution value
CURRENT_SONATA_CONFIG_VERSION = "2.4"  # update this value as needed
rst_epilog = f'.. |CurrentSonataConfigVersion| replace:: "{CURRENT_SONATA_CONFIG_VERSION}"'
