Skip to content

Commit

Permalink
build_meta: remove ansible-core Github repo links
Browse files Browse the repository at this point in the history
This removes the Bug Tracker and Source Code links from the ansible
package's Python metadata that point to ansible-core repository.

These links are confusing. ansible-core's issue tracker is only for
issues that apply to core, not all of the ansible package. None of the
source code from ansible/ansible is included directly in this package,
either.

The ansible-core links are replaced with a link to the forum and a link
to the ansible-build-data repository.

This only applies to ansible >= 9.0.0rc1.
  • Loading branch information
gotmax23 committed Nov 13, 2023
1 parent 27754fb commit db3130d
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 20 deletions.
5 changes: 5 additions & 0 deletions changelogs/fragments/558-classifiers2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
minor_changes:
- "``ansible`` python metadata - remove links specific to ``ansible-core``
and add links to the Ansible forum and the ``ansible-build-data`` repository
(https://github.com/ansible-community/antsibull/pull/558)."
3 changes: 3 additions & 0 deletions src/antsibull/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,12 @@
"PACKAGE_DATA_NEW_METHOD": PypiVer("8.0.0a1"),
# Whether to store setuptools config in setup.cfg
"BUILD_META_MAKER": PypiVer("9.0.0.dev0"),
"BUILD_META_NEW_URLS": PypiVer("9.0.0rc1"),
}

DOCSITE_BASE_URL = "https://docs.ansible.com/ansible"
DOCSITE_COMMUNITY_URL = "https://docs.ansible.com/ansible/latest/community"
BUILD_DATA_URL = "https://github.com/ansible-community/ansible-build-data"
ANSIBLE_FORUM_URL = "https://forum.ansible.com"

COLLECTION_EXCLUDE_DIRS = ("docs", "tests")
43 changes: 30 additions & 13 deletions src/antsibull/python_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
from packaging.version import Version as PypiVer

from .constants import (
ANSIBLE_FORUM_URL,
BUILD_DATA_URL,
COLLECTION_EXCLUDE_DIRS,
DOCSITE_BASE_URL,
DOCSITE_COMMUNITY_URL,
Expand Down Expand Up @@ -65,6 +67,28 @@ def _i_iter_lines(self) -> Iterator[str]:

INI_TYPES = Union[IniType, str, bool]

OLD_URLS = IniDict(
{
"Bug Tracker": "https://github.com/ansible/ansible/issues",
"Code of Conduct": DOCSITE_COMMUNITY_URL + "/code_of_conduct.html",
"Documentation": DOCSITE_BASE_URL,
"Mailing lists": DOCSITE_COMMUNITY_URL
+ "/communication.html#mailing-list-information",
"Source Code": "https://github.com/ansible/ansible",
}
)

NEW_URLS = IniDict(
{
"Build Data": BUILD_DATA_URL,
"Code of Conduct": DOCSITE_COMMUNITY_URL + "/code_of_conduct.html",
"Documentation": DOCSITE_BASE_URL,
"Forum": ANSIBLE_FORUM_URL,
"Mailing lists": DOCSITE_COMMUNITY_URL
+ "/communication.html#mailing-list-information",
}
)

DEFAULT_METADATA: dict[str, INI_TYPES] = {
"name": "ansible",
"description": "Radically simple IT automation",
Expand All @@ -73,19 +97,6 @@ def _i_iter_lines(self) -> Iterator[str]:
"author": "Ansible, Inc.",
"author_email": "[email protected]",
"url": "https://ansible.com/",
"project_urls": IniDict(
{
# XXX: Should we replace Bug Tracker and Source Code with something
# else that's not copied from ansible-core?
# Should we use ansible_core_repo_url from LibContext instead?
"Bug Tracker": "https://github.com/ansible/ansible/issues",
"Code of Conduct": DOCSITE_COMMUNITY_URL + "/code_of_conduct.html",
"Documentation": DOCSITE_BASE_URL,
"Mailing lists": DOCSITE_COMMUNITY_URL
+ "/communication.html#mailing-list-information",
"Source Code": "https://github.com/ansible/ansible",
}
),
"license": "GPL-3.0-or-later",
"classifiers": IniList(
[
Expand Down Expand Up @@ -272,6 +283,12 @@ def generate(self) -> None:
self["metadata"].setdefault("classifiers", IniList()).extend(
self.core_python_classifiers
)
self["metadata"].setdefault(
"project_urls",
NEW_URLS
if self.ansible_version >= MINIMUM_ANSIBLE_VERSIONS["BUILD_META_NEW_URLS"]
else OLD_URLS,
)
self["options"].setdefault("install_requires", IniList()).append(
f"ansible-core ~= {self.ansible_core_version}"
)
Expand Down
12 changes: 6 additions & 6 deletions tests/test_data/package-files/force_setup_cfg/8.1.0/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,6 @@ long_description_content_type = text/x-rst
author = Ansible, Inc.
author_email = [email protected]
url = https://ansible.com/
project_urls =
Bug Tracker = https://github.com/ansible/ansible/issues
Code of Conduct = https://docs.ansible.com/ansible/latest/community/code_of_conduct.html
Documentation = https://docs.ansible.com/ansible
Mailing lists = https://docs.ansible.com/ansible/latest/community/communication.html#mailing-list-information
Source Code = https://github.com/ansible/ansible
license = GPL-3.0-or-later
classifiers =
Development Status :: 5 - Production/Stable
Expand All @@ -29,6 +23,12 @@ classifiers =
Programming Language :: Python :: 3.11
Programming Language :: Python :: 3 :: Only
version = 8.1.0
project_urls =
Build Data = https://github.com/ansible-community/ansible-build-data
Code of Conduct = https://docs.ansible.com/ansible/latest/community/code_of_conduct.html
Documentation = https://docs.ansible.com/ansible
Forum = https://forum.ansible.com
Mailing lists = https://docs.ansible.com/ansible/latest/community/communication.html#mailing-list-information

[options]
zip_safe = False
Expand Down
7 changes: 6 additions & 1 deletion tests/verify_package_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,12 @@ def generate_package_files(
if force_generate_setup_cfg
else contextlib.nullcontext()
)
with cm:
cm2 = (
patch_dict(MINIMUM_ANSIBLE_VERSIONS, "BUILD_META_NEW_URLS", PypiVer(version))
if force_generate_setup_cfg
else contextlib.nullcontext()
)
with cm, cm2:
if r := antsibull_build.run(
[
"antsibull-build",
Expand Down

0 comments on commit db3130d

Please sign in to comment.