conf.py 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. # -*- coding: utf-8 -*-
  2. #
  3. # oauth2client documentation build configuration file, created by
  4. # sphinx-quickstart on Wed Dec 17 23:13:19 2014.
  5. #
  6. import os
  7. import sys
  8. # In order to load django before 1.7, we need to create a faux
  9. # settings module and load it. This assumes django has been installed
  10. # (but it must be for the docs to build), so if it has not already
  11. # been installed run `pip install -r docs/requirements.txt`.
  12. os.environ['DJANGO_SETTINGS_MODULE'] = 'tests.contrib.django_util.settings'
  13. import django
  14. import mock
  15. from pkg_resources import get_distribution
  16. if django.VERSION[1] < 7:
  17. sys.path.insert(0, '.')
  18. # See https://read-the-docs.readthedocs.io/en/latest/faq.html#i-get-import-errors-on-libraries-that-depend-on-c-modules
  19. class Mock(mock.Mock):
  20. @classmethod
  21. def __getattr__(cls, name):
  22. return Mock()
  23. MOCK_MODULES = (
  24. 'google',
  25. 'google.appengine',
  26. 'google.appengine.api',
  27. 'google.appengine.api.app_identiy',
  28. 'google.appengine.api.urlfetch',
  29. 'google.appengine.ext',
  30. 'google.appengine.ext.webapp',
  31. 'google.appengine.ext.webapp.util',
  32. 'werkzeug.local',
  33. )
  34. # If extensions (or modules to document with autodoc) are in another directory,
  35. # add these directories to sys.path here. If the directory is relative to the
  36. # documentation root, use os.path.abspath to make it absolute, like shown here.
  37. sys.path.insert(0, os.path.abspath('..'))
  38. # -- General configuration ------------------------------------------------
  39. extensions = [
  40. 'sphinx.ext.autodoc',
  41. 'sphinx.ext.coverage',
  42. 'sphinx.ext.napoleon',
  43. 'sphinx.ext.viewcode',
  44. ]
  45. templates_path = ['_templates']
  46. source_suffix = '.rst'
  47. master_doc = 'index'
  48. # General information about the project.
  49. project = u'oauth2client'
  50. copyright = u'2014, Google, Inc'
  51. # Version info
  52. distro = get_distribution('oauth2client')
  53. version = distro.version
  54. release = distro.version
  55. exclude_patterns = ['_build']
  56. # -- Options for HTML output ----------------------------------------------
  57. # We fake our more expensive imports when building the docs.
  58. sys.modules.update((mod_name, Mock()) for mod_name in MOCK_MODULES)
  59. # We want to set the RTD theme, but not if we're on RTD.
  60. if os.environ.get('READTHEDOCS', None) != 'True':
  61. import sphinx_rtd_theme
  62. html_theme = 'sphinx_rtd_theme'
  63. html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
  64. # The name of an image file (within the static path) to use as favicon of the
  65. # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
  66. # pixels large.
  67. html_favicon = '_static/favicon.ico'
  68. html_static_path = ['_static']
  69. html_logo = '_static/google_logo.png'
  70. htmlhelp_basename = 'oauth2clientdoc'
  71. # -- Options for LaTeX output ---------------------------------------------
  72. latex_elements = {}
  73. latex_documents = [
  74. ('index', 'oauth2client.tex', u'oauth2client Documentation',
  75. u'Google, Inc.', 'manual'),
  76. ]
  77. # -- Options for manual page output ---------------------------------------
  78. man_pages = [
  79. ('index', 'oauth2client', u'oauth2client Documentation',
  80. [u'Google, Inc.'], 1)
  81. ]
  82. # -- Options for Texinfo output -------------------------------------------
  83. texinfo_documents = [
  84. ('index', 'oauth2client', u'oauth2client Documentation',
  85. u'Google, Inc.', 'oauth2client', 'One line description of project.',
  86. 'Miscellaneous'),
  87. ]