99< meta name ="viewport " content ="width=device-width, initial-scale=1, minimum-scale=1 " />
1010< meta name ="generator " content ="pdoc 0.9.2 " />
1111< title > continuous_delivery_scripts.generate_docs API documentation</ title >
12- < meta name ="description " content ="Generates documentation using Pdoc . " />
12+ < meta name ="description " content ="Generates documentation. " />
1313< link rel ="preload stylesheet " as ="style " href ="https://cdnjs.cloudflare.com/ajax/libs/10up-sanitize.css/11.0.1/sanitize.min.css " integrity ="sha256-PK9q560IAAa6WVRRh76LtCaI8pjTJ2z11v0miyNNjrs= " crossorigin >
1414< link rel ="preload stylesheet " as ="style " href ="https://cdnjs.cloudflare.com/ajax/libs/10up-sanitize.css/11.0.1/typography.min.css " integrity ="sha256-7l/o7C8jubJiy74VsKTidCy1yBkRtiUGbVkYBylBqUg= " crossorigin >
1515< link rel ="stylesheet preload " as ="style " href ="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.1.1/styles/github.min.css " crossorigin >
2626< h1 class ="title "> Module < code > continuous_delivery_scripts.generate_docs</ code > </ h1 >
2727</ header >
2828< section id ="section-intro ">
29- < p > Generates documentation using Pdoc .</ p >
29+ < p > Generates documentation.</ p >
3030< details class ="source ">
3131< summary >
3232< span > Expand source code</ span >
3333</ summary >
3434< pre > < code class ="python "> #
35- # Copyright (C) 2020 Arm Mbed . All rights reserved.
35+ # Copyright (C) 2020 Arm. All rights reserved.
3636# SPDX-License-Identifier: Apache-2.0
3737#
38- """Generates documentation using Pdoc."""
38+ """Generates documentation."""
39+ import argparse
40+ import logging
3941import os
4042import shutil
4143import sys
42-
43- import argparse
44- import logging
4544from pathlib import Path
46- from subprocess import check_call
47- from typing import List
4845
46+ from continuous_delivery_scripts.language_specifics import get_language_specifics
4947from continuous_delivery_scripts.utils.configuration import configuration, ConfigurationVariable
50- from continuous_delivery_scripts.utils.filesystem_helpers import TemporaryDirectory
5148from continuous_delivery_scripts.utils.logging import log_exception
5249
5350logger = logging.getLogger(__name__)
@@ -59,40 +56,11 @@ <h1 class="title">Module <code>continuous_delivery_scripts.generate_docs</code><
5956 shutil.rmtree(str(output_directory))
6057
6158
62- def _generate_pdoc_command_list(output_directory: Path, module: str) -> List[str]:
63- return [
64- "pdoc",
65- "--html",
66- f"{module}",
67- "--output-dir",
68- f"{str(output_directory)}",
69- "--force",
70- "--config",
71- "show_type_annotations=True",
72- ]
73-
74-
7559def generate_documentation(output_directory: Path, module_to_document: str) -> None:
76- """Ensures the documentation is in the correct location.
77-
78- Pdoc nests its docs output in a folder with the module's name.
79- This process removes this unwanted folder.
80- """
60+ """Generates the documentation."""
8161 _clear_previous_docs(output_directory)
8262 os.makedirs(str(output_directory), exist_ok=True)
83- with TemporaryDirectory() as temp_dir:
84- _call_pdoc(temp_dir, module_to_document)
85- docs_contents_dir = temp_dir.joinpath(module_to_document)
86- if docs_contents_dir.exists() and docs_contents_dir.is_dir():
87- for element in docs_contents_dir.iterdir():
88- shutil.move(str(element), str(output_directory))
89-
90-
91- def _call_pdoc(output_directory: Path, module: str) -> None:
92- """Calls Pdoc for generating the docs."""
93- logger.info("Creating Pdoc documentation.")
94- command_list = _generate_pdoc_command_list(output_directory, module)
95- check_call(command_list)
63+ get_language_specifics().generate_code_documentation(output_directory, module_to_document)
9664
9765
9866def generate_docs(output_directory: Path, module: str) -> int:
@@ -153,27 +121,16 @@ <h2 class="section-title" id="header-functions">Functions</h2>
153121< span > def < span class ="ident "> generate_documentation</ span > </ span > (< span > output_directory: pathlib.Path, module_to_document: str) ‑> NoneType</ span >
154122</ code > </ dt >
155123< dd >
156- < div class ="desc "> < p > Ensures the documentation is in the correct location.</ p >
157- < p > Pdoc nests its docs output in a folder with the module's name.
158- This process removes this unwanted folder.</ p > </ div >
124+ < div class ="desc "> < p > Generates the documentation.</ p > </ div >
159125< details class ="source ">
160126< summary >
161127< span > Expand source code</ span >
162128</ summary >
163129< pre > < code class ="python "> def generate_documentation(output_directory: Path, module_to_document: str) -> None:
164- """Ensures the documentation is in the correct location.
165-
166- Pdoc nests its docs output in a folder with the module's name.
167- This process removes this unwanted folder.
168- """
130+ """Generates the documentation."""
169131 _clear_previous_docs(output_directory)
170132 os.makedirs(str(output_directory), exist_ok=True)
171- with TemporaryDirectory() as temp_dir:
172- _call_pdoc(temp_dir, module_to_document)
173- docs_contents_dir = temp_dir.joinpath(module_to_document)
174- if docs_contents_dir.exists() and docs_contents_dir.is_dir():
175- for element in docs_contents_dir.iterdir():
176- shutil.move(str(element), str(output_directory))</ code > </ pre >
133+ get_language_specifics().generate_code_documentation(output_directory, module_to_document)</ code > </ pre >
177134</ details >
178135</ dd >
179136< dt id ="continuous_delivery_scripts.generate_docs.main "> < code class ="name flex ">
0 commit comments