[5 DOCS PATCH] waf: Backport from main build fixes
chrisj at rtems.org
chrisj at rtems.org
Thu Nov 10 04:35:50 UTC 2022
From: Chris Johns <chrisj at rtems.org>
Closes #4752
---
common/conf.py | 17 ++++++------
common/latex.py | 7 +++--
common/rtemsdomain.py | 64 +++++++++++++++++++++++++++++++------------
common/version.py | 5 +++-
common/waf.py | 20 ++++++++++----
5 files changed, 78 insertions(+), 35 deletions(-)
diff --git a/common/conf.py b/common/conf.py
index 257bc4e..565e06d 100644
--- a/common/conf.py
+++ b/common/conf.py
@@ -1,4 +1,4 @@
-import version as rtems_version
+import datetime
extensions = [
"sphinx.ext.autodoc",
@@ -12,6 +12,8 @@ extensions = [
"rtemsdomain",
]
+bibtex_bibfiles = ['../common/refs.bib']
+
extlinks = {'release_path': ('https://ftp.rtems.org/pub/rtems/releases', None) }
# Add any paths that contain templates here, relative to this directory.
@@ -28,21 +30,17 @@ master_doc = 'index'
# General information about the project.
project = u'RTEMS Documentation Project'
-copyright = u'1988, 2020 RTEMS Project and contributors'
+copyright = u'1988, ' + str(datetime.datetime.now().year) + ' RTEMS Project and contributors'
# The version info for the project you'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 = rtems_version.version()
+#version = rtems_version.version()
# The full version, including alpha/beta/rc tags.
-release = rtems_version.string()
-
-major = rtems_version.major()
-minor = rtems_version.minor()
-revision = rtems_version.revision()
+#release = rtems_version.string()
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
@@ -75,6 +73,9 @@ exclude_patterns = []
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
+# http://www.sphinx-doc.org/en/master/usage/configuration.html#confval-numfig
+numfig = True
+
# A list of ignored prefixes for module index sorting.
#modindex_common_prefix = []
diff --git a/common/latex.py b/common/latex.py
index a042510..17d3015 100644
--- a/common/latex.py
+++ b/common/latex.py
@@ -3,7 +3,6 @@
#
import os
-import platform
import re
package_test_preamble = ['\\newif\\ifsphinxKeepOldNames \\sphinxKeepOldNamestrue',
@@ -82,7 +81,11 @@ def tex_test(test):
def host_name():
uname = os.uname()
if uname[0] == 'Linux':
- distro = platform.dist()
+ try:
+ from distro import linux_distribution
+ except:
+ from platform import linux_distribution
+ distro = linux_distribution()
name = '%s/%s' % (uname[0], distro[0])
version = distro[1]
else:
diff --git a/common/rtemsdomain.py b/common/rtemsdomain.py
index 9b092a3..630f1e3 100644
--- a/common/rtemsdomain.py
+++ b/common/rtemsdomain.py
@@ -8,6 +8,8 @@ from sphinx.domains import Domain, ObjType, Index
from sphinx.util.nodes import make_refnode
from sphinx.util.docfields import Field, TypedField
+import version as rtems_version
+
"""
:r:bsp:`sparc/sis`
@@ -30,28 +32,28 @@ role_name = {
}
role_url = {
- "trac": ("Trac", "https://devel.rtems.org"),
- "devel": ("Developer Site", "https://devel.rtems.org"),
- "www": ("RTEMS Home", "https://www.rtems.org/"),
- "buildbot": ("Buildbot Instance", "https://buildbot.rtems.org/"),
- "builder": ("Builder Site", "https://builder.rtems.org/"),
- "docs": ("Documentation Site", "https://docs.rtems.org/"),
- "lists": ("Mailing Lists", "https://lists.rtems.org/"),
- "git": ("Git Repositories", "https://git.rtems.org/"),
- "ftp": ("FTP File Server", "https://ftp.rtems.org/"),
- "review": ("Gerrit Code Review", "https://review.rtems.org/"),
- "bugs": ("Bugs Database", "https://devel.rtems.org/wiki/Bugs/"),
- "gsoc": ("Google Summer of Code", "https://devel.rtems.org/wiki/GSoC/"),
- "socis": ("ESA SOCIS", "https://devel.rtems.org/wiki/SOCIS/")
+ "trac": ("Trac", "https://devel.rtems.org"),
+ "devel": ("Developer Site", "https://devel.rtems.org"),
+ "www": ("RTEMS Home", "https://www.rtems.org/"),
+ "buildbot": ("Buildbot Instance", "https://buildbot.rtems.org/"),
+ "builder": ("Builder Site", "https://builder.rtems.org/"),
+ "docs": ("Documentation Site", "https://docs.rtems.org/"),
+ "lists": ("Mailing Lists", "https://lists.rtems.org/"),
+ "git": ("Git Repositories", "https://git.rtems.org/"),
+ "ftp": ("FTP File Server", "https://ftp.rtems.org/"),
+ "review": ("Gerrit Code Review", "https://review.rtems.org/"),
+ "bugs": ("Bugs Database", "https://devel.rtems.org/wiki/Bugs/"),
+ "gsoc": ("Google Summer of Code", "https://devel.rtems.org/wiki/GSoC/"),
+ "socis": ("ESA SOCIS", "https://devel.rtems.org/wiki/SOCIS/")
}
role_list = {
- "announce": ("Announce Mailing List", "https://lists.rtems.org/mailman/listinfo/announce/"),
- "bugs": ("Bugs Mailing List", "https://lists.rtems.org/mailman/listinfo/bugs/"),
- "devel": ("Developers Mailing List", "https://lists.rtems.org/mailman/listinfo/devel/"),
- "build": ("Build Logs", "https://lists.rtems.org/mailman/listinfo/build"),
- "users": ("Users Mailing List", "https://lists.rtems.org/mailman/listinfo/users/"),
+ "announce": ("Announce Mailing List", "https://lists.rtems.org/mailman/listinfo/announce/"),
+ "bugs": ("Bugs Mailing List", "https://lists.rtems.org/mailman/listinfo/bugs/"),
+ "devel": ("Developers Mailing List", "https://lists.rtems.org/mailman/listinfo/devel/"),
+ "build": ("Build Logs", "https://lists.rtems.org/mailman/listinfo/build"),
+ "users": ("Users Mailing List", "https://lists.rtems.org/mailman/listinfo/users/"),
"vc": ("Version Control Mailing List", "https://lists.rtems.org/mailman/listinfo/vc/"),
}
@@ -119,7 +121,33 @@ class RTEMSDomain(Domain):
pass # XXX is this needed?
+def rtems_replace(app, docname, source):
+ dump = False
+ line = source[0]
+ for key in app.config.replacements:
+ line = line.replace(key, app.config.replacements[key])
+ source[0] = line
+
+replacements = {
+}
def setup(app):
+ app.add_config_value('rtems_major', str(app.config.overrides['rtems_major']), True)
+ app.add_config_value('rtems_minor', str(app.config.overrides['rtems_minor']), True)
+ app.add_config_value('rtems_revision', str(app.config.overrides['rtems_revision']), True)
+ major = str(app.config.overrides['rtems_major'])
+ minor = str(app.config.overrides['rtems_minor'])
+ revision = str(app.config.overrides['rtems_revision'])
+ if revision.isdigit():
+ majminrev = major + '.' + minor + '.' + revision
+ else:
+ majminrev = major + '.' + revision
+ replacements["@rtems-version@"] = str(app.config.overrides['version'])
+ replacements["@rtems-ver-major@"] = major
+ replacements["@rtems-ver-minor@"] = minor
+ replacements["@rtems-ver-revision@"] = revision
+ replacements["@rtems-ver-majminrev@"] = majminrev
+ app.add_config_value('replacements', replacements, True)
+ app.connect('source-read', rtems_replace)
app.add_domain(RTEMSDomain)
return {'version': "1.0", 'parallel_read_safe': True}
diff --git a/common/version.py b/common/version.py
index 281c880..bfe0e1b 100644
--- a/common/version.py
+++ b/common/version.py
@@ -111,6 +111,9 @@ def _pretty_day(ctx, date):
def get(ctx, rtems_major_version):
global _version
+ global _major
+ global _minor
+ global _revision
global _date
global _released
version = _version
@@ -184,7 +187,7 @@ def minor():
return _minor
def revision():
- return revision
+ return _revision
def date():
return _date
diff --git a/common/waf.py b/common/waf.py
index 7027eb6..8584f88 100644
--- a/common/waf.py
+++ b/common/waf.py
@@ -181,13 +181,18 @@ def check_sphinx_extension(ctx, extension):
def run_sphinx(bld):
rst_node = bld.srcnode.make_node('testbuild/contents.rst')
rst_node.parent.mkdir()
- rst_node.write('.. COMMENT test sphinx\n')
+ rst_node.write('.. COMMENT test sphinx' + os.linesep)
+ bib_node = bld.srcnode.make_node('testbuild/refs.bib')
+ bib_node.write(os.linesep)
+ conf_node = bld.srcnode.make_node('testbuild/conf.py')
+ conf_node.write(os.linesep.join(["master_doc='contents'",
+ "bibtex_bibfiles = ['refs.bib']"]))
bld(rule = bld.kw['rule'], source = rst_node)
ctx.start_msg("Checking for '%s'" % (extension))
try:
ctx.run_build(fragment = 'xx',
- rule = "${BIN_SPHINX_BUILD} -b html -D extensions=%s -C . out" % (extension),
+ rule = "${BIN_SPHINX_BUILD} -b html -D extensions=%s -c . . out" % (extension),
build_fun = run_sphinx,
env = ctx.env)
except ctx.errors.ConfigurationError:
@@ -266,7 +271,7 @@ def cmd_configure(ctx):
ctx.fatal('Unsupported latex engine: %s' % (conf.latex_engine))
ctx.env.BUILD_PDF = 'yes'
- ctx.envBUILD_SINGLEHTML = 'no'
+ ctx.env.BUILD_SINGLEHTML = 'no'
if ctx.options.singlehtml:
check_inliner = not ctx.env.BIN_INLINER
if check_inliner:
@@ -276,7 +281,7 @@ def cmd_configure(ctx):
ctx.fatal("Node.js inliner is required install with 'npm install -g inliner' " +
"(https://github.com/remy/inliner)")
- ctx.envBUILD_PLANTUML = 'no'
+ ctx.env.BUILD_PLANTUML = 'no'
if ctx.options.plantuml:
check_plantuml = not ctx.env.BIN_PUML
if check_plantuml:
@@ -286,7 +291,7 @@ def cmd_configure(ctx):
ctx.fatal("Node.js puml is required install with 'npm install -g node-plantuml' " +
"(https://www.npmjs.com/package/node-plantuml)")
- ctx.envBUILD_DITAA = 'no'
+ ctx.env.BUILD_DITAA = 'no'
if ctx.options.ditaa:
#
# We use DITAA via PlantUML
@@ -335,12 +340,15 @@ def doc_pdf(ctx, source_dir, conf_dir, sources):
target = ctx.path.find_or_declare("%s/%s.tex" % (buildtype,
ctx.path.name))
)
+ env_latex = ctx.env.derive()
+ env_latex.TEXINPUTS = output_dir + ':'
ctx(
features = 'tex',
cwd = output_dir,
type = ctx.env.LATEX_CMD,
source = "%s/%s.tex" % (buildtype, ctx.path.name),
- prompt = 0
+ prompt = 0,
+ env = env_latex
)
ctx.install_files('${PREFIX}',
'%s/%s.pdf' % (buildtype, ctx.path.name),
--
2.37.1
More information about the devel
mailing list