continuous-delivery-scripts 4.4.3__tar.gz → 4.5.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {continuous_delivery_scripts-4.4.3/continuous_delivery_scripts.egg-info → continuous_delivery_scripts-4.5.0}/PKG-INFO +1 -1
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/continuous_delivery_scripts/_version.py +4 -4
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/continuous_delivery_scripts/generate_docs.py +93 -36
- continuous_delivery_scripts-4.5.0/continuous_delivery_scripts/generate_news.py +72 -0
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/continuous_delivery_scripts/plugins/GOLAND.MD +27 -0
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/continuous_delivery_scripts/plugins/golang.py +85 -6
- continuous_delivery_scripts-4.5.0/continuous_delivery_scripts/templates/documentation_landing.html.jinja2 +7 -0
- continuous_delivery_scripts-4.5.0/continuous_delivery_scripts/templates/documentation_page.html.jinja2 +19 -0
- continuous_delivery_scripts-4.5.0/continuous_delivery_scripts/templates/llms-full.txt.jinja2 +15 -0
- continuous_delivery_scripts-4.5.0/continuous_delivery_scripts/templates/llms.txt.jinja2 +13 -0
- continuous_delivery_scripts-4.5.0/continuous_delivery_scripts/templates/robots.txt.jinja2 +3 -0
- continuous_delivery_scripts-4.5.0/continuous_delivery_scripts/utils/changelog.py +108 -0
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/continuous_delivery_scripts/utils/configuration.py +2 -0
- continuous_delivery_scripts-4.5.0/continuous_delivery_scripts/utils/documentation_discovery.py +218 -0
- continuous_delivery_scripts-4.5.0/continuous_delivery_scripts/utils/documentation_templates.py +18 -0
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/continuous_delivery_scripts/utils/git_helpers.py +21 -20
- continuous_delivery_scripts-4.5.0/continuous_delivery_scripts/utils/github_helpers.py +75 -0
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0/continuous_delivery_scripts.egg-info}/PKG-INFO +1 -1
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/continuous_delivery_scripts.egg-info/SOURCES.txt +9 -0
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/pyproject.toml +5 -1
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/setup.py +4 -1
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/spdx-tmp/GitPython.spdx +1 -1
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/spdx-tmp/Jinja2.spdx +1 -1
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/spdx-tmp/Mako.spdx +1 -1
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/spdx-tmp/Markdown.spdx +1 -1
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/spdx-tmp/MarkupSafe.spdx +1 -1
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/spdx-tmp/PyYAML.spdx +1 -1
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/spdx-tmp/Pygments.spdx +1 -1
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/spdx-tmp/SecretStorage.spdx +1 -1
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/spdx-tmp/beartype.spdx +4 -4
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/spdx-tmp/boolean.py.spdx +1 -1
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/spdx-tmp/boto3.spdx +4 -4
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/spdx-tmp/botocore.spdx +4 -4
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/spdx-tmp/bracex.spdx +4 -4
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/spdx-tmp/certifi.spdx +1 -1
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/spdx-tmp/cffi.spdx +1 -1
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/spdx-tmp/charset-normalizer.spdx +1 -1
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/spdx-tmp/click.spdx +1 -1
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/spdx-tmp/continuous-delivery-scripts.spdx +166 -85
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/spdx-tmp/cryptography.spdx +1 -1
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/spdx-tmp/detect-secrets.spdx +1 -1
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/spdx-tmp/docutils.spdx +1 -1
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/spdx-tmp/gibberish-detector.spdx +1 -1
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/spdx-tmp/gitdb.spdx +1 -1
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/spdx-tmp/id.spdx +1 -1
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/spdx-tmp/idna.spdx +1 -1
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/spdx-tmp/jaraco.classes.spdx +1 -1
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/spdx-tmp/jaraco.context.spdx +1 -1
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/spdx-tmp/jaraco.functools.spdx +1 -1
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/spdx-tmp/jeepney.spdx +1 -1
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/spdx-tmp/jellyfish.spdx +1 -1
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/spdx-tmp/jmespath.spdx +1 -1
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/spdx-tmp/keyring.spdx +1 -1
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/spdx-tmp/license-expression.spdx +1 -1
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/spdx-tmp/licenseheaders.spdx +1 -1
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/spdx-tmp/markdown-it-py.spdx +1 -1
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/spdx-tmp/mdurl.spdx +1 -1
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/spdx-tmp/more-itertools.spdx +1 -1
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/spdx-tmp/nh3.spdx +1 -1
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/spdx-tmp/packaging.spdx +1 -1
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/spdx-tmp/pdoc3.spdx +1 -1
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/spdx-tmp/ply.spdx +1 -1
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/spdx-tmp/pyautoversion.spdx +1 -1
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/spdx-tmp/pycparser.spdx +4 -4
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/spdx-tmp/pyparsing.spdx +1 -1
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/spdx-tmp/python-dateutil.spdx +1 -1
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/spdx-tmp/python-dotenv.spdx +1 -1
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/spdx-tmp/rdflib.spdx +1 -1
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/spdx-tmp/readme_renderer.spdx +1 -1
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/spdx-tmp/regex.spdx +1 -1
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/spdx-tmp/requests-toolbelt.spdx +1 -1
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/spdx-tmp/requests.spdx +1 -1
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/spdx-tmp/rfc3986.spdx +1 -1
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/spdx-tmp/rich.spdx +1 -1
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/spdx-tmp/s3transfer.spdx +1 -1
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/spdx-tmp/semantic-version.spdx +1 -1
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/spdx-tmp/semver.spdx +1 -1
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/spdx-tmp/setuptools.spdx +1 -1
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/spdx-tmp/six.spdx +1 -1
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/spdx-tmp/smmap.spdx +1 -1
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/spdx-tmp/spdx-tools.spdx +1 -1
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/spdx-tmp/toml.spdx +1 -1
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/spdx-tmp/towncrier.spdx +1 -1
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/spdx-tmp/twine.spdx +1 -1
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/spdx-tmp/uritools.spdx +1 -1
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/spdx-tmp/urllib3.spdx +1 -1
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/spdx-tmp/wcmatch.spdx +4 -4
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/spdx-tmp/xmltodict.spdx +1 -1
- continuous_delivery_scripts-4.4.3/continuous_delivery_scripts/generate_news.py +0 -129
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/LICENSE +0 -0
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/MANIFEST.in +0 -0
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/README.md +0 -0
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/continuous_delivery_scripts/__init__.py +0 -0
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/continuous_delivery_scripts/assert_news.py +0 -0
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/continuous_delivery_scripts/check_licence_compliance.py +0 -0
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/continuous_delivery_scripts/create_news_file.py +0 -0
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/continuous_delivery_scripts/detect_secrets.py +0 -0
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/continuous_delivery_scripts/get_config.py +0 -0
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/continuous_delivery_scripts/get_version.py +0 -0
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/continuous_delivery_scripts/language_specifics.py +0 -0
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/continuous_delivery_scripts/license_files.py +0 -0
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/continuous_delivery_scripts/plugins/BASIC.MD +0 -0
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/continuous_delivery_scripts/plugins/CI.MD +0 -0
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/continuous_delivery_scripts/plugins/GITHUB_ACTIONS.MD +0 -0
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/continuous_delivery_scripts/plugins/NOOP.MD +0 -0
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/continuous_delivery_scripts/plugins/PYTHON.MD +0 -0
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/continuous_delivery_scripts/plugins/__init__.py +0 -0
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/continuous_delivery_scripts/plugins/basic.py +0 -0
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/continuous_delivery_scripts/plugins/ci.py +0 -0
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/continuous_delivery_scripts/plugins/docker.py +0 -0
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/continuous_delivery_scripts/plugins/github_actions.py +0 -0
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/continuous_delivery_scripts/plugins/noop.py +0 -0
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/continuous_delivery_scripts/plugins/python.py +0 -0
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/continuous_delivery_scripts/report_third_party_ip.py +0 -0
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/continuous_delivery_scripts/spdx_report/__init__.py +0 -0
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/continuous_delivery_scripts/spdx_report/data/licence_assessment.toml +0 -0
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/continuous_delivery_scripts/spdx_report/licence_assessment.py +0 -0
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/continuous_delivery_scripts/spdx_report/scancode_licence_db.py +0 -0
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/continuous_delivery_scripts/spdx_report/spdx_dependency.py +0 -0
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/continuous_delivery_scripts/spdx_report/spdx_document.py +0 -0
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/continuous_delivery_scripts/spdx_report/spdx_file.py +0 -0
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/continuous_delivery_scripts/spdx_report/spdx_helpers.py +0 -0
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/continuous_delivery_scripts/spdx_report/spdx_package.py +0 -0
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/continuous_delivery_scripts/spdx_report/spdx_project.py +0 -0
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/continuous_delivery_scripts/spdx_report/spdx_summary.py +0 -0
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/continuous_delivery_scripts/spdx_report/templates/third_party_IP_report.csv.jinja2 +0 -0
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/continuous_delivery_scripts/spdx_report/templates/third_party_IP_report.html.jinja2 +0 -0
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/continuous_delivery_scripts/spdx_report/templates/third_party_IP_report.txt.jinja2 +0 -0
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/continuous_delivery_scripts/tag_and_release.py +0 -0
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/continuous_delivery_scripts/update_secrets_registry.py +0 -0
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/continuous_delivery_scripts/utils/__init__.py +0 -0
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/continuous_delivery_scripts/utils/aws_helpers.py +0 -0
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/continuous_delivery_scripts/utils/definitions.py +0 -0
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/continuous_delivery_scripts/utils/filesystem_helpers.py +0 -0
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/continuous_delivery_scripts/utils/hash_helpers.py +0 -0
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/continuous_delivery_scripts/utils/language_specifics_base.py +0 -0
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/continuous_delivery_scripts/utils/logging.py +0 -0
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/continuous_delivery_scripts/utils/news_file.py +0 -0
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/continuous_delivery_scripts/utils/noop/__init__.py +0 -0
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/continuous_delivery_scripts/utils/noop/package_helpers.py +0 -0
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/continuous_delivery_scripts/utils/package_helpers.py +0 -0
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/continuous_delivery_scripts/utils/python/__init__.py +0 -0
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/continuous_delivery_scripts/utils/python/package_helpers.py +0 -0
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/continuous_delivery_scripts/utils/python/python_helpers.py +0 -0
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/continuous_delivery_scripts/utils/string_helpers.py +0 -0
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/continuous_delivery_scripts/utils/third_party_licences.py +0 -0
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/continuous_delivery_scripts/utils/versioning.py +0 -0
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/continuous_delivery_scripts.egg-info/dependency_links.txt +0 -0
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/continuous_delivery_scripts.egg-info/entry_points.txt +0 -0
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/continuous_delivery_scripts.egg-info/requires.txt +0 -0
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/continuous_delivery_scripts.egg-info/top_level.txt +0 -0
- {continuous_delivery_scripts-4.4.3 → continuous_delivery_scripts-4.5.0}/setup.cfg +0 -0
|
@@ -11,8 +11,8 @@ References
|
|
|
11
11
|
This file is autogenerated, do not modify by hand.
|
|
12
12
|
"""
|
|
13
13
|
|
|
14
|
-
__version__ = "4.
|
|
15
|
-
COMMIT = "
|
|
14
|
+
__version__ = "4.5.0"
|
|
15
|
+
COMMIT = "5217f9f567fc0c9e7ab7486189e21a4d1b913fd0"
|
|
16
16
|
MAJOR = 4
|
|
17
|
-
MINOR =
|
|
18
|
-
PATCH =
|
|
17
|
+
MINOR = 5
|
|
18
|
+
PATCH = 0
|
|
@@ -17,6 +17,12 @@ import markdown
|
|
|
17
17
|
|
|
18
18
|
from continuous_delivery_scripts.language_specifics import get_language_specifics
|
|
19
19
|
from continuous_delivery_scripts.utils.configuration import configuration, ConfigurationVariable
|
|
20
|
+
from continuous_delivery_scripts.utils.documentation_discovery import (
|
|
21
|
+
documentation_site_url,
|
|
22
|
+
publish_discovery_files,
|
|
23
|
+
structured_data_script,
|
|
24
|
+
)
|
|
25
|
+
from continuous_delivery_scripts.utils.documentation_templates import documentation_templates
|
|
20
26
|
from continuous_delivery_scripts.utils.logging import log_exception
|
|
21
27
|
|
|
22
28
|
logger = logging.getLogger(__name__)
|
|
@@ -27,23 +33,32 @@ def _html_guide_link(match: re.Match[str]) -> str:
|
|
|
27
33
|
return f'href="{match.group(1)}.html{match.group(2) or ""}"'
|
|
28
34
|
|
|
29
35
|
|
|
30
|
-
def _html_page(
|
|
36
|
+
def _html_page(
|
|
37
|
+
title: str,
|
|
38
|
+
description: str,
|
|
39
|
+
body: str,
|
|
40
|
+
nav_prefix: str = "..",
|
|
41
|
+
has_api_index: bool = True,
|
|
42
|
+
page_url: str | None = None,
|
|
43
|
+
schema_type: str = "TechArticle",
|
|
44
|
+
) -> str:
|
|
31
45
|
"""Wrap a task guide in a standalone, readable HTML page."""
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
46
|
+
return str(
|
|
47
|
+
documentation_templates()
|
|
48
|
+
.get_template("documentation_page.html.jinja2")
|
|
49
|
+
.render(
|
|
50
|
+
title=title,
|
|
51
|
+
description=description,
|
|
52
|
+
body=body,
|
|
53
|
+
nav_prefix=nav_prefix,
|
|
54
|
+
has_api_index=has_api_index,
|
|
55
|
+
structured_data=structured_data_script(title, description, page_url, schema_type) if page_url else None,
|
|
56
|
+
)
|
|
42
57
|
)
|
|
43
58
|
|
|
44
59
|
|
|
45
|
-
def
|
|
46
|
-
"""
|
|
60
|
+
def _update_api_navigation(output_directory: Path, guide_output: Path) -> None:
|
|
61
|
+
"""Preserve API index links and provide a route back to task guides."""
|
|
47
62
|
original_index = output_directory / "index.html"
|
|
48
63
|
if not original_index.is_file():
|
|
49
64
|
return
|
|
@@ -62,6 +77,27 @@ def _preserve_api_navigation(output_directory: Path, guide_output: Path) -> None
|
|
|
62
77
|
|
|
63
78
|
contents = page.read_text(encoding="utf8")
|
|
64
79
|
updated = re.sub(r'href="((?:\.\./|\./)*index\.html(?:#[^"]*)?)"', retarget, contents)
|
|
80
|
+
guide_href = (
|
|
81
|
+
"../" * len(page.parent.relative_to(output_directory).parts)
|
|
82
|
+
+ (guide_output.relative_to(output_directory) / "index.html").as_posix()
|
|
83
|
+
)
|
|
84
|
+
guide_link = f'<a href="{escape(guide_href, quote=True)}">Task guides</a>'
|
|
85
|
+
if re.search(r"<nav\b[^>]*>", updated, flags=re.IGNORECASE):
|
|
86
|
+
updated = re.sub(
|
|
87
|
+
r"(<nav\b[^>]*>)",
|
|
88
|
+
lambda match: f"{match.group(1)}{guide_link} · ",
|
|
89
|
+
updated,
|
|
90
|
+
count=1,
|
|
91
|
+
flags=re.IGNORECASE,
|
|
92
|
+
)
|
|
93
|
+
else:
|
|
94
|
+
updated = re.sub(
|
|
95
|
+
r"(<body\b[^>]*>)",
|
|
96
|
+
lambda match: f"{match.group(1)}<nav>{guide_link}</nav>",
|
|
97
|
+
updated,
|
|
98
|
+
count=1,
|
|
99
|
+
flags=re.IGNORECASE,
|
|
100
|
+
)
|
|
65
101
|
if updated != contents:
|
|
66
102
|
page.write_text(updated, encoding="utf8")
|
|
67
103
|
|
|
@@ -90,55 +126,64 @@ def _guide_settings() -> tuple[Path, Path, Path, str] | None:
|
|
|
90
126
|
return project_root, guide_sources, guide_folder, project_name
|
|
91
127
|
|
|
92
128
|
|
|
93
|
-
def _render_guide(
|
|
129
|
+
def _render_guide(
|
|
130
|
+
source: Path, destination: Path, project_name: str, nav_prefix: str, has_api_index: bool, page_url: str | None
|
|
131
|
+
) -> str:
|
|
94
132
|
"""Render one Markdown guide to an HTML page and return its title."""
|
|
95
133
|
text = source.read_text(encoding="utf8")
|
|
96
134
|
title = next((line[2:].strip() for line in text.splitlines() if line.startswith("# ")), source.stem)
|
|
97
135
|
body: str = markdown.markdown(text, extensions=["fenced_code", "tables"])
|
|
98
136
|
body = re.sub(r'href="([a-z0-9-]+)\.md(#[^"]*)?"', _html_guide_link, body)
|
|
99
137
|
description = f"{title} — {project_name}."
|
|
100
|
-
destination.write_text(_html_page(title, description, body, nav_prefix, has_api_index), encoding="utf8")
|
|
138
|
+
destination.write_text(_html_page(title, description, body, nav_prefix, has_api_index, page_url), encoding="utf8")
|
|
101
139
|
return title
|
|
102
140
|
|
|
103
141
|
|
|
104
142
|
def _render_guides(
|
|
105
143
|
guide_sources: Path, guide_output: Path, guide_folder: Path, project_name: str, has_api_index: bool
|
|
106
|
-
) -> list[str]:
|
|
144
|
+
) -> list[tuple[str, str]]:
|
|
107
145
|
"""Render all guides and return links for the documentation landing page."""
|
|
108
146
|
guide_output.mkdir(parents=True, exist_ok=True)
|
|
109
147
|
navigation_prefix = "/".join(".." for _ in guide_folder.parts)
|
|
148
|
+
site_url = documentation_site_url()
|
|
110
149
|
links = []
|
|
111
150
|
for source in sorted(guide_sources.glob("*.md")):
|
|
151
|
+
page_url = f"{site_url}{guide_folder.as_posix()}/{source.stem}.html" if site_url else None
|
|
112
152
|
title = _render_guide(
|
|
113
|
-
source, guide_output / f"{source.stem}.html", project_name, navigation_prefix, has_api_index
|
|
153
|
+
source, guide_output / f"{source.stem}.html", project_name, navigation_prefix, has_api_index, page_url
|
|
114
154
|
)
|
|
115
155
|
if source.stem != "index":
|
|
116
|
-
links.append(
|
|
117
|
-
f'<li><a href="{escape(guide_folder.as_posix())}/{escape(source.stem)}.html">{escape(title)}</a></li>'
|
|
118
|
-
)
|
|
156
|
+
links.append((title, source.stem))
|
|
119
157
|
return links
|
|
120
158
|
|
|
121
159
|
|
|
122
160
|
def _write_guide_index(
|
|
123
|
-
output_directory: Path, project_name: str, guide_folder: Path, has_api_index: bool, links: list[str]
|
|
161
|
+
output_directory: Path, project_name: str, guide_folder: Path, has_api_index: bool, links: list[tuple[str, str]]
|
|
124
162
|
) -> None:
|
|
125
163
|
"""Write the project-specific landing page for the published guides."""
|
|
126
|
-
guide_prefix = guide_folder.as_posix()
|
|
127
164
|
licence = configuration.get_value_or_default(ConfigurationVariable.FILE_LICENCE_IDENTIFIER, None)
|
|
128
|
-
licence_details = f"<p>Project licence: {escape(str(licence))}</p>" if licence else ""
|
|
129
165
|
overview = (
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
166
|
+
documentation_templates()
|
|
167
|
+
.get_template("documentation_landing.html.jinja2")
|
|
168
|
+
.render(
|
|
169
|
+
project_name=project_name,
|
|
170
|
+
guide_folder=guide_folder.as_posix(),
|
|
171
|
+
licence=licence,
|
|
172
|
+
has_api_index=has_api_index,
|
|
173
|
+
links=links,
|
|
174
|
+
)
|
|
138
175
|
)
|
|
139
176
|
site_description = f"Task guides{' and API reference' if has_api_index else ''} for {project_name}."
|
|
140
177
|
(output_directory / "index.html").write_text(
|
|
141
|
-
_html_page(
|
|
178
|
+
_html_page(
|
|
179
|
+
f"{project_name} documentation",
|
|
180
|
+
site_description,
|
|
181
|
+
overview,
|
|
182
|
+
".",
|
|
183
|
+
has_api_index,
|
|
184
|
+
documentation_site_url(),
|
|
185
|
+
"WebSite",
|
|
186
|
+
),
|
|
142
187
|
encoding="utf8",
|
|
143
188
|
)
|
|
144
189
|
|
|
@@ -152,11 +197,8 @@ def _publish_project_guides(output_directory: Path) -> None:
|
|
|
152
197
|
guide_output = output_directory / guide_folder
|
|
153
198
|
has_api_index = (output_directory / "index.html").is_file()
|
|
154
199
|
links = _render_guides(guide_sources, guide_output, guide_folder, project_name, has_api_index)
|
|
155
|
-
|
|
200
|
+
_update_api_navigation(output_directory, guide_output)
|
|
156
201
|
_write_guide_index(output_directory, project_name, guide_folder, has_api_index, links)
|
|
157
|
-
agent_index = project_root / "llms.txt"
|
|
158
|
-
if agent_index.is_file():
|
|
159
|
-
shutil.copyfile(agent_index, output_directory / "llms.txt")
|
|
160
202
|
|
|
161
203
|
|
|
162
204
|
def _clear_previous_docs(output_directory: Path) -> None:
|
|
@@ -171,6 +213,21 @@ def generate_documentation(output_directory: Path, module_to_document: str) -> N
|
|
|
171
213
|
os.makedirs(str(output_directory), exist_ok=True)
|
|
172
214
|
get_language_specifics().generate_code_documentation(output_directory, module_to_document)
|
|
173
215
|
_publish_project_guides(output_directory)
|
|
216
|
+
root = configuration.get_value_or_default(ConfigurationVariable.PROJECT_ROOT, None)
|
|
217
|
+
if root:
|
|
218
|
+
settings = _guide_settings()
|
|
219
|
+
publish_discovery_files(
|
|
220
|
+
output_directory,
|
|
221
|
+
Path(root),
|
|
222
|
+
settings[1] if settings else None,
|
|
223
|
+
settings[2] if settings else None,
|
|
224
|
+
(
|
|
225
|
+
settings[3]
|
|
226
|
+
if settings
|
|
227
|
+
else str(configuration.get_value_or_default(ConfigurationVariable.PROJECT_NAME, Path(root).name))
|
|
228
|
+
),
|
|
229
|
+
module_to_document,
|
|
230
|
+
)
|
|
174
231
|
|
|
175
232
|
|
|
176
233
|
def generate_docs(output_directory: Path, module: str) -> int:
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Copyright (C) 2020-2026 Arm Limited or its affiliates and Contributors. All rights reserved.
|
|
3
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
#
|
|
5
|
+
"""Handles usage of towncrier for automated changelog generation and pyautoversion for versioning."""
|
|
6
|
+
|
|
7
|
+
import sys
|
|
8
|
+
|
|
9
|
+
import argparse
|
|
10
|
+
import logging
|
|
11
|
+
from continuous_delivery_scripts.utils.versioning import calculate_version, determine_version_string
|
|
12
|
+
from typing import Optional, Tuple, Dict
|
|
13
|
+
|
|
14
|
+
from continuous_delivery_scripts.utils.changelog import generate_changelog
|
|
15
|
+
from continuous_delivery_scripts.utils.definitions import CommitType
|
|
16
|
+
from continuous_delivery_scripts.utils.logging import log_exception, set_log_level
|
|
17
|
+
|
|
18
|
+
logger = logging.getLogger(__name__)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def version_project(commit_type: CommitType) -> Tuple[bool, Optional[str], Dict[str, str]]:
|
|
22
|
+
"""Versions the project.
|
|
23
|
+
|
|
24
|
+
Args:
|
|
25
|
+
commit_type: states what is the type of the commit
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
Returns:
|
|
29
|
+
(is new version, the new version)
|
|
30
|
+
"""
|
|
31
|
+
use_news_files = commit_type in [CommitType.BETA, CommitType.RELEASE]
|
|
32
|
+
is_new_version, new_version, version_elements = calculate_version(commit_type, use_news_files, True)
|
|
33
|
+
_generate_changelog(new_version, use_news_files)
|
|
34
|
+
return is_new_version, new_version, version_elements
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def _generate_changelog(version: Optional[str], use_news_files: bool) -> None:
|
|
38
|
+
"""Creates a towncrier log of the release.
|
|
39
|
+
|
|
40
|
+
Will only create a log entry if we are using news files.
|
|
41
|
+
|
|
42
|
+
Args:
|
|
43
|
+
version: the semver version of the release
|
|
44
|
+
use_news_files: are we generating the release from news files
|
|
45
|
+
"""
|
|
46
|
+
if use_news_files:
|
|
47
|
+
logger.info(":: Generating a new changelog")
|
|
48
|
+
generate_changelog(version)
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def main() -> None:
|
|
52
|
+
"""Handle command line arguments to generate a version and changelog file."""
|
|
53
|
+
parser = argparse.ArgumentParser(description="Versions the project.")
|
|
54
|
+
parser.add_argument(
|
|
55
|
+
"-t", "--release-type", help="type of release to perform", required=True, type=str, choices=CommitType.choices()
|
|
56
|
+
)
|
|
57
|
+
parser.add_argument("-v", "--verbose", action="count", default=0, help="Verbosity, by default errors are reported.")
|
|
58
|
+
args = parser.parse_args()
|
|
59
|
+
set_log_level(args.verbose)
|
|
60
|
+
|
|
61
|
+
try:
|
|
62
|
+
commit_type = CommitType.parse(args.release_type)
|
|
63
|
+
is_new_version, new_version, version_elements = version_project(commit_type)
|
|
64
|
+
version_to_print = determine_version_string(commit_type, new_version, version_elements)
|
|
65
|
+
print(version_to_print)
|
|
66
|
+
except Exception as e:
|
|
67
|
+
log_exception(logger, e)
|
|
68
|
+
sys.exit(1)
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
if __name__ == "__main__":
|
|
72
|
+
main()
|
|
@@ -11,6 +11,33 @@ Therefore, a `.goreleaser.yml` file must be present in the go source directory i
|
|
|
11
11
|
## Documentation
|
|
12
12
|
The plugin uses [doc2go](https://abhinav.github.io/doc2go) to generate the code reference documentation.
|
|
13
13
|
|
|
14
|
+
Set `MODULE_TO_DOCUMENT` to the Go module or package you want documented.
|
|
15
|
+
CDS uses `go.mod` and `go.work` to find the module and select the working
|
|
16
|
+
directory and package pattern for [doc2go](https://abhinav.github.io/doc2go).
|
|
17
|
+
`SOURCE_DIR` locates the project's Go source; it does not choose the
|
|
18
|
+
documentation target. For example:
|
|
19
|
+
|
|
20
|
+
```toml
|
|
21
|
+
[ProjectConfig]
|
|
22
|
+
PROJECT_ROOT = "."
|
|
23
|
+
SOURCE_DIR = "generator"
|
|
24
|
+
PROGRAMMING_LANGUAGE = "Golang"
|
|
25
|
+
MODULE_TO_DOCUMENT = "generator"
|
|
26
|
+
DOCUMENTATION_DEFAULT_OUTPUT_PATH = "local_docs"
|
|
27
|
+
DOCUMENTATION_GUIDES_DIR = "guides"
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
`MODULE_TO_DOCUMENT = "generator"` documents that module and its packages;
|
|
31
|
+
`"cli"` selects the CLI module instead, even when `SOURCE_DIR` is `generator`.
|
|
32
|
+
For duplicate module names, use a project-relative path such as `"tools/cli"`.
|
|
33
|
+
To document all modules in the project workspace, use `"."`. A full module
|
|
34
|
+
import path also selects all its packages. To target a package directory, use
|
|
35
|
+
its name or project-relative path, such as `"config"` or `"generator/config"`;
|
|
36
|
+
a package import path or an explicit Go package pattern also works.
|
|
37
|
+
|
|
38
|
+
Run `cd-generate-docs` to build the API pages alongside optional task guides;
|
|
39
|
+
see [the documentation guide](../../guides/generating-code-documentation.md).
|
|
40
|
+
|
|
14
41
|
## SPDX and third-party IP reporting
|
|
15
42
|
|
|
16
43
|
The Go plugin uses [go-licenses v2](https://github.com/google/go-licenses) to
|
|
@@ -53,12 +53,12 @@ GO_LICENSES_TEMPLATE = "{{range .}}{{.Name}}\t{{.Version}}\t{{.LicenseURL}}\t{{.
|
|
|
53
53
|
LICENCE_FILE_PREFIXES = ("LICENSE", "LICENCE", "COPYING")
|
|
54
54
|
|
|
55
55
|
|
|
56
|
-
def _generate_doc2go_command_list(executable: str, output_directory: Path,
|
|
56
|
+
def _generate_doc2go_command_list(executable: str, output_directory: Path, patterns: List[str]) -> List[str]:
|
|
57
57
|
return [
|
|
58
58
|
executable,
|
|
59
59
|
"-out",
|
|
60
60
|
str(output_directory),
|
|
61
|
-
|
|
61
|
+
*patterns,
|
|
62
62
|
]
|
|
63
63
|
|
|
64
64
|
|
|
@@ -329,8 +329,87 @@ def _ensure_go_tool_installed(
|
|
|
329
329
|
return _installed_go_tool_path(tool_name, env)
|
|
330
330
|
|
|
331
331
|
|
|
332
|
+
def _doc2go_target(module: str) -> tuple[Path, List[str]]:
|
|
333
|
+
"""Resolve MODULE_TO_DOCUMENT to a Go module, package or explicit pattern."""
|
|
334
|
+
requested = module.strip()
|
|
335
|
+
if not requested:
|
|
336
|
+
raise ValueError("MODULE_TO_DOCUMENT must identify the Go module or package to document")
|
|
337
|
+
|
|
338
|
+
root = ROOT_DIR.resolve()
|
|
339
|
+
source = SRC_DIR.resolve()
|
|
340
|
+
modules = list(
|
|
341
|
+
dict.fromkeys(
|
|
342
|
+
directory.resolve()
|
|
343
|
+
for directory in _candidate_go_module_directories(include_project_root=True)
|
|
344
|
+
if (directory / "go.mod").is_file()
|
|
345
|
+
)
|
|
346
|
+
)
|
|
347
|
+
|
|
348
|
+
if requested == ".":
|
|
349
|
+
workspace_modules = list(
|
|
350
|
+
dict.fromkeys(
|
|
351
|
+
directory.resolve()
|
|
352
|
+
for directory in _determine_go_work_module_directories()
|
|
353
|
+
if (directory / "go.mod").is_file() and directory.resolve().is_relative_to(root)
|
|
354
|
+
)
|
|
355
|
+
)
|
|
356
|
+
if workspace_modules:
|
|
357
|
+
return root, [
|
|
358
|
+
"./..." if directory == root else f"./{directory.relative_to(root).as_posix()}/..."
|
|
359
|
+
for directory in workspace_modules
|
|
360
|
+
]
|
|
361
|
+
if (root / "go.mod").is_file():
|
|
362
|
+
return root, ["./..."]
|
|
363
|
+
raise FileNotFoundError(f"No Go module or workspace found at {ROOT_DIR}")
|
|
364
|
+
|
|
365
|
+
matches = []
|
|
366
|
+
for directory in modules:
|
|
367
|
+
relative = directory.relative_to(root).as_posix() if directory.is_relative_to(root) else None
|
|
368
|
+
if requested in {directory.name, str(directory), relative, f"./{relative}"}:
|
|
369
|
+
matches.append(directory)
|
|
370
|
+
project_module = (root / requested).resolve()
|
|
371
|
+
if project_module.is_relative_to(root) and (project_module / "go.mod").is_file() and project_module not in matches:
|
|
372
|
+
matches.append(project_module)
|
|
373
|
+
if len(matches) > 1:
|
|
374
|
+
raise ValueError(f"MODULE_TO_DOCUMENT={requested!r} matches several Go modules; use a project-relative path")
|
|
375
|
+
if matches:
|
|
376
|
+
return matches[0], ["./..."]
|
|
377
|
+
|
|
378
|
+
# Package directories can be named relative to the project or source root.
|
|
379
|
+
package_matches = []
|
|
380
|
+
for candidate in ((root / requested).resolve(), (source / requested).resolve()):
|
|
381
|
+
if candidate.is_dir():
|
|
382
|
+
containing_modules = [directory for directory in modules if candidate.is_relative_to(directory)]
|
|
383
|
+
if containing_modules:
|
|
384
|
+
directory = max(containing_modules, key=lambda path: len(path.parts))
|
|
385
|
+
relative = candidate.relative_to(directory).as_posix()
|
|
386
|
+
result = directory, [f"./{relative}/..."]
|
|
387
|
+
if result not in package_matches:
|
|
388
|
+
package_matches.append(result)
|
|
389
|
+
if len(package_matches) > 1:
|
|
390
|
+
raise ValueError(f"MODULE_TO_DOCUMENT={requested!r} matches several Go packages; use a project-relative path")
|
|
391
|
+
if package_matches:
|
|
392
|
+
return package_matches[0]
|
|
393
|
+
|
|
394
|
+
# A source subdirectory of a module can also be selected by its short name.
|
|
395
|
+
if requested == source.name and any((parent / "go.mod").is_file() for parent in (source, *source.parents)):
|
|
396
|
+
return source, ["./..."]
|
|
397
|
+
|
|
398
|
+
# Recognise a full module path without requiring the caller to append /....
|
|
399
|
+
if "." in requested and not requested.startswith("./"):
|
|
400
|
+
env = os.environ.copy()
|
|
401
|
+
for directory in modules:
|
|
402
|
+
import_path = _go_module_name(directory, env)
|
|
403
|
+
if requested in {import_path, f"{import_path}/..."}:
|
|
404
|
+
return directory, ["./..."]
|
|
405
|
+
|
|
406
|
+
# An explicit package import path or Go package pattern is used as supplied.
|
|
407
|
+
return source, [requested]
|
|
408
|
+
|
|
409
|
+
|
|
332
410
|
def _call_doc2go(output_directory: Path, module: str) -> None:
|
|
333
411
|
"""Call doc2go for generating the docs."""
|
|
412
|
+
working_dir, patterns = _doc2go_target(module)
|
|
334
413
|
env = os.environ
|
|
335
414
|
env[ENVVAR_GO_MOD] = GO_MOD_ON_VALUE
|
|
336
415
|
executable = _ensure_go_tool_installed(
|
|
@@ -340,10 +419,10 @@ def _call_doc2go(output_directory: Path, module: str) -> None:
|
|
|
340
419
|
env=env,
|
|
341
420
|
)
|
|
342
421
|
logger.info("Creating Code documentation.")
|
|
343
|
-
logger.info("Running doc2go over [%s] in [%s].",
|
|
422
|
+
logger.info("Running doc2go over [%s] in [%s].", patterns, working_dir)
|
|
344
423
|
check_call(
|
|
345
|
-
_generate_doc2go_command_list(executable, output_directory,
|
|
346
|
-
cwd=str(
|
|
424
|
+
_generate_doc2go_command_list(executable, output_directory.resolve(), patterns),
|
|
425
|
+
cwd=str(working_dir),
|
|
347
426
|
env=env,
|
|
348
427
|
)
|
|
349
428
|
|
|
@@ -475,7 +554,7 @@ class Go(BaseLanguage):
|
|
|
475
554
|
def generate_code_documentation(self, output_directory: Path, module_to_document: str) -> None:
|
|
476
555
|
"""Generates the code documentation."""
|
|
477
556
|
super().generate_code_documentation(output_directory, module_to_document)
|
|
478
|
-
_call_doc2go(output_directory, module_to_document
|
|
557
|
+
_call_doc2go(output_directory, module_to_document)
|
|
479
558
|
|
|
480
559
|
def can_add_licence_headers(self) -> bool:
|
|
481
560
|
"""States that licence headers can be added."""
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<h1>{{ project_name }}</h1>
|
|
2
|
+
<p>Task guides for {{ project_name }}, with setup, examples and project workflows.</p>
|
|
3
|
+
{% if licence %}<p>Project licence: {{ licence }}</p>{% endif %}
|
|
4
|
+
<p><a href="{{ guide_folder }}/index.html">All task guides</a>{% if has_api_index %} · <a href="api.html">API reference</a>{% endif %}</p>
|
|
5
|
+
<ul>
|
|
6
|
+
{% for title, filename in links %}<li><a href="{{ guide_folder }}/{{ filename }}.html">{{ title }}</a></li>
|
|
7
|
+
{% endfor %}</ul>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
6
|
+
<title>{{ title }}</title>
|
|
7
|
+
<meta name="description" content="{{ description }}">
|
|
8
|
+
<style>
|
|
9
|
+
body{font:1.1rem/1.6 system-ui,sans-serif;max-width:76ch;margin:2rem auto;padding:0 1rem}
|
|
10
|
+
a{color:#075985}pre{overflow:auto;background:#f3f4f6;padding:1rem}code{overflow-wrap:anywhere}
|
|
11
|
+
nav{border-bottom:1px solid #ccc;padding-bottom:1rem}li{margin:.4rem 0}
|
|
12
|
+
</style>
|
|
13
|
+
{% if structured_data %}{{ structured_data | safe }}{% endif %}
|
|
14
|
+
</head>
|
|
15
|
+
<body>
|
|
16
|
+
<nav><a href="{{ nav_prefix }}/index.html">Overview</a>{% if has_api_index %} · <a href="{{ nav_prefix }}/api.html">API reference</a>{% endif %}</nav>
|
|
17
|
+
<main>{{ body | safe }}</main>
|
|
18
|
+
</body>
|
|
19
|
+
</html>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# {{ name }}
|
|
2
|
+
|
|
3
|
+
> Documentation for {{ name }}.
|
|
4
|
+
|
|
5
|
+
## Documentation
|
|
6
|
+
|
|
7
|
+
- [Overview]({{ site_url }})
|
|
8
|
+
{% for source, title in guides if folder -%}
|
|
9
|
+
- [{{ title }}]({{ site_url }}{{ folder.as_posix() }}/{{ source.stem }}.html)
|
|
10
|
+
{% endfor -%}
|
|
11
|
+
{% if has_api -%}
|
|
12
|
+
- [API reference]({{ site_url }}api.html)
|
|
13
|
+
{% endif -%}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Copyright (C) 2020-2026 Arm Limited or its affiliates and Contributors. All rights reserved.
|
|
3
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
#
|
|
5
|
+
"""Helpers for generating and repairing changelogs."""
|
|
6
|
+
|
|
7
|
+
from contextlib import contextmanager
|
|
8
|
+
import os
|
|
9
|
+
from pathlib import Path
|
|
10
|
+
import re
|
|
11
|
+
import subprocess
|
|
12
|
+
import tempfile
|
|
13
|
+
from typing import Iterator, Optional
|
|
14
|
+
|
|
15
|
+
import toml
|
|
16
|
+
|
|
17
|
+
from continuous_delivery_scripts.utils.configuration import ConfigurationVariable, configuration
|
|
18
|
+
from continuous_delivery_scripts.utils.filesystem_helpers import cd
|
|
19
|
+
|
|
20
|
+
_MARKDOWN_CHANGELOG_SUFFIXES = {".md", ".markdown"}
|
|
21
|
+
_RELEASE_TITLE_PATTERN = re.compile(r'^"?[vV]?\d+\.\d+\.\d+[^\n]*$')
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def generate_changelog(version: Optional[str]) -> None:
|
|
25
|
+
"""Builds the changelog with Towncrier and normalises Markdown output when needed."""
|
|
26
|
+
project_config_path = configuration.get_value(ConfigurationVariable.PROJECT_CONFIG)
|
|
27
|
+
with _create_towncrier_workaround_config(project_config_path) as workaround_config_path:
|
|
28
|
+
# See Towncrier's build command docs:
|
|
29
|
+
# https://towncrier.readthedocs.io/en/stable/cli.html#build
|
|
30
|
+
command = ["towncrier", "build", "--yes", "--name", "", "--version", str(version)]
|
|
31
|
+
if workaround_config_path:
|
|
32
|
+
command.extend(["--config", workaround_config_path])
|
|
33
|
+
|
|
34
|
+
with cd(os.path.dirname(project_config_path)):
|
|
35
|
+
subprocess.check_call(command)
|
|
36
|
+
|
|
37
|
+
# FIXME: Remove this workaround when https://github.com/twisted/towncrier/issues/758 is fixed.
|
|
38
|
+
normalise_markdown_release_headings(version)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def normalise_markdown_release_headings(version: Optional[str]) -> None:
|
|
42
|
+
"""Promote the latest markdown release title to a heading when Towncrier omits it."""
|
|
43
|
+
if not version:
|
|
44
|
+
return
|
|
45
|
+
|
|
46
|
+
changelog_path = Path(str(configuration.get_value(ConfigurationVariable.CHANGELOG_FILE_PATH)))
|
|
47
|
+
if changelog_path.suffix.lower() not in _MARKDOWN_CHANGELOG_SUFFIXES or not changelog_path.exists():
|
|
48
|
+
return
|
|
49
|
+
|
|
50
|
+
original = changelog_path.read_text(encoding="utf8")
|
|
51
|
+
lines = original.splitlines()
|
|
52
|
+
version_index = next(
|
|
53
|
+
(index for index, line in enumerate(lines) if line.startswith(f"{version} ") and not line.startswith("#")),
|
|
54
|
+
None,
|
|
55
|
+
)
|
|
56
|
+
if version_index is None:
|
|
57
|
+
return
|
|
58
|
+
|
|
59
|
+
next_release_index = next(
|
|
60
|
+
(
|
|
61
|
+
index
|
|
62
|
+
for index in range(version_index + 1, len(lines))
|
|
63
|
+
if _RELEASE_TITLE_PATTERN.match(lines[index]) and not lines[index].startswith("#")
|
|
64
|
+
),
|
|
65
|
+
len(lines),
|
|
66
|
+
)
|
|
67
|
+
section_indexes = [index for index in range(version_index + 1, next_release_index) if lines[index].startswith("# ")]
|
|
68
|
+
if not section_indexes:
|
|
69
|
+
return
|
|
70
|
+
|
|
71
|
+
lines[version_index] = f"# {lines[version_index]}"
|
|
72
|
+
for index in section_indexes:
|
|
73
|
+
lines[index] = f"#{lines[index]}"
|
|
74
|
+
|
|
75
|
+
rendered = "\n".join(lines) + ("\n" if original.endswith("\n") else "")
|
|
76
|
+
if rendered != original:
|
|
77
|
+
changelog_path.write_text(rendered, encoding="utf8")
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
def _title_format_has_markdown_heading(title_format: str) -> bool:
|
|
81
|
+
"""Checks whether a Towncrier title format already defines a Markdown heading."""
|
|
82
|
+
return any(line.lstrip().startswith("#") for line in title_format.splitlines() if line.strip())
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
@contextmanager
|
|
86
|
+
def _create_towncrier_workaround_config(project_config_path: str) -> Iterator[Optional[str]]:
|
|
87
|
+
"""Yields a temporary Towncrier config with a Markdown title heading if needed."""
|
|
88
|
+
# FIXME: Remove this workaround when https://github.com/twisted/towncrier/issues/758 is fixed.
|
|
89
|
+
# Towncrier documents Markdown title handling under title_format:
|
|
90
|
+
# https://towncrier.readthedocs.io/en/stable/configuration.html#title-format
|
|
91
|
+
config = toml.load(project_config_path)
|
|
92
|
+
towncrier_config = config.get("tool", {}).get("towncrier", {})
|
|
93
|
+
title_format = towncrier_config.get("title_format")
|
|
94
|
+
if not isinstance(title_format, str) or _title_format_has_markdown_heading(title_format):
|
|
95
|
+
yield None
|
|
96
|
+
return
|
|
97
|
+
|
|
98
|
+
config["tool"]["towncrier"]["title_format"] = f"# {title_format}"
|
|
99
|
+
config_dir = os.path.dirname(project_config_path)
|
|
100
|
+
with tempfile.NamedTemporaryFile(
|
|
101
|
+
mode="w", encoding="utf8", suffix=".toml", prefix="towncrier-", dir=config_dir, delete=False
|
|
102
|
+
) as temp_config:
|
|
103
|
+
toml.dump(config, temp_config)
|
|
104
|
+
|
|
105
|
+
try:
|
|
106
|
+
yield temp_config.name
|
|
107
|
+
finally:
|
|
108
|
+
os.remove(temp_config.name)
|
|
@@ -111,6 +111,8 @@ class ConfigurationVariable(enum.Enum):
|
|
|
111
111
|
"""Optional top-level list of assessment statuses that fail compliance checks."""
|
|
112
112
|
SKIP_DEPENDENCY_DOWNLOAD_FOR_LICENSING = 46
|
|
113
113
|
"""Skip automatic dependency downloads before licence and SPDX dependency analysis."""
|
|
114
|
+
DOCUMENTATION_SITE_URL = 47
|
|
115
|
+
"""Optional public base URL of the generated documentation website."""
|
|
114
116
|
|
|
115
117
|
@staticmethod
|
|
116
118
|
def choices() -> List[str]:
|