#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# python-webuntis documentation build configuration file, created by
# sphinx-quickstart on Mon Jun 25 15:07:44 2012.
#
# 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.

import sys, os

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


# -- General configuration -----------------------------------------------------

extensions = ['sphinx.ext.autodoc', 'sphinx.ext.intersphinx']
templates_path = ['_templates']
source_suffix = '.rst'
master_doc = 'index'

project = 'python-webuntis'
copyright = u'2013, Markus Unterwaditzer; 2018, August Hörandl'

# 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.
#
import pkg_resources
try:
    release = pkg_resources.require('webuntis')[0].version  # The full version, including alpha/beta/rc tags.
except pkg_resources.DistributionNotFound:
    print('To build the documentation, the distribution information of'
          'python-webuntis has to be available. Run "setup.py develop" to do'
          'this.')
    sys.exit(1)

del pkg_resources

version = '.'.join(release.split('.')[:2])  # The short X.Y version.

exclude_patterns = ['_build']
pygments_style = 'sphinx'

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

html_theme = 'default'
html_static_path = ['_static']
htmlhelp_basename = 'python-webuntisdoc'


# -- Options for LaTeX output --------------------------------------------------

latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#'papersize': 'letterpaper',

# The font size ('10pt', '11pt' or '12pt').
#'pointsize': '10pt',

# Additional stuff for the LaTeX preamble.
#'preamble': '',
}

# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual]).
latex_documents = [
  ('index', 'python-webuntis.tex', 'python-webuntis Documentation',
   u'Markus Unterwaditzer, August Hörandl', 'manual'),
]


# -- Options for manual page output --------------------------------------------

# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
    ('index', 'python-webuntis', 'python-webuntis Documentation',
     ['Markus Unterwaditzer', u'August Hörandl'], 1)
]


# -- Options for Texinfo output ------------------------------------------------

# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
#  dir menu entry, description, category)
texinfo_documents = [
  ('index', 'python-webuntis', 'python-webuntis Documentation',
   u'Markus Unterwaditzer, August Hörandl', 'python-webuntis', 'Bindings for WebUntis.',
   'Miscellaneous'),
]


# -- Misc mods -----------------------------------------------------------------

# http://stackoverflow.com/a/8415805
def skip_modules_docstring(app, what, name, obj, options, lines):
    if what == 'module':
        del lines[:]

def setup(app):
    app.connect('autodoc-process-docstring', skip_modules_docstring)

# intersphinx
intersphinx_mapping = {"http://docs.python.org/2/": None}
