From e68093a24f4adefa2ed4c962b2c41505916326b3 Mon Sep 17 00:00:00 2001 From: Felix Fontein Date: Sat, 14 Sep 2024 01:19:16 +0200 Subject: [PATCH 01/11] Automatically generate changelog entries for deprecated collections. --- src/antsibull/changelog.py | 141 ++++++++++++++++++++++++++++++++++++- 1 file changed, 139 insertions(+), 2 deletions(-) diff --git a/src/antsibull/changelog.py b/src/antsibull/changelog.py index 6cd915c3..29132b6e 100644 --- a/src/antsibull/changelog.py +++ b/src/antsibull/changelog.py @@ -21,14 +21,23 @@ import aiohttp import asyncio_pool # type: ignore[import] from antsibull_changelog.changes import ChangesData, add_release -from antsibull_changelog.config import ChangelogConfig, CollectionDetails, PathsConfig +from antsibull_changelog.config import ( + ChangelogConfig, + CollectionDetails, + PathsConfig, + TextFormat, +) +from antsibull_changelog.fragment import ChangelogFragment from antsibull_changelog.rendering.changelog import ChangelogGenerator from antsibull_changelog.utils import collect_versions from antsibull_core import app_context from antsibull_core.ansible_core import get_ansible_core from antsibull_core.dependency_files import DependencyFileData, DepsFile from antsibull_core.galaxy import CollectionDownloader, GalaxyContext -from antsibull_core.schemas.collection_meta import CollectionsMetadata +from antsibull_core.schemas.collection_meta import ( + CollectionsMetadata, + RemovalInformation, +) from antsibull_fileutils.yaml import load_yaml_bytes from packaging.version import Version as PypiVer from semantic_version import Version as SemVer @@ -489,6 +498,133 @@ def __init__( self.collection_metadata = collection_metadata +def _get_removal_entry( + collection: str, + removal: RemovalInformation, +) -> tuple[ChangelogFragment, str] | None: + if removal.announce_version is None: + return None + + sentences = [] + link = "" + if removal.discussion: + link = f" (`{removal.discussion} <{removal.discussion}>`__)" + + if removal.reason == "deprecated": + sentences.append(f"The ``{collection}`` collection has been deprecated.") + sentences.append( + f"It will be removed from Ansible {removal.major_version} if no one" + " starts maintaining it again before Ansible {removal.major_version}." + ) + sentences.append( + "See `the removal process for details on how this works" + " `__{link}." + ) + + if removal.reason == "considered-unmaintained": + sentences.append( + f"The ``{collection}`` collection is considered unmaintained" + f" and will be removed from Ansible {removal.major_version}" + f" if no one starts maintaining it again before Ansible {removal.major_version}." + ) + sentences.append( + "See `the removal process for details on how this works" + " `__{link}." + ) + + if removal.reason == "renamed": + sentences.append( + f"The collection ``{collection}`` has been renamed to ``{removal.new_name}``." + ) + sentences.append("For now both collections are included in Ansible.") + if removal.redirect_replacement_major_version is not None: + if ( + removal.announce_version.major + < removal.redirect_replacement_major_version + ): + sentences.append( + f"The content in ``{collection}`` will be replaced by deprecated" + f" redirects in Ansible {removal.redirect_replacement_major_version}.0.0." + ) + else: + sentences.append( + f"The content in ``{collection}`` has been replaced by deprecated" + f" redirects in Ansible {removal.redirect_replacement_major_version}.0.0." + ) + if removal.major_version != "TBD": + sentences.append( + f"The collection will be completely removed from Ansible {removal.major_version}." + ) + else: + sentences.append( + "The collection will be completely removed from Ansible eventually." + ) + sentences.append(f"Please update your FQCNs for ``{collection}``{link}.") + + if removal.reason == "guidelines-violation": + sentences.append( + f"The {collection} collection will be removed from Ansible {removal.major_version}" + " due to violations of the Ansible inclusion requirements." + ) + if removal.reason_text: + sentences.append(removal.reason_text) + sentences.append( + "See `the removal process for details on how this works and can be cancelled" + " `__{link}." + ) + + if removal.reason == "other": + sentences.append( + f"The {collection} collection will be removed from Ansible {removal.major_version}." + ) + if removal.reason_text: + sentences.append(removal.reason_text) + if removal.discussion: + sentences.append( + f"See `the removal discussion for details <{removal.discussion}>`__." + ) + else: + sentences.append( + "To discuss this, please `create a community topic" + " `__." + ) + + if not sentences: + return None + return ChangelogFragment( + content={ + "deprecated_features": [ + "\n".join(sentences), + ], + }, + path="", + fragment_format=TextFormat.RESTRUCTURED_TEXT, + ), str(removal.announce_version) + + +def _populate_ansible_changelog( + ansible_changelog: ChangelogData, collection_metadata: CollectionsMetadata +) -> None: + for collection, metadata in collection_metadata.collections.items(): + if metadata.removal: + fragment_version = _get_removal_entry(collection, metadata.removal) + if fragment_version: + fragment, version = fragment_version + if version in ansible_changelog.changes.releases: + ansible_changelog.changes.add_fragment(fragment, version) + else: + print( + f"WARNING: found changelog entry for {version}, which does not yet exist" + ) + + def get_changelog( ansible_version: PypiVer, deps_dir: str | None, @@ -506,6 +642,7 @@ def get_changelog( ) collection_metadata = CollectionsMetadata.load_from(deps_dir) + _populate_ansible_changelog(ansible_changelog, collection_metadata) if deps_dir is not None: for path in glob.glob(os.path.join(deps_dir, "*.deps"), recursive=False): From b3d2661c708eeb5aad1f008b899eddf0efda1fd5 Mon Sep 17 00:00:00 2001 From: Felix Fontein Date: Fri, 20 Sep 2024 20:40:36 +0200 Subject: [PATCH 02/11] Update messages. Co-authored-by: Maxwell G --- src/antsibull/changelog.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/antsibull/changelog.py b/src/antsibull/changelog.py index 29132b6e..fc0e58c0 100644 --- a/src/antsibull/changelog.py +++ b/src/antsibull/changelog.py @@ -538,7 +538,7 @@ def _get_removal_entry( if removal.reason == "renamed": sentences.append( - f"The collection ``{collection}`` has been renamed to ``{removal.new_name}``." + f"The collection ``{collection}`` was renamed to ``{removal.new_name}``." ) sentences.append("For now both collections are included in Ansible.") if removal.redirect_replacement_major_version is not None: @@ -563,7 +563,9 @@ def _get_removal_entry( sentences.append( "The collection will be completely removed from Ansible eventually." ) - sentences.append(f"Please update your FQCNs for ``{collection}``{link}.") + sentences.append( + f"Please update your FQCNs from ``{collection}`` to ``{removal.new_name}``{link}." + ) if removal.reason == "guidelines-violation": sentences.append( From 20ac6cfd3f953b28f065ee1c648ac2c3ffacf023 Mon Sep 17 00:00:00 2001 From: Felix Fontein Date: Mon, 23 Sep 2024 22:55:34 +0300 Subject: [PATCH 03/11] Improve formulation. --- src/antsibull/changelog.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/antsibull/changelog.py b/src/antsibull/changelog.py index fc0e58c0..10e6f776 100644 --- a/src/antsibull/changelog.py +++ b/src/antsibull/changelog.py @@ -498,7 +498,7 @@ def __init__( self.collection_metadata = collection_metadata -def _get_removal_entry( +def _get_removal_entry( # noqa: C901, pylint:disable=too-many-branches collection: str, removal: RemovalInformation, ) -> tuple[ChangelogFragment, str] | None: @@ -517,10 +517,10 @@ def _get_removal_entry( " starts maintaining it again before Ansible {removal.major_version}." ) sentences.append( - "See `the removal process for details on how this works" + "See `Collections Removal Process for unmaintained collections" " `__{link}." + "collection_package_removal.html#unmaintained-collections" + f">` for more details__{link}." ) if removal.reason == "considered-unmaintained": From a730176bae672682763581da96804a97196d2353 Mon Sep 17 00:00:00 2001 From: Felix Fontein Date: Mon, 23 Sep 2024 22:57:51 +0300 Subject: [PATCH 04/11] Generate removed features fragments as well. --- src/antsibull/changelog.py | 103 +++++++++++++++++++++++++++++++++++++ 1 file changed, 103 insertions(+) diff --git a/src/antsibull/changelog.py b/src/antsibull/changelog.py index 10e6f776..e669be59 100644 --- a/src/antsibull/changelog.py +++ b/src/antsibull/changelog.py @@ -37,6 +37,7 @@ from antsibull_core.schemas.collection_meta import ( CollectionsMetadata, RemovalInformation, + RemovedRemovalInformation, ) from antsibull_fileutils.yaml import load_yaml_bytes from packaging.version import Version as PypiVer @@ -611,6 +612,97 @@ def _get_removal_entry( # noqa: C901, pylint:disable=too-many-branches ), str(removal.announce_version) +def _get_removed_entry( # noqa: C901, pylint:disable=too-many-branches + collection: str, + removal: RemovedRemovalInformation, +) -> tuple[ChangelogFragment, str] | None: + sentences = [] + link = "" + if removal.discussion: + link = f" (`{removal.discussion} <{removal.discussion}>`__)" + + if removal.reason == "deprecated": + sentences.append( + f"The deprecated ``{collection}`` collection has been removed{link}." + ) + + if removal.reason == "considered-unmaintained": + sentences.append( + f"The ``{collection}`` collection was considered unmaintained" + f" and has been removed from Ansible {removal.version.major}{link}." + ) + + if removal.reason == "renamed": + sentences.append( + f"The collection ``{collection}`` has been completely removed from Ansible." + ) + sentences.append(f"It has been renamed to ``{removal.new_name}``.") + if removal.redirect_replacement_major_version is not None: + sentences.append( + f"``{collection}`` has been replaced by deprecated redirects to" + f" ``{removal.new_name}``" + f" in Ansible {removal.redirect_replacement_major_version}.0.0." + ) + else: + sentences.append( + "The collection will be completely removed from Ansible eventually." + ) + sentences.append( + f"Please update your FQCNs from ``{collection}`` to ``{removal.new_name}``{link}." + ) + + if removal.reason == "guidelines-violation": + sentences.append( + f"The {collection} collection has been removed from Ansible {removal.version.major}" + " due to violations of the Ansible inclusion requirements." + ) + if removal.reason_text: + sentences.append(removal.reason_text) + sentences.append( + "See `Collections Removal Process for" + " collections not satisfying the Collection requirements" + " ` for more details__{link}." + ) + + if removal.reason == "other": + sentences.append( + f"The {collection} collection has been removed from Ansible {removal.version.major}." + ) + if removal.reason_text: + sentences.append(removal.reason_text) + if removal.discussion: + sentences.append( + f"See `the removal discussion for details <{removal.discussion}>`__." + ) + else: + sentences.append( + "To discuss this, please `create a community topic" + " `__." + ) + + if sentences and removal.reason not in ("renamed", "deprecated"): + sentences.append( + "Users can still install this collection with " + f"``ansible-galaxy collection install {collection}``." + ) + + if not sentences: + return None + return ChangelogFragment( + content={ + "removed_features": [ + "\n".join(sentences), + ], + }, + path="", + fragment_format=TextFormat.RESTRUCTURED_TEXT, + ), str(removal.version) + + def _populate_ansible_changelog( ansible_changelog: ChangelogData, collection_metadata: CollectionsMetadata ) -> None: @@ -626,6 +718,17 @@ def _populate_ansible_changelog( f"WARNING: found changelog entry for {version}, which does not yet exist" ) + for collection, removed_metadata in collection_metadata.removed_collections.items(): + fragment_version = _get_removed_entry(collection, removed_metadata.removal) + if fragment_version: + fragment, version = fragment_version + if version in ansible_changelog.changes.releases: + ansible_changelog.changes.add_fragment(fragment, version) + else: + print( + f"WARNING: found changelog entry for {version}, which does not yet exist" + ) + def get_changelog( ansible_version: PypiVer, From bd4d0256588ae8e7445e2cab35a7ecf40ec6b329 Mon Sep 17 00:00:00 2001 From: Felix Fontein Date: Mon, 23 Sep 2024 23:02:43 +0300 Subject: [PATCH 05/11] Pass in ansible version to changelog fragment generator. --- src/antsibull/changelog.py | 35 +++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/src/antsibull/changelog.py b/src/antsibull/changelog.py index e669be59..ef5d7383 100644 --- a/src/antsibull/changelog.py +++ b/src/antsibull/changelog.py @@ -502,8 +502,12 @@ def __init__( def _get_removal_entry( # noqa: C901, pylint:disable=too-many-branches collection: str, removal: RemovalInformation, + ansible_version: PypiVer, ) -> tuple[ChangelogFragment, str] | None: - if removal.announce_version is None: + if ( + removal.announce_version is None + or removal.announce_version.major != ansible_version.major + ): return None sentences = [] @@ -515,13 +519,13 @@ def _get_removal_entry( # noqa: C901, pylint:disable=too-many-branches sentences.append(f"The ``{collection}`` collection has been deprecated.") sentences.append( f"It will be removed from Ansible {removal.major_version} if no one" - " starts maintaining it again before Ansible {removal.major_version}." + f" starts maintaining it again before Ansible {removal.major_version}." ) sentences.append( "See `Collections Removal Process for unmaintained collections" " ` for more details__{link}." + f">`__ for more details{link}." ) if removal.reason == "considered-unmaintained": @@ -543,10 +547,7 @@ def _get_removal_entry( # noqa: C901, pylint:disable=too-many-branches ) sentences.append("For now both collections are included in Ansible.") if removal.redirect_replacement_major_version is not None: - if ( - removal.announce_version.major - < removal.redirect_replacement_major_version - ): + if ansible_version.major < removal.redirect_replacement_major_version: sentences.append( f"The content in ``{collection}`` will be replaced by deprecated" f" redirects in Ansible {removal.redirect_replacement_major_version}.0.0." @@ -615,7 +616,11 @@ def _get_removal_entry( # noqa: C901, pylint:disable=too-many-branches def _get_removed_entry( # noqa: C901, pylint:disable=too-many-branches collection: str, removal: RemovedRemovalInformation, + ansible_version: PypiVer, ) -> tuple[ChangelogFragment, str] | None: + if ansible_version.major != removal.version.major: + return None + sentences = [] link = "" if removal.discussion: @@ -664,7 +669,7 @@ def _get_removed_entry( # noqa: C901, pylint:disable=too-many-branches " ` for more details__{link}." + f">`__ for more details{link}." ) if removal.reason == "other": @@ -704,11 +709,15 @@ def _get_removed_entry( # noqa: C901, pylint:disable=too-many-branches def _populate_ansible_changelog( - ansible_changelog: ChangelogData, collection_metadata: CollectionsMetadata + ansible_changelog: ChangelogData, + collection_metadata: CollectionsMetadata, + ansible_version: PypiVer, ) -> None: for collection, metadata in collection_metadata.collections.items(): if metadata.removal: - fragment_version = _get_removal_entry(collection, metadata.removal) + fragment_version = _get_removal_entry( + collection, metadata.removal, ansible_version + ) if fragment_version: fragment, version = fragment_version if version in ansible_changelog.changes.releases: @@ -719,7 +728,9 @@ def _populate_ansible_changelog( ) for collection, removed_metadata in collection_metadata.removed_collections.items(): - fragment_version = _get_removed_entry(collection, removed_metadata.removal) + fragment_version = _get_removed_entry( + collection, removed_metadata.removal, ansible_version + ) if fragment_version: fragment, version = fragment_version if version in ansible_changelog.changes.releases: @@ -747,7 +758,7 @@ def get_changelog( ) collection_metadata = CollectionsMetadata.load_from(deps_dir) - _populate_ansible_changelog(ansible_changelog, collection_metadata) + _populate_ansible_changelog(ansible_changelog, collection_metadata, ansible_version) if deps_dir is not None: for path in glob.glob(os.path.join(deps_dir, "*.deps"), recursive=False): From 29e0d9b9ecfc933426ce3041546580ce036786a8 Mon Sep 17 00:00:00 2001 From: Felix Fontein Date: Sat, 5 Oct 2024 11:42:13 +0200 Subject: [PATCH 06/11] Correctly process Ansible markup. --- .github/workflows/antsibull-build.yml | 11 +++++++++++ .github/workflows/nox.yml | 5 +++++ README.md | 16 +++++++++------- changelogs/fragments/623-changelog.yaml | 3 +++ noxfile.py | 1 + pyproject.toml | 1 + src/antsibull/changelog.py | 22 ++++++++++++++++++---- 7 files changed, 48 insertions(+), 11 deletions(-) create mode 100644 changelogs/fragments/623-changelog.yaml diff --git a/.github/workflows/antsibull-build.yml b/.github/workflows/antsibull-build.yml index dbb99b89..a4a6da33 100644 --- a/.github/workflows/antsibull-build.yml +++ b/.github/workflows/antsibull-build.yml @@ -30,6 +30,7 @@ jobs: python: '3.9' antsibull_changelog_ref: 0.24.0 antsibull_core_ref: main + antsibull_docs_parser_ref: 1.1.0 antsibull_docutils_ref: 1.0.0 # isn't used by antsibull-changelog 0.24.0 antsibull_fileutils_ref: main - name: Ansible 9 @@ -37,6 +38,7 @@ jobs: python: '3.11' antsibull_changelog_ref: main antsibull_core_ref: main + antsibull_docs_parser_ref: main antsibull_docutils_ref: main antsibull_fileutils_ref: main - name: Ansible 10 @@ -44,6 +46,7 @@ jobs: python: '3.12' antsibull_changelog_ref: main antsibull_core_ref: main + antsibull_docs_parser_ref: main antsibull_docutils_ref: main antsibull_fileutils_ref: main - name: Ansible 11 @@ -51,6 +54,7 @@ jobs: python: '3.12' antsibull_changelog_ref: main antsibull_core_ref: main + antsibull_docs_parser_ref: main antsibull_docutils_ref: main antsibull_fileutils_ref: main @@ -74,6 +78,13 @@ jobs: path: antsibull-core ref: ${{ matrix.antsibull_core_ref }} + - name: Check out dependent project antsibull-docs-parser + uses: actions/checkout@v4 + with: + repository: ansible-community/antsibull-docs-parser + path: antsibull-docs-parser + ref: ${{ matrix.antsibull_docs_parser_ref }} + - name: Check out dependent project antsibull-docutils uses: actions/checkout@v4 with: diff --git a/.github/workflows/nox.yml b/.github/workflows/nox.yml index c0d22069..932da15c 100644 --- a/.github/workflows/nox.yml +++ b/.github/workflows/nox.yml @@ -69,6 +69,11 @@ jobs: with: repository: ansible-community/antsibull-changelog path: antsibull-changelog + - name: Check out dependent project antsibull-docs-parser + uses: actions/checkout@v4 + with: + repository: ansible-community/antsibull-docs-parser + path: antsibull-docs-parser - name: Check out dependent project antsibull-docutils uses: actions/checkout@v4 with: diff --git a/README.md b/README.md index 16221ffc..78b14528 100644 --- a/README.md +++ b/README.md @@ -49,19 +49,20 @@ and install the requirements needed to run the tests there. --- antsibull depends on the sister antsibull-core, antsibull-changelog, -antsibull-docutils, and antsibull-fileutils projects. +antsibull-docs-parser, antsibull-docutils, and antsibull-fileutils projects. By default, `nox` will install development versions of these projects from Github. -If you're hacking on antsibull-core, antsibull-changelog, antsibull-docutils and/or -antsibull-fileutils alongside antsibull, +If you're hacking on antsibull-core, antsibull-changelog, antsibull-docs-parser, +antsibull-docutils and/or antsibull-fileutils alongside antsibull, nox will automatically install the projects from `../antsibull-core`, -`../antsibull-changelog`, `../antsibull-docutils`, and `../antsibull-fileutils` -when running tests if those paths exist. +`../antsibull-changelog`, `../antsibull-docs-parser`, `../antsibull-docutils`, +and `../antsibull-fileutils` when running tests if those paths exist. You can change this behavior through the `OTHER_ANTSIBULL_MODE` env var: - `OTHER_ANTSIBULL_MODE=auto` — the default behavior described above - `OTHER_ANTSIBULL_MODE=local` — install the projects from `../antsibull-core`, - `../antsibull-changelog`, `../antsibull-docutils`, and `../antsibull-fileutils`. + `../antsibull-changelog`, `../antsibull-docs-parser`, `../antsibull-docutils`, + and `../antsibull-fileutils`. Fail if those paths don't exist. - `OTHER_ANTSIBULL_MODE=git` — install the projects from the Github main branch - `OTHER_ANTSIBULL_MODE=pypi` — install the latest version from PyPI @@ -89,12 +90,13 @@ To create a more complete local development env: ``` console git clone https://github.com/ansible-community/antsibull-changelog.git git clone https://github.com/ansible-community/antsibull-core.git +git clone https://github.com/ansible-community/antsibull-docs-parser.git git clone https://github.com/ansible-community/antsibull-docutils.git git clone https://github.com/ansible-community/antsibull.git cd antsibull python3 -m venv venv . ./venv/bin/activate -pip install -e '.[dev]' -e ../antsibull-changelog -e ../antsibull-core +pip install -e '.[dev]' -e ../antsibull-changelog -e ../antsibull-core -e ../antsibull-docs-parser -e ../antsibull-docutils [...] nox ``` diff --git a/changelogs/fragments/623-changelog.yaml b/changelogs/fragments/623-changelog.yaml new file mode 100644 index 00000000..ac062385 --- /dev/null +++ b/changelogs/fragments/623-changelog.yaml @@ -0,0 +1,3 @@ +minor_changes: + - "Automatically generate collection deprecation and removal changelog fragments from ``collection-meta.yaml`` information (https://github.com/ansible-community/antsibull/pull/623)." + - "Antsibull now depends on antsibull-docs-parser 1.x.y (https://github.com/ansible-community/antsibull/pull/623)." diff --git a/noxfile.py b/noxfile.py index 0c3d7f21..6f2dcd48 100644 --- a/noxfile.py +++ b/noxfile.py @@ -46,6 +46,7 @@ def other_antsibull( args = ( "antsibull-core", "antsibull-changelog", + "antsibull-docs-parser", "antsibull-docutils", "antsibull-fileutils", ) diff --git a/pyproject.toml b/pyproject.toml index 24aac8ee..3ea6e846 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -28,6 +28,7 @@ requires-python = ">=3.9" dependencies = [ "antsibull-changelog >= 0.24.0", "antsibull-core >= 3.1.0, < 4.0.0", + "antsibull-docs-parser >= 1.1.0, < 2.0.0", "antsibull-fileutils >= 1.0.0, < 2.0.0", "asyncio-pool", "build", diff --git a/src/antsibull/changelog.py b/src/antsibull/changelog.py index ef5d7383..6da2dc88 100644 --- a/src/antsibull/changelog.py +++ b/src/antsibull/changelog.py @@ -39,6 +39,10 @@ RemovalInformation, RemovedRemovalInformation, ) +from antsibull_docs_parser.parser import Context as _AnsibleMarkupContext +from antsibull_docs_parser.parser import Whitespace as _AnsibleMarkupWhitespace +from antsibull_docs_parser.parser import parse as _parse_ansible_markup +from antsibull_docs_parser.rst import to_rst_plain as _ansible_markup_to_rst from antsibull_fileutils.yaml import load_yaml_bytes from packaging.version import Version as PypiVer from semantic_version import Version as SemVer @@ -499,6 +503,16 @@ def __init__( self.collection_metadata = collection_metadata +def _markup_to_rst(markup: str) -> str: + return _ansible_markup_to_rst( + _parse_ansible_markup( + markup, + _AnsibleMarkupContext(), + whitespace=_AnsibleMarkupWhitespace.KEEP_SINGLE_NEWLINES, + ) + ) + + def _get_removal_entry( # noqa: C901, pylint:disable=too-many-branches collection: str, removal: RemovalInformation, @@ -575,7 +589,7 @@ def _get_removal_entry( # noqa: C901, pylint:disable=too-many-branches " due to violations of the Ansible inclusion requirements." ) if removal.reason_text: - sentences.append(removal.reason_text) + sentences.append(_markup_to_rst(removal.reason_text)) sentences.append( "See `the removal process for details on how this works and can be cancelled" " `__." @@ -662,7 +676,7 @@ def _get_removed_entry( # noqa: C901, pylint:disable=too-many-branches " due to violations of the Ansible inclusion requirements." ) if removal.reason_text: - sentences.append(removal.reason_text) + sentences.append(_markup_to_rst(removal.reason_text)) sentences.append( "See `Collections Removal Process for" " collections not satisfying the Collection requirements" @@ -677,7 +691,7 @@ def _get_removed_entry( # noqa: C901, pylint:disable=too-many-branches f"The {collection} collection has been removed from Ansible {removal.version.major}." ) if removal.reason_text: - sentences.append(removal.reason_text) + sentences.append(_markup_to_rst(removal.reason_text)) if removal.discussion: sentences.append( f"See `the removal discussion for details <{removal.discussion}>`__." From c7eb028f0f32974431d163e7462871480595ef4a Mon Sep 17 00:00:00 2001 From: Felix Fontein Date: Sun, 6 Oct 2024 18:34:27 +0200 Subject: [PATCH 07/11] Update more messages. --- src/antsibull/changelog.py | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/antsibull/changelog.py b/src/antsibull/changelog.py index 6da2dc88..c64fa571 100644 --- a/src/antsibull/changelog.py +++ b/src/antsibull/changelog.py @@ -549,10 +549,10 @@ def _get_removal_entry( # noqa: C901, pylint:disable=too-many-branches f" if no one starts maintaining it again before Ansible {removal.major_version}." ) sentences.append( - "See `the removal process for details on how this works" + "See `Collections Removal Process for unmaintained collections" " `__{link}." + "collection_package_removal.html#unmaintained-collections" + f">`__ for more details, including for how this can be cancelled{link}." ) if removal.reason == "renamed": @@ -591,10 +591,10 @@ def _get_removal_entry( # noqa: C901, pylint:disable=too-many-branches if removal.reason_text: sentences.append(_markup_to_rst(removal.reason_text)) sentences.append( - "See `the removal process for details on how this works and can be cancelled" + "See `Collections Removal Process for collections not satisfying the collection requirements" " `__{link}." + f">`__ for more details, including for how this can be cancelled{link}." ) if removal.reason == "other": @@ -678,11 +678,9 @@ def _get_removed_entry( # noqa: C901, pylint:disable=too-many-branches if removal.reason_text: sentences.append(_markup_to_rst(removal.reason_text)) sentences.append( - "See `Collections Removal Process for" - " collections not satisfying the Collection requirements" + "See `Collections Removal Process for collections not satisfying the collection requirements" " `__ for more details{link}." ) From e1f9a616c90daec1b5f7da57c7ac96a1a2dfd4be Mon Sep 17 00:00:00 2001 From: Felix Fontein Date: Sun, 6 Oct 2024 18:40:56 +0200 Subject: [PATCH 08/11] Linting. --- src/antsibull/changelog.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/antsibull/changelog.py b/src/antsibull/changelog.py index c64fa571..1cde1de0 100644 --- a/src/antsibull/changelog.py +++ b/src/antsibull/changelog.py @@ -591,7 +591,8 @@ def _get_removal_entry( # noqa: C901, pylint:disable=too-many-branches if removal.reason_text: sentences.append(_markup_to_rst(removal.reason_text)) sentences.append( - "See `Collections Removal Process for collections not satisfying the collection requirements" + "See `Collections Removal Process for collections" + " not satisfying the collection requirements" " `__ for more details, including for how this can be cancelled{link}." @@ -678,7 +679,8 @@ def _get_removed_entry( # noqa: C901, pylint:disable=too-many-branches if removal.reason_text: sentences.append(_markup_to_rst(removal.reason_text)) sentences.append( - "See `Collections Removal Process for collections not satisfying the collection requirements" + "See `Collections Removal Process for collections" + " not satisfying the collection requirements" " `__ for more details{link}." From 5fe60653245ec01fca3878189401e71ef04cb394 Mon Sep 17 00:00:00 2001 From: Felix Fontein Date: Mon, 7 Oct 2024 20:17:16 +0200 Subject: [PATCH 09/11] Use elif. Co-authored-by: Maxwell G --- src/antsibull/changelog.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/antsibull/changelog.py b/src/antsibull/changelog.py index 1cde1de0..d73c9677 100644 --- a/src/antsibull/changelog.py +++ b/src/antsibull/changelog.py @@ -542,7 +542,7 @@ def _get_removal_entry( # noqa: C901, pylint:disable=too-many-branches f">`__ for more details{link}." ) - if removal.reason == "considered-unmaintained": + elif removal.reason == "considered-unmaintained": sentences.append( f"The ``{collection}`` collection is considered unmaintained" f" and will be removed from Ansible {removal.major_version}" @@ -555,7 +555,7 @@ def _get_removal_entry( # noqa: C901, pylint:disable=too-many-branches f">`__ for more details, including for how this can be cancelled{link}." ) - if removal.reason == "renamed": + elif removal.reason == "renamed": sentences.append( f"The collection ``{collection}`` was renamed to ``{removal.new_name}``." ) @@ -583,7 +583,7 @@ def _get_removal_entry( # noqa: C901, pylint:disable=too-many-branches f"Please update your FQCNs from ``{collection}`` to ``{removal.new_name}``{link}." ) - if removal.reason == "guidelines-violation": + elif removal.reason == "guidelines-violation": sentences.append( f"The {collection} collection will be removed from Ansible {removal.major_version}" " due to violations of the Ansible inclusion requirements." @@ -598,7 +598,7 @@ def _get_removal_entry( # noqa: C901, pylint:disable=too-many-branches f">`__ for more details, including for how this can be cancelled{link}." ) - if removal.reason == "other": + elif removal.reason == "other": sentences.append( f"The {collection} collection will be removed from Ansible {removal.major_version}." ) From a471d72dfb3fc1ef6bfae6f34ab981d0a9628d28 Mon Sep 17 00:00:00 2001 From: Felix Fontein Date: Mon, 7 Oct 2024 20:17:59 +0200 Subject: [PATCH 10/11] More elifs. --- src/antsibull/changelog.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/antsibull/changelog.py b/src/antsibull/changelog.py index d73c9677..04fcc8c4 100644 --- a/src/antsibull/changelog.py +++ b/src/antsibull/changelog.py @@ -646,13 +646,13 @@ def _get_removed_entry( # noqa: C901, pylint:disable=too-many-branches f"The deprecated ``{collection}`` collection has been removed{link}." ) - if removal.reason == "considered-unmaintained": + elif removal.reason == "considered-unmaintained": sentences.append( f"The ``{collection}`` collection was considered unmaintained" f" and has been removed from Ansible {removal.version.major}{link}." ) - if removal.reason == "renamed": + elif removal.reason == "renamed": sentences.append( f"The collection ``{collection}`` has been completely removed from Ansible." ) @@ -671,7 +671,7 @@ def _get_removed_entry( # noqa: C901, pylint:disable=too-many-branches f"Please update your FQCNs from ``{collection}`` to ``{removal.new_name}``{link}." ) - if removal.reason == "guidelines-violation": + elif removal.reason == "guidelines-violation": sentences.append( f"The {collection} collection has been removed from Ansible {removal.version.major}" " due to violations of the Ansible inclusion requirements." @@ -686,7 +686,7 @@ def _get_removed_entry( # noqa: C901, pylint:disable=too-many-branches f">`__ for more details{link}." ) - if removal.reason == "other": + elif removal.reason == "other": sentences.append( f"The {collection} collection has been removed from Ansible {removal.version.major}." ) From 65620e1c2a1da46b8094efc6ba6353afd1b73feb Mon Sep 17 00:00:00 2001 From: Felix Fontein Date: Mon, 7 Oct 2024 21:30:13 +0200 Subject: [PATCH 11/11] Fix formulation. Co-authored-by: Maxwell G --- src/antsibull/changelog.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/antsibull/changelog.py b/src/antsibull/changelog.py index 04fcc8c4..75f7ec14 100644 --- a/src/antsibull/changelog.py +++ b/src/antsibull/changelog.py @@ -694,7 +694,7 @@ def _get_removed_entry( # noqa: C901, pylint:disable=too-many-branches sentences.append(_markup_to_rst(removal.reason_text)) if removal.discussion: sentences.append( - f"See `the removal discussion for details <{removal.discussion}>`__." + f"See `the removal discussion <{removal.discussion}>`__ for details." ) else: sentences.append(