Skip to content

Commit f2e1297

Browse files
authored
Merge pull request #137 from openSUSE/toms/fix-doc
Fix documentation crash due to renaming
2 parents 3f45fec + d3d61a3 commit f2e1297

52 files changed

Lines changed: 639 additions & 363 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

changelog.d/137.doc.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix documentation issues due to renaming of classes with underscores.
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
docbuild.cli.callback
2+
=====================
3+
4+
.. py:module:: docbuild.cli.callback
5+
6+
.. autoapi-nested-parse::
7+
8+
Click callback to validate doctype strings.
9+
10+
11+
12+
Functions
13+
---------
14+
15+
.. autoapisummary::
16+
17+
docbuild.cli.callback.validate_doctypes
18+
19+
20+
Module Contents
21+
---------------
22+
23+
.. py:function:: validate_doctypes(ctx: click.Context, param: click.Parameter | None, doctypes: tuple[str, Ellipsis]) -> list[docbuild.models.doctype.Doctype]
24+
25+
Click callback function to validate a list of doctype strings.
26+
27+
Each string must conform to the format: PRODUCT/DOCSET@LIFECYCLE/LANGS
28+
LANGS can be a single language code, a comma-separated list (no spaces),
29+
or '*' for all.
30+
Defaults and wildcards (*) are handled.
31+
32+
:param param: The click parameter that triggered this callback.
33+
:param doctypes: A tuple of doctype strings to validate.
34+
:return: A list of validated Doctype objects.
35+
:raises click.Abort: If any doctype string is invalid, the command is aborted.
36+
37+

docs/source/reference/_autoapi/docbuild/cli/cmd_metadata/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Functions
2929
Package Contents
3030
----------------
3131

32-
.. py:function:: metadata(ctx: click.Context, doctypes: tuple[docbuild.models.doctype.Doctype]) -> None
32+
.. py:function:: metadata(ctx: click.Context, doctypes: tuple[docbuild.models.doctype.Doctype], exitfirst: bool, skip_repo_update: bool) -> None
3333
3434
Subcommand to create metadata files.
3535

docs/source/reference/_autoapi/docbuild/cli/cmd_metadata/metaprocess/index.rst

Lines changed: 38 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,29 +15,38 @@ Functions
1515
.. autoapisummary::
1616

1717
docbuild.cli.cmd_metadata.metaprocess.get_deliverable_from_doctype
18+
docbuild.cli.cmd_metadata.metaprocess.collect_files_flat
1819
docbuild.cli.cmd_metadata.metaprocess.process_deliverable
20+
docbuild.cli.cmd_metadata.metaprocess.update_repositories
1921
docbuild.cli.cmd_metadata.metaprocess.process_doctype
22+
docbuild.cli.cmd_metadata.metaprocess.store_productdocset_json
2023
docbuild.cli.cmd_metadata.metaprocess.process
2124

2225

2326
Module Contents
2427
---------------
2528

26-
.. py:function:: get_deliverable_from_doctype(root: lxml.etree._ElementTree, context: docbuild.cli.context.DocBuildContext, doctype: docbuild.models.doctype.Doctype) -> list[docbuild.models.deliverable.Deliverable]
29+
.. py:function:: get_deliverable_from_doctype(root: lxml.etree._ElementTree, doctype: docbuild.models.doctype.Doctype) -> list[docbuild.models.deliverable.Deliverable]
2730
2831
Get deliverable from doctype.
2932

3033
:param root: The stitched XML node containing configuration.
31-
:param context: The DocBuildContext containing environment configuration.
3234
:param doctype: The Doctype object to process.
3335
:return: A list of deliverables for the given doctype.
3436

3537

38+
.. py:function:: collect_files_flat(doctypes: collections.abc.Sequence[docbuild.models.doctype.Doctype], basedir: pathlib.Path | str) -> collections.abc.Generator[tuple[docbuild.models.doctype.Doctype, str, list[pathlib.Path]], Any, None]
39+
40+
Group files by (Product, Docset).
41+
42+
Yields (Doctype, Docset, List[Path]) using a flattened iteration strategy.
43+
44+
3645
.. py:function:: process_deliverable(deliverable: docbuild.models.deliverable.Deliverable, *, repo_dir: pathlib.Path, temp_repo_dir: pathlib.Path, base_cache_dir: pathlib.Path, meta_cache_dir: pathlib.Path, dapstmpl: str) -> bool
3746
:async:
3847

3948

40-
Process a single deliverable.
49+
Process a single deliverable asynchronously.
4150

4251
This function creates a temporary clone of the deliverable's repository,
4352
checks out the correct branch, and then executes the DAPS command to
@@ -58,7 +67,17 @@ Module Contents
5867
:raises ValueError: If required configuration paths are missing.
5968

6069

61-
.. py:function:: process_doctype(root: lxml.etree._ElementTree, context: docbuild.cli.context.DocBuildContext, doctype: docbuild.models.doctype.Doctype) -> bool
70+
.. py:function:: update_repositories(deliverables: list[docbuild.models.deliverable.Deliverable], bare_repo_dir: pathlib.Path) -> bool
71+
:async:
72+
73+
74+
Update all Git repositories associated with the deliverables.
75+
76+
:param deliverables: A list of Deliverable objects.
77+
:param bare_repo_dir: The root directory for storing permanent bare clones.
78+
79+
80+
.. py:function:: process_doctype(root: lxml.etree._ElementTree, context: docbuild.cli.context.DocBuildContext, doctype: docbuild.models.doctype.Doctype, *, exitfirst: bool = False, skip_repo_update: bool = False) -> list[docbuild.models.deliverable.Deliverable]
6281
:async:
6382

6483

@@ -67,16 +86,29 @@ Module Contents
6786
:param root: The stitched XML node containing configuration.
6887
:param context: The DocBuildContext containing environment configuration.
6988
:param doctypes: A tuple of Doctype objects to process.
89+
:param exitfirst: If True, stop processing on the first failure.
90+
:return: True if all files passed validation, False otherwise
91+
92+
93+
.. py:function:: store_productdocset_json(context: docbuild.cli.context.DocBuildContext, doctypes: collections.abc.Sequence[docbuild.models.doctype.Doctype], stitchnode: lxml.etree._ElementTree) -> None
94+
95+
Collect all JSON file for product/docset and create a single file.
96+
97+
:param context: Beschreibung
98+
:param doctypes: Beschreibung
99+
:param stitchnode: Beschreibung
70100

71101

72-
.. py:function:: process(context: docbuild.cli.context.DocBuildContext, doctypes: tuple[docbuild.models.doctype.Doctype]) -> int
102+
.. py:function:: process(context: docbuild.cli.context.DocBuildContext, doctypes: collections.abc.Sequence[docbuild.models.doctype.Doctype] | None, *, exitfirst: bool = False, skip_repo_update: bool = False) -> int
73103
:async:
74104

75105

76106
Asynchronous function to process metadata retrieval.
77107

78108
:param context: The DocBuildContext containing environment configuration.
79-
:param xmlfiles: A tuple or iterator of XML file paths to validate.
109+
:param doctype: A Doctype object to process.
110+
:param exitfirst: If True, stop processing on the first failure.
111+
:param skip_repo_update: If True, skip updating Git repositories before processing.
80112
:raises ValueError: If no envconfig is found or if paths are not
81113
configured correctly.
82114
:return: 0 if all files passed validation, 1 if any failures occurred.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
docbuild.cli.cmd_validate.process.ValidationResult
2+
==================================================
3+
4+
.. py:class:: docbuild.cli.cmd_validate.process.ValidationResult
5+
6+
Normalized result of RNG validation.
7+
8+
:ivar success: True when validation passed.
9+
:ivar exit_code: Exit code to return when validation fails (0 for success).
10+
:ivar message: Optional human-readable message describing the failure.
11+

docs/source/reference/_autoapi/docbuild/cli/cmd_validate/process/index.rst

Lines changed: 65 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,19 @@ docbuild.cli.cmd_validate.process
99

1010

1111

12+
Classes
13+
-------
14+
15+
.. toctree::
16+
:hidden:
17+
18+
/reference/_autoapi/docbuild/cli/cmd_validate/process/ValidationResult
19+
20+
.. autoapisummary::
21+
22+
docbuild.cli.cmd_validate.process.ValidationResult
23+
24+
1225
Functions
1326
---------
1427

@@ -18,6 +31,10 @@ Functions
1831
docbuild.cli.cmd_validate.process.validate_rng
1932
docbuild.cli.cmd_validate.process.validate_rng_lxml
2033
docbuild.cli.cmd_validate.process.run_python_checks
34+
docbuild.cli.cmd_validate.process.build_shortname
35+
docbuild.cli.cmd_validate.process.run_validation
36+
docbuild.cli.cmd_validate.process.parse_tree
37+
docbuild.cli.cmd_validate.process.run_checks_and_display
2138
docbuild.cli.cmd_validate.process.process_file
2239
docbuild.cli.cmd_validate.process.process
2340

@@ -35,7 +52,7 @@ Module Contents
3552
:param max_len: Maximum length for formatting the output.
3653

3754

38-
.. py:function:: validate_rng(xmlfile: pathlib.Path, rng_schema_path: pathlib.Path = PRODUCT_CONFIG_SCHEMA, *, xinclude: bool = True, idcheck: bool = True) -> tuple[bool, str]
55+
.. py:function:: validate_rng(xmlfile: pathlib.Path, rng_schema_path: pathlib.Path = PRODUCT_CONFIG_SCHEMA, *, xinclude: bool = True, idcheck: bool = True) -> subprocess.CompletedProcess
3956
:async:
4057

4158

@@ -46,7 +63,8 @@ Module Contents
4663
more robust for complex XInclude statements, including those with XPointer.
4764

4865
:param xmlfile: The path to the XML file to validate.
49-
:param rng_schema_path: The path to the RELAX NG schema file. It supports both RNC and RNG formats.
66+
:param rng_schema_path: The path to the RELAX NG schema file.
67+
It supports both RNC and RNG formats.
5068
:param xinclude: If True, resolve XIncludes with `xmllint` before validation.
5169
:param idcheck: If True, perform ID uniqueness checks.
5270
:return: A tuple containing a boolean success status and any output message.
@@ -74,6 +92,51 @@ Module Contents
7492
:return: A list of tuples containing check names and their results.
7593

7694

95+
.. py:function:: build_shortname(filepath: pathlib.Path | str) -> str
96+
97+
Return a shortened display name for ``filepath``.
98+
99+
:param filepath: Path-like object to shorten.
100+
:returns: Shortened display name (last two path components or full path).
101+
102+
103+
.. py:function:: run_validation(filepath: pathlib.Path | str, method: str) -> ValidationResult
104+
:async:
105+
106+
107+
Run RNG validation using the selected method and normalize result.
108+
109+
:param filepath: Path to the XML file to validate.
110+
:param method: Validation method name ("jing" or "lxml").
111+
:returns: A :class:`ValidationResult` describing the outcome.
112+
113+
114+
.. py:function:: parse_tree(filepath: pathlib.Path | str) -> lxml.etree._ElementTree
115+
:async:
116+
117+
118+
Parse XML file using lxml in a background thread.
119+
120+
Exceptions from :func:`lxml.etree.parse` (for example
121+
:class:`lxml.etree.XMLSyntaxError`) are propagated to the caller.
122+
123+
:param filepath: Path to the XML file to parse.
124+
:returns: Parsed :class:`lxml.etree._ElementTree`.
125+
126+
127+
.. py:function:: run_checks_and_display(tree: lxml.etree._ElementTree, shortname: str, context: docbuild.cli.context.DocBuildContext, max_len: int) -> bool
128+
:async:
129+
130+
131+
Execute registered Python checks and print formatted results.
132+
133+
:param tree: Parsed XML tree to check.
134+
:param shortname: Short name used for display output.
135+
:param context: :class:`DocBuildContext` used to read verbosity.
136+
:param max_len: Maximum length used for aligned output.
137+
:returns: True when all checks succeeded (or when no checks are registered).
138+
139+
77140
.. py:function:: process_file(filepath: pathlib.Path | str, context: docbuild.cli.context.DocBuildContext, max_len: int) -> int
78141
:async:
79142

docs/source/reference/_autoapi/docbuild/cli/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ Submodules
2626
.. toctree::
2727
:maxdepth: 1
2828

29+
/reference/_autoapi/docbuild/cli/callback/index
2930
/reference/_autoapi/docbuild/cli/cmd_build/index
3031
/reference/_autoapi/docbuild/cli/cmd_c14n/index
3132
/reference/_autoapi/docbuild/cli/cmd_cli/index

docs/source/reference/_autoapi/docbuild/config/app/PlaceholderResolver.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,16 @@ docbuild.config.app.PlaceholderResolver
1414

1515

1616

17+
.. py:method:: get_container_name() -> str
18+
19+
Public accessor for the current container/key name.
20+
21+
This provides a stable, public way to retrieve the human-readable
22+
container name for diagnostics and tests without reaching into
23+
private attributes.
24+
25+
26+
1727
.. py:method:: replace() -> dict[str, Any]
1828
1929
Replace all placeholders in the configuration.

docs/source/reference/_autoapi/docbuild/config/app/index.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Attributes
1515
.. autoapisummary::
1616

1717
docbuild.config.app.MAX_RECURSION_DEPTH
18+
docbuild.config.app.ConfigValue
1819

1920

2021
Exceptions
@@ -64,6 +65,13 @@ Module Contents
6465
The maximum recursion depth for placeholder replacement.
6566

6667

68+
.. py:type:: ConfigValue
69+
:canonical: str | int | float | bool | list['ConfigValue'] | dict[str, 'ConfigValue']
70+
71+
72+
A recursive type for values found in the configuration.
73+
74+
6775
.. py:function:: replace_placeholders(config: dict[str, Any] | None, max_recursion_depth: int = MAX_RECURSION_DEPTH) -> dict[str, Any] | None
6876
6977
Replace placeholder values in a nested dictionary structure.

docs/source/reference/_autoapi/docbuild/config/xml/stitch/index.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Functions
1515
.. autoapisummary::
1616

1717
docbuild.config.xml.stitch.load_check_functions
18+
docbuild.config.xml.stitch.log_memory_usage
1819
docbuild.config.xml.stitch.check_stitchfile
1920
docbuild.config.xml.stitch.create_stitchfile
2021

@@ -27,6 +28,13 @@ Module Contents
2728
Load all check functions from :mod:`docbuild.config.xml.checks`.
2829

2930

31+
.. py:function:: log_memory_usage() -> int
32+
33+
Determine the memory usage.
34+
35+
:return: memory usage in kilobytes
36+
37+
3038
.. py:function:: check_stitchfile(tree: lxml.etree._Element | lxml.etree._ElementTree) -> bool
3139
3240
Check the stitchfile for unresolved references.

0 commit comments

Comments
 (0)