]> git.puffer.fish Git - mirror/frr.git/commitdiff
doc: copy conf.py for developer's docs
authorQuentin Young <qlyoung@cumulusnetworks.com>
Wed, 31 Jan 2018 21:16:07 +0000 (16:16 -0500)
committerQuentin Young <qlyoung@cumulusnetworks.com>
Wed, 31 Jan 2018 22:27:06 +0000 (17:27 -0500)
Info extracted will probably prove useful here as well.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
doc/developer/conf.py

index 233056666dbb2cf8e5f4c91341e93c4f7b5448b0..1eac6af7639aa5d40c0eca038888ef70d5384c39 100644 (file)
@@ -24,7 +24,10 @@ import re
 # -- General configuration ------------------------------------------------
 
 # 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
 # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
@@ -36,7 +39,7 @@ templates_path = ['_templates']
 
 # The suffix(es) of source filenames.
 # You can specify multiple suffix as a list of string:
-# source_suffix = ['.rst', '.md']
+# source_suffix = ['.rst']
 source_suffix = '.rst'
 
 # The encoding of source files.
@@ -59,14 +62,51 @@ version = u'?.?'
 # The full version, including alpha/beta/rc tags.
 release = u'?.?-?'
 
+
+# -----------------------------------------------------------------------------
+# Extract values from codebase for substitution into docs.
+# -----------------------------------------------------------------------------
+
+# Various installation prefixes. Reasonable defaults are set where possible.
+# Values are overridden by logic below.
+replace_vars = {
+    'AUTHORS': 'Kunihiro Ishiguro, et al.',
+    'COPYRIGHT_YEAR': '1999-2005',
+    'COPYRIGHT_STR': None,
+    'PACKAGE_NAME': project.lower(),
+    'PACKAGE_TARNAME': project.lower(),
+    'PACKAGE_STRING': None,
+    'PACKAGE_URL': 'https://frrouting.org/',
+    'PACKAGE_VERSION': None,
+    'INSTALL_PREFIX_ETC': None,
+    'INSTALL_PREFIX_SBIN': None,
+    'INSTALL_PREFIX_STATE': None,
+    'INSTALL_PREFIX_MODULES': None,
+    'INSTALL_USER': None,
+    'INSTALL_GROUP': None,
+    'INSTALL_VTY_GROUP': None,
+}
+
+# extract version information, installation location, other stuff we need to
+# use when building final documents
 val = re.compile('^S\["([^"]+)"\]="(.*)"$')
 with open('../../config.status', 'r') as cfgstatus:
     for ln in cfgstatus.readlines():
         m = val.match(ln)
-        if m is None: continue
-        if m.group(1) == 'PACKAGE_VERSION':
-            release = m.group(2)
-            version = release.split('-')[0]
+        if not m or m.group(1) not in replace_vars.keys(): continue
+        replace_vars[m.group(1)] = m.group(2)
+
+# manually fill out some of these we can't get from config.status
+replace_vars['COPYRIGHT_STR'] = "Copyright (c)"
+replace_vars['COPYRIGHT_STR'] += ' {}'.format(replace_vars['COPYRIGHT_YEAR'])
+replace_vars['COPYRIGHT_STR'] += ' {}'.format(replace_vars['AUTHORS'])
+release = replace_vars['PACKAGE_VERSION']
+version = release.split('-')[0]
+
+# add substitutions to prolog
+for key, value in replace_vars.items():
+    rst_prolog += '.. |{0}| replace:: {1}\n'.format(key, value)
+
 
 # The language for content autogenerated by Sphinx. Refer to documentation
 # for a list of supported languages.
@@ -231,7 +271,7 @@ latex_elements = {
 # (source start file, target name, title,
 #  author, documentclass [howto, manual, or own class]).
 latex_documents = [
-    (master_doc, 'FRR.tex', u'FRR Developer\'s Manual',
+    (master_doc, 'FRR.tex', u'FRR User Manual',
      u'FRR', 'manual'),
 ]
 
@@ -261,7 +301,7 @@ latex_documents = [
 # One entry per manual page. List of tuples
 # (source start file, name, description, authors, manual section).
 man_pages = [
-    (master_doc, 'frr', u'FRR Developer\'s Manual',
+    (master_doc, 'frr', u'FRR User Manual',
      [author], 1)
 ]
 
@@ -275,7 +315,7 @@ man_pages = [
 # (source start file, target name, title, author,
 #  dir menu entry, description, category)
 texinfo_documents = [
-    (master_doc, 'FRR', u'FRR Developer\'s Manual',
+    (master_doc, 'FRR', u'FRR User Manual',
      author, 'FRR', 'One line description of project.',
      'Miscellaneous'),
 ]
@@ -291,3 +331,9 @@ texinfo_documents = [
 
 # If true, do not generate a @detailmenu in the "Top" node's menu.
 #texinfo_no_detailmenu = False
+
+# custom extensions here
+def setup(app):
+    # object type for FRR CLI commands, can be extended to document parent CLI
+    # node later on
+    app.add_object_type('clicmd', 'clicmd')