garden: enable the virtualenv when it exists
[git-cola.git] / docs / conf.py
blobb200ae9a815eaee58e5bd60d042e21fcb122a236
1 import os
2 import sys
4 try:
5 import sphinx_rtd_theme
6 except ImportError:
7 sphinx_rtd_theme = None
8 try:
9 import rst.linker as rst_linker
10 except ImportError:
11 rst_linker = None
13 # Add the source tree and extras/ to sys.path.
14 srcdir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
15 extrasdir = os.path.join(srcdir, 'extras')
16 sys.path.insert(0, srcdir)
17 sys.path.insert(1, extrasdir)
19 extensions = [
20 'sphinx.ext.autodoc',
21 'sphinx.ext.doctest',
22 'sphinx.ext.todo',
23 'sphinx.ext.coverage',
24 'sphinxtogithub',
27 master_doc = 'index'
28 html_theme = 'default'
30 # {package_url} can be provided py jaraco.packaging.sphinx but we
31 # expand the value manually to avoid the dependency.
32 package_url = 'https://gitlab.com/git-cola/git-cola'
34 project = 'Git Cola'
36 # Link dates and other references in the changelog
37 if rst_linker is not None:
38 extensions += ['rst.linker']
40 link_files = {
41 '../CHANGES.rst': dict(
42 using=dict(GH='https://github.com', package_url=package_url),
43 replace=[
44 dict(
45 pattern=r'(Issue #|\B#)(?P<issue>\d+)',
46 url='{package_url}/issues/{issue}',
48 dict(
49 pattern=r'(?m:^((?P<scm_version>v?\d+(\.\d+){1,2}))\n[-=]+\n)',
50 with_scm='{text}\n{rev[timestamp]:%d %b %Y}\n',
52 dict(
53 pattern=r'PEP[- ](?P<pep_number>\d+)',
54 url='https://www.python.org/dev/peps/pep-{pep_number:0>4}/',
60 # Be strict about any broken references
61 nitpicky = True
63 # Preserve authored syntax for defaults
64 autodoc_preserve_defaults = True
66 # Get the version from cola/_version.py.
67 versionfile = os.path.join(srcdir, 'cola', '_version.py')
68 scope = {}
69 with open(versionfile) as f:
70 exec(f.read(), scope)
72 version = scope['VERSION'] # The short X.Y version.
73 release = version # The full version, including alpha/beta/rc tags.
75 authors = 'David Aguilar and contributors'
76 man_pages = [
77 ('git-cola', 'git-cola', 'The highly caffeinated Git GUI', authors, '1'),
78 ('git-dag', 'git-dag', 'The sleek and powerful Git history browser', authors, '1'),
81 # Sphinx 4.0 creates sub-directories for each man section.
82 # Disable this feature for consistency across Sphinx versions.
83 man_make_section_directory = False
85 # Enable the sphinx_rtd_theme.
86 if sphinx_rtd_theme is not None:
87 extensions += ['sphinx_rtd_theme']
88 html_theme = 'sphinx_rtd_theme'