diff options
| author | Quentin Schulz <quentin.schulz@theobroma-systems.com> | 2021-07-26 17:33:57 +0200 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2021-07-26 23:05:05 +0100 |
| commit | 7ade8346b3a09983257589d22aaada47e0eec010 (patch) | |
| tree | 634932b452d7c2a090dc67d5fa945561ddc83c3a /bitbake/doc/bitbake-user-manual/bitbake-user-manual-intro.rst | |
| parent | 3b6742685ba313bbe6c7c05cb1542041ebdcbf16 (diff) | |
| download | poky-7ade8346b3a09983257589d22aaada47e0eec010.tar.gz | |
bitbake: doc: bitbake-user-manual: replace ``FOO`` by :term:`FOO` where possible
If a variable has a glossary entry and some rST files write about those
variables, it's better to point to the glossary entry instead of just
highlighting it by surrounding it with two tick quotes.
The script that is used to do the replacement of ``FOO`` by :term:`FOO`
is the following Python code:
import re
from pathlib import Path
from runpy import run_module
import contextlib
import io
import sys
re_term = re.compile(r'variables.html#term-([a-zA-Z_0-9]*)')
terms = []
new_terms = set()
with contextlib.redirect_stdout(io.StringIO()) as f:
run_module('sphinx.ext.intersphinx', run_name='__main__')
objects = f.getvalue()
match = re_term.search(objects)
while match:
if match.group(1):
terms.append(match.group(1))
match = re_term.search(objects, match.end())
for rst in Path('.').rglob('*.rst'):
with open(rst, 'r') as f:
content = "".join(f.readlines())
for term in terms:
content = re.sub(r'``({})``(?!.*\s+[~=-]{{{:d},}})'.format(term, len(term)), r':term:`\1`', content)
with open(rst, 'w') as f:
f.write(content)
This script takes one argument as input: an objects.inv which can be
gotten from doc/_build/html/objetcs.inv after running `make html`.
Note that this excludes from replacement terms that appear in section
titles as it requires refs to be changed too. This can be automated too
if need be but right now it looks a bit confusing to have an anchor link
(for sections) also have a term/reference link in it. I am not sure this
is desired today.
(Bitbake rev: aba88f40c47133ed9bc999e0298aca3bc8490912)
Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
Signed-off-by: Quentin Schulz <foss@0leil.net>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/doc/bitbake-user-manual/bitbake-user-manual-intro.rst')
| -rw-r--r-- | bitbake/doc/bitbake-user-manual/bitbake-user-manual-intro.rst | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-intro.rst b/bitbake/doc/bitbake-user-manual/bitbake-user-manual-intro.rst index b3cea61fff..eb1406652a 100644 --- a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-intro.rst +++ b/bitbake/doc/bitbake-user-manual/bitbake-user-manual-intro.rst | |||
| @@ -537,7 +537,7 @@ current working directory: | |||
| 537 | To stop depending on common depends, use the "-I" depend option and | 537 | To stop depending on common depends, use the "-I" depend option and |
| 538 | BitBake omits them from the graph. Leaving this information out can | 538 | BitBake omits them from the graph. Leaving this information out can |
| 539 | produce more readable graphs. This way, you can remove from the graph | 539 | produce more readable graphs. This way, you can remove from the graph |
| 540 | ``DEPENDS`` from inherited classes such as ``base.bbclass``. | 540 | :term:`DEPENDS` from inherited classes such as ``base.bbclass``. |
| 541 | 541 | ||
| 542 | Here are two examples that create dependency graphs. The second example | 542 | Here are two examples that create dependency graphs. The second example |
| 543 | omits depends common in OpenEmbedded from the graph:: | 543 | omits depends common in OpenEmbedded from the graph:: |
| @@ -564,7 +564,7 @@ for two separate targets: | |||
| 564 | .. image:: figures/bb_multiconfig_files.png | 564 | .. image:: figures/bb_multiconfig_files.png |
| 565 | :align: center | 565 | :align: center |
| 566 | 566 | ||
| 567 | The reason for this required file hierarchy is because the ``BBPATH`` | 567 | The reason for this required file hierarchy is because the :term:`BBPATH` |
| 568 | variable is not constructed until the layers are parsed. Consequently, | 568 | variable is not constructed until the layers are parsed. Consequently, |
| 569 | using the configuration file as a pre-configuration file is not possible | 569 | using the configuration file as a pre-configuration file is not possible |
| 570 | unless it is located in the current working directory. | 570 | unless it is located in the current working directory. |
