mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-07 19:10:35 +00:00
doc: make conf.py know about variable substitutions
The old Texi docs had some Makefile-style variable substitutions they used to pull in information like release date, configured install path, etc. Sphinx has this ability as well, we start making use of it here. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
This commit is contained in:
parent
8d2098618c
commit
964b36623b
@ -24,7 +24,10 @@ import re
|
|||||||
# -- General configuration ------------------------------------------------
|
# -- General configuration ------------------------------------------------
|
||||||
|
|
||||||
# If your documentation needs a minimal Sphinx version, state it here.
|
# If your documentation needs a minimal Sphinx version, state it here.
|
||||||
#needs_sphinx = '1.0'
|
needs_sphinx = '1.0'
|
||||||
|
|
||||||
|
# prolog for various variable substitutions
|
||||||
|
rst_prolog = ''
|
||||||
|
|
||||||
# Add any Sphinx extension module names here, as strings. They can be
|
# Add any Sphinx extension module names here, as strings. They can be
|
||||||
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
|
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
|
||||||
@ -36,7 +39,7 @@ templates_path = ['_templates']
|
|||||||
|
|
||||||
# The suffix(es) of source filenames.
|
# The suffix(es) of source filenames.
|
||||||
# You can specify multiple suffix as a list of string:
|
# You can specify multiple suffix as a list of string:
|
||||||
# source_suffix = ['.rst', '.md']
|
# source_suffix = ['.rst']
|
||||||
source_suffix = '.rst'
|
source_suffix = '.rst'
|
||||||
|
|
||||||
# The encoding of source files.
|
# The encoding of source files.
|
||||||
@ -59,6 +62,10 @@ version = u'?.?'
|
|||||||
# The full version, including alpha/beta/rc tags.
|
# The full version, including alpha/beta/rc tags.
|
||||||
release = u'?.?-?'
|
release = u'?.?-?'
|
||||||
|
|
||||||
|
install_prefix_etc = "<install_prefix>"
|
||||||
|
|
||||||
|
# extract version information, installation location, other stuff we need to
|
||||||
|
# use when building final documents
|
||||||
val = re.compile('^S\["([^"]+)"\]="(.*)"$')
|
val = re.compile('^S\["([^"]+)"\]="(.*)"$')
|
||||||
with open('../../config.status', 'r') as cfgstatus:
|
with open('../../config.status', 'r') as cfgstatus:
|
||||||
for ln in cfgstatus.readlines():
|
for ln in cfgstatus.readlines():
|
||||||
@ -67,6 +74,17 @@ with open('../../config.status', 'r') as cfgstatus:
|
|||||||
if m.group(1) == 'PACKAGE_VERSION':
|
if m.group(1) == 'PACKAGE_VERSION':
|
||||||
release = m.group(2)
|
release = m.group(2)
|
||||||
version = release.split('-')[0]
|
version = release.split('-')[0]
|
||||||
|
if m.group(1) == 'CFG_SYSCONF':
|
||||||
|
install_prefix_etc = m.group(2)
|
||||||
|
|
||||||
|
|
||||||
|
# add substitutions to prolog
|
||||||
|
rst_prolog += '''
|
||||||
|
.. |INSTALL_PREFIX_ETC| replace:: {}
|
||||||
|
.. |PACKAGE_VERSION| replace:: {}
|
||||||
|
'''.format(install_prefix_etc, version)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||||
# for a list of supported languages.
|
# for a list of supported languages.
|
||||||
|
Loading…
Reference in New Issue
Block a user