9 import sphinx_rtd_theme
11 sphinx_rtd_theme
= None
13 import rst
.linker
as rst_linker
17 # Add the source tree and extras/ to sys.path.
18 srcdir
= os
.path
.dirname(os
.path
.dirname(os
.path
.abspath(__file__
)))
19 extrasdir
= os
.path
.join(srcdir
, 'extras')
20 sys
.path
.insert(0, srcdir
)
21 sys
.path
.insert(1, extrasdir
)
27 'sphinx.ext.coverage',
32 html_theme
= 'default'
34 # {package_url} can be provided py jaraco.packaging.sphinx but we
35 # expand the value manually to avoid the dependency.
36 package_url
= 'https://gitlab.com/git-cola/git-cola'
40 # Link dates and other references in the changelog
41 if rst_linker
is not None:
42 extensions
+= ['rst.linker']
45 '../CHANGES.rst': dict(
46 using
=dict(GH
='https://github.com', package_url
=package_url
),
49 pattern
=r
'(Issue #|\B#)(?P<issue>\d+)',
50 url
='{package_url}/issues/{issue}',
53 pattern
=r
'(?m:^((?P<scm_version>v?\d+(\.\d+){1,2}))\n[-=]+\n)',
54 with_scm
='{text}\n{rev[timestamp]:%d %b %Y}\n',
57 pattern
=r
'PEP[- ](?P<pep_number>\d+)',
58 url
='https://www.python.org/dev/peps/pep-{pep_number:0>4}/',
64 # Be strict about any broken references
67 # Preserve authored syntax for defaults
68 autodoc_preserve_defaults
= True
70 # Get the version from cola/_version.py.
71 versionfile
= os
.path
.join(srcdir
, 'cola', '_version.py')
73 with
open(versionfile
) as f
:
76 version
= scope
['VERSION'] # The short X.Y version.
77 release
= version
# The full version, including alpha/beta/rc tags.
79 authors
= 'David Aguilar and contributors'
81 ('git-cola', 'git-cola', 'The highly caffeinated Git GUI', authors
, '1'),
82 ('git-dag', 'git-dag', 'The sleek and powerful Git history browser', authors
, '1'),
85 # Sphinx 4.0 creates sub-directories for each man section.
86 # Disable this feature for consistency across Sphinx versions.
87 man_make_section_directory
= False
90 # furo overwrites "_static/pygments.css" so we monkey-patch
91 # "def _overwrite_pygments_css()" to use "static/pygments.css" instead.
92 def _overwrite_pygments_css(app
, exception
):
93 """Replacement for furo._overwrite_pygments_css to handle sphinxtogithub"""
94 if exception
is not None:
98 os
.path
.join(app
.builder
.outdir
, 'static', 'pygments.css'),
102 f
.write(furo
.get_pygments_stylesheet())
105 # Enable custom themes.
106 if furo
is not None and hasattr(furo
, '_overwrite_pygments_css'):
107 furo
._overwrite
_pygments
_css
= _overwrite_pygments_css
109 elif sphinx_rtd_theme
is not None:
110 extensions
+= ['sphinx_rtd_theme']
111 html_theme
= 'sphinx_rtd_theme'