aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTibor Frank <tifrank@cisco.com>2022-09-23 12:57:37 +0200
committerTibor Frank <tifrank@cisco.com>2022-09-26 07:22:41 +0000
commit446b9efe60eb8a528dc58e237ec9a33486566d69 (patch)
tree8dcb82d5629d04a5903af463801d754086f2c101
parent3e70381fb8c08682786fbb16ef542c3893033647 (diff)
Report: configure sphinx
Signed-off-by: Tibor Frank <tifrank@cisco.com> Change-Id: I844b15562c31beaf79d5094ed0e33b026bbb01f5
-rw-r--r--resources/tools/presentation/pal.py100
-rw-r--r--resources/tools/presentation/sphinx_conf/report/conf.py116
2 files changed, 111 insertions, 105 deletions
diff --git a/resources/tools/presentation/pal.py b/resources/tools/presentation/pal.py
index 4f9b24fedc..06f1eeda59 100644
--- a/resources/tools/presentation/pal.py
+++ b/resources/tools/presentation/pal.py
@@ -32,7 +32,7 @@ from generator_alerts import Alerting, AlertingError
from convert_xml_json import convert_xml_to_json
-OUTPUTS = (u"none", u"report", u"trending", u"convert-xml-to-json")
+OUTPUTS = ("none", "report", "trending", "convert-xml-to-json")
def parse_args():
@@ -47,60 +47,60 @@ def parse_args():
formatter_class=argparse.RawDescriptionHelpFormatter
)
parser.add_argument(
- u"-s", u"--specification",
+ "-s", "--specification",
required=True,
type=str,
- help=u"Specification YAML file."
+ help="Specification YAML file."
)
parser.add_argument(
- u"-r", u"--release",
- default=u"master",
+ "-r", "--release",
+ default="master",
type=str,
- help=u"Release string of the product."
+ help="Release string of the product."
)
parser.add_argument(
- u"-w", u"--week",
- default=u"1",
+ "-w", "--week",
+ default="1",
type=str,
- help=u"Calendar week when the report is published."
+ help="Calendar week when the report is published."
)
parser.add_argument(
- u"-l", u"--logging",
+ "-l", "--logging",
choices=[
- u"NOTSET", u"DEBUG", u"INFO", u"WARNING", u"ERROR", u"CRITICAL"
+ "NOTSET", "DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"
],
- default=u"ERROR",
- help=u"Logging level."
+ default="ERROR",
+ help="Logging level."
)
parser.add_argument(
- u"-f", u"--force",
- action=u"store_true",
- help=u"Force removing the old build(s) if present."
+ "-f", "--force",
+ action="store_true",
+ help="Force removing the old build(s) if present."
)
parser.add_argument(
- u"-o", u"--print-all-oper-data",
- action=u"store_true",
- help=u"Print all operational data to console. Be careful, the output "
- u"can be really long."
+ "-o", "--print-all-oper-data",
+ action="store_true",
+ help="Print all operational data to console. Be careful, the output "
+ "can be really long."
)
parser.add_argument(
- u"-i", u"--input-file",
+ "-i", "--input-file",
type=str,
- default=u"",
- help=u"XML file generated by RobotFramework which will be processed "
- u"instead of downloading the data from Nexus and/or Jenkins. In "
- u"this case, the section 'input' in the specification file is "
- u"ignored."
+ default="",
+ help="XML file generated by RobotFramework which will be processed "
+ "instead of downloading the data from Nexus and/or Jenkins. In "
+ "this case, the section 'input' in the specification file is "
+ "ignored."
)
parser.add_argument(
- u"-d", u"--input-directory",
+ "-d", "--input-directory",
type=str,
- default=u"",
- help=u"Directory with XML file(s) generated by RobotFramework or with "
- u"sub-directories with XML file(s) which will be processed "
- u"instead of downloading the data from Nexus and/or Jenkins. In "
- u"this case, the section 'input' in the specification file is "
- u"ignored."
+ default="",
+ help="Directory with XML file(s) generated by RobotFramework or with "
+ "sub-directories with XML file(s) which will be processed "
+ "instead of downloading the data from Nexus and/or Jenkins. In "
+ "this case, the section 'input' in the specification file is "
+ "ignored."
)
return parser.parse_args()
@@ -110,32 +110,32 @@ def main():
"""Main function."""
log_levels = {
- u"NOTSET": logging.NOTSET,
- u"DEBUG": logging.DEBUG,
- u"INFO": logging.INFO,
- u"WARNING": logging.WARNING,
- u"ERROR": logging.ERROR,
- u"CRITICAL": logging.CRITICAL
+ "NOTSET": logging.NOTSET,
+ "DEBUG": logging.DEBUG,
+ "INFO": logging.INFO,
+ "WARNING": logging.WARNING,
+ "ERROR": logging.ERROR,
+ "CRITICAL": logging.CRITICAL
}
args = parse_args()
logging.basicConfig(
- format=u"%(asctime)s: %(levelname)s: %(message)s",
- datefmt=u"%Y/%m/%d %H:%M:%S",
+ format="%(asctime)s: %(levelname)s: %(message)s",
+ datefmt="%Y/%m/%d %H:%M:%S",
level=log_levels[args.logging]
)
- logging.info(u"Application started.")
+ logging.info("Application started.")
try:
spec = Specification(args.specification)
spec.read_specification()
except PresentationError as err:
- logging.critical(u"Finished with error.")
+ logging.critical("Finished with error.")
logging.critical(repr(err))
return 1
- if spec.output[u"output"] not in OUTPUTS:
+ if spec.output["output"] not in OUTPUTS:
logging.critical(
f"The output {spec.output[u'output']} is not supported."
)
@@ -148,7 +148,7 @@ def main():
prepare_static_content(spec)
- data = InputData(spec, spec.output[u"output"])
+ data = InputData(spec, spec.output["output"])
if args.input_file:
data.process_local_file(args.input_file)
elif args.input_directory:
@@ -163,21 +163,21 @@ def main():
generate_plots(spec, data)
generate_files(spec, data)
- if spec.output[u"output"] == u"report":
+ if spec.output["output"] == "report":
generate_report(args.release, spec, args.week)
- elif spec.output[u"output"] == u"trending":
+ elif spec.output["output"] == "trending":
sys.stdout.write(generate_cpta(spec, data))
try:
alert = Alerting(spec)
alert.generate_alerts()
except AlertingError as err:
logging.warning(repr(err))
- elif spec.output[u"output"] == u"convert-xml-to-json":
+ elif spec.output["output"] == "convert-xml-to-json":
convert_xml_to_json(spec, data)
else:
logging.info("No output will be generated.")
- logging.info(u"Successfully finished.")
+ logging.info("Successfully finished.")
return_code = 0
except AlertingError as err:
@@ -192,5 +192,5 @@ def main():
return return_code
-if __name__ == u"__main__":
+if __name__ == "__main__":
sys.exit(main())
diff --git a/resources/tools/presentation/sphinx_conf/report/conf.py b/resources/tools/presentation/sphinx_conf/report/conf.py
index 68978588c5..1031ef000c 100644
--- a/resources/tools/presentation/sphinx_conf/report/conf.py
+++ b/resources/tools/presentation/sphinx_conf/report/conf.py
@@ -19,8 +19,9 @@ documentation root, use os.path.abspath to make it absolute, like shown here.
import os
import sys
+import sphinx_rtd_theme
-sys.path.insert(0, os.path.abspath(u'.'))
+sys.path.insert(0, os.path.abspath('.'))
# -- General configuration ------------------------------------------------
@@ -31,36 +32,39 @@ sys.path.insert(0, os.path.abspath(u'.'))
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
-extensions = [u'sphinxcontrib.programoutput',
- u'sphinx.ext.ifconfig']
+extensions = [
+ 'sphinxcontrib.programoutput',
+ 'sphinx.ext.ifconfig',
+ 'sphinx_rtd_theme'
+]
# Add any paths that contain templates here, relative to this directory.
-templates_path = [u'_templates']
+templates_path = ['_templates']
# The suffix(es) of source file names.
# You can specify multiple suffix as a list of string:
#
-source_suffix = [u'.rst', u'.md']
+source_suffix = ['.rst', '.md']
# The master toctree document.
-master_doc = u'index'
+master_doc = 'index'
# General information about the project.
-report_week = u'39'
-project = u'FD.io CSIT-2210.{week}'.format(week=report_week)
-copyright = u'2022, FD.io'
-author = u'FD.io CSIT'
+report_week = '39'
+project = 'FD.io CSIT-2210.{week}'.format(week=report_week)
+copyright = '2022, FD.io'
+author = 'FD.io CSIT'
-# The version info for the project you're documenting, acts as replacement for
+# The version info for the project yo're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
-# version = u''
+# version = ''
# The full version, including alpha/beta/rc tags.
-# release = u''
+# release = ''
-rst_epilog = u"""
+rst_epilog = """
.. |release-1| replace:: {prev_release}
.. |srelease| replace:: {srelease}
.. |csit-release| replace:: CSIT-{csitrelease}
@@ -125,34 +129,34 @@ rst_epilog = u"""
.. _FD.io VPP compile job: https://jenkins.fd.io/view/vpp/job/vpp-merge-{srelease}-ubuntu2004-x86_64/
.. _CSIT Testbed Setup: https://git.fd.io/csit/tree/fdio.infra.ansible?h={release}
.. _VPP startup.conf: https://git.fd.io/vpp/tree/src/vpp/conf/startup.conf?h=stable/{srelease}&id={vpp_release_commit_id}
-""".format(release=u'rls2210',
+""".format(release='rls2210',
report_week=report_week,
- prev_release=u'rls2206',
- srelease=u'2210',
- csitrelease=u'2210',
- csit_prev_release=u'2206',
- vpprelease=u'22.10',
- vpp_prev_release=u'22.06',
- dpdkrelease=u'22.07',
- dpdk_prev_release=u'22.03',
- sdpdkrelease=u'22.07',
- trex_version=u'v2.97',
- vpp_release_commit_id=u'0d352a97c5e3ad1f5f6eab18a978a14b0b9e06a8')
+ prev_release='rls2206',
+ srelease='2210',
+ csitrelease='2210',
+ csit_prev_release='2206',
+ vpprelease='22.10',
+ vpp_prev_release='22.06',
+ dpdkrelease='22.07',
+ dpdk_prev_release='22.03',
+ sdpdkrelease='22.07',
+ trex_version='v2.97',
+ vpp_release_commit_id='0d352a97c5e3ad1f5f6eab18a978a14b0b9e06a8')
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
-language = u'en'
+language = 'en'
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This patterns also effect to html_static_path and html_extra_path
-exclude_patterns = [u'_build', u'Thumbs.db', u'.DS_Store']
+exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
# The name of the Pygments (syntax highlighting) style to use.
-pygments_style = u'sphinx'
+pygments_style = 'sphinx'
# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = False
@@ -162,39 +166,41 @@ todo_include_todos = False
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
-html_theme = u'sphinx_rtd_theme'
+html_theme = 'sphinx_rtd_theme'
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
#
html_theme_options = {
- u'canonical_url': u'',
- u'analytics_id': u'',
- u'logo_only': False,
- u'display_version': True,
- u'prev_next_buttons_location': u'bottom',
- u'style_external_links': False,
+ 'analytics_id': '',
+ 'analytics_anonymize_ip': False,
+ 'logo_only': False,
+ 'display_version': True,
+ 'prev_next_buttons_location': 'bottom',
+ 'style_external_links': False,
+ 'vcs_pageview_mode': '',
+ 'style_nav_header_background': '#2980b9',
# Toc options
- u'collapse_navigation': True,
- u'sticky_navigation': True,
- u'navigation_depth': 3,
- u'includehidden': True,
- u'titles_only': False
+ 'collapse_navigation': True,
+ 'sticky_navigation': True,
+ 'navigation_depth': 4,
+ 'includehidden': True,
+ 'titles_only': False
}
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
-html_theme_path = [u'env/lib/python3.8/site-packages/sphinx_rtd_theme']
-# html_static_path = ['_build/_static']
-html_static_path = [u'_tmp/src/_static']
+html_static_path = ['_tmp/src/_static']
html_context = {
- u'css_files': [
+ 'css_files': [
+ '_static/css/theme.css',
+ '_static/css/badge_only.css',
# overrides for wide tables in RTD theme
- u'_static/theme_overrides.css'
+ '_static/theme_overrides.css',
]
}
@@ -209,12 +215,12 @@ html_split_index = False
# -- Options for LaTeX output ---------------------------------------------
-latex_engine = u'pdflatex'
+latex_engine = 'pdflatex'
latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#
- u'papersize': u'a4paper',
+ 'papersize': 'a4paper',
# The font size ('10pt', '11pt' or '12pt').
#
@@ -222,7 +228,7 @@ latex_elements = {
# Additional stuff for the LaTeX preamble.
#
- u'preamble': r'''
+ 'preamble': r'''
\usepackage{pdfpages}
\usepackage{svg}
\usepackage{charter}
@@ -235,18 +241,18 @@ latex_elements = {
# Latex figure (float) alignment
#
- u'figure_align': u'H',
+ 'figure_align': 'H',
# Latex font setup
#
- u'fontpkg': r'''
+ 'fontpkg': r'''
\renewcommand{\familydefault}{\sfdefault}
''',
# Latex other setup
#
- u'extraclassoptions': u'openany',
- u'sphinxsetup': r'''
+ 'extraclassoptions': 'openany',
+ 'sphinxsetup': r'''
TitleColor={RGB}{225,38,40},
InnerLinkColor={RGB}{62,62,63},
OuterLinkColor={RGB}{225,38,40},
@@ -260,7 +266,7 @@ latex_elements = {
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
- (master_doc, u'csit.tex', u'CSIT REPORT', u'', u'manual'),
+ (master_doc, 'csit.tex', 'CSIT REPORT', '', 'manual'),
]
# The name of an image file (relative to this directory) to place at the top of
@@ -279,7 +285,7 @@ latex_show_pagerefs = True
# If true, show URL addresses after external links.
#
-latex_show_urls = u'footnote'
+latex_show_urls = 'footnote'
# Documents to append as an appendix to all manuals.
#