summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Clay <matt@mystile.com>2023-02-23 15:37:12 -0800
committerGitHub <noreply@github.com>2023-02-23 15:37:12 -0800
commitf587856beb4afa11040418ecf83b0bfd3d528ab6 (patch)
tree0cd25995cb164c64dd8bba81403196750326e0ee
parentdc3c88be8bbe10d6e206eafc8471a94e84108947 (diff)
downloadansible-f587856beb4afa11040418ecf83b0bfd3d528ab6.tar.gz
Remove straight.plugin dependency (#80084)
-rw-r--r--changelogs/fragments/build-no-straight.yaml2
-rw-r--r--docs/docsite/requirements.txt1
-rwxr-xr-xhacking/build-ansible.py33
-rw-r--r--packaging/pep517_backend/_backend.py1
-rw-r--r--test/integration/targets/canonical-pep517-self-packaging/minimum-build-constraints.txt1
-rw-r--r--test/integration/targets/canonical-pep517-self-packaging/modernish-build-constraints.txt1
-rw-r--r--test/sanity/code-smell/docs-build.requirements.in1
-rw-r--r--test/sanity/code-smell/docs-build.requirements.txt1
-rw-r--r--test/sanity/code-smell/package-data.requirements.in1
-rw-r--r--test/sanity/code-smell/package-data.requirements.txt1
10 files changed, 32 insertions, 11 deletions
diff --git a/changelogs/fragments/build-no-straight.yaml b/changelogs/fragments/build-no-straight.yaml
new file mode 100644
index 0000000000..61195ba941
--- /dev/null
+++ b/changelogs/fragments/build-no-straight.yaml
@@ -0,0 +1,2 @@
+minor_changes:
+ - Removed ``straight.plugin`` from the build and packaging requirements.
diff --git a/docs/docsite/requirements.txt b/docs/docsite/requirements.txt
index 47b178eb14..4fb60fd511 100644
--- a/docs/docsite/requirements.txt
+++ b/docs/docsite/requirements.txt
@@ -15,4 +15,3 @@ sphinx-intl
sphinx-ansible-theme >= 0.9.1
sphinx
resolvelib
-straight.plugin # Needed for hacking/build-ansible.py which is the backend build script
diff --git a/hacking/build-ansible.py b/hacking/build-ansible.py
index c108c1861f..717cf1c1ce 100755
--- a/hacking/build-ansible.py
+++ b/hacking/build-ansible.py
@@ -10,16 +10,20 @@ __metaclass__ = type
import argparse
+import importlib
+import inspect
import os.path
+import pkgutil
import sys
-
-from straight.plugin import load
+import typing as t
try:
import argcomplete
except ImportError:
argcomplete = None
+C = t.TypeVar('C')
+
def build_lib_path(this_script=__file__):
"""Return path to the common build library directory."""
@@ -55,6 +59,27 @@ def create_arg_parser(program_name):
return parser
+def load(package: str, subclasses: t.Type[C]) -> list[t.Type[C]]:
+ """Load modules in the specified package and return concrete types that derive from the specified base class."""
+ for module in pkgutil.iter_modules(importlib.import_module(package).__path__, f'{package}.'):
+ try:
+ importlib.import_module(module.name)
+ except ImportError:
+ pass # ignore plugins which are missing dependencies
+
+ types: set[t.Type[C]] = set()
+ queue: list[t.Type[C]] = [subclasses]
+
+ while queue:
+ for child in queue.pop().__subclasses__():
+ queue.append(child)
+
+ if not inspect.isabstract(child):
+ types.add(child)
+
+ return sorted(types, key=lambda sc: sc.__name__)
+
+
def main():
"""
Start our run.
@@ -69,7 +94,9 @@ def main():
help='Show tracebacks and other debugging information')
subparsers = arg_parser.add_subparsers(title='Subcommands', dest='command',
help='for help use build-ansible.py SUBCOMMANDS -h')
- subcommands.pipe('init_parser', subparsers.add_parser)
+
+ for subcommand in subcommands:
+ subcommand.init_parser(subparsers.add_parser)
if argcomplete:
argcomplete.autocomplete(arg_parser)
diff --git a/packaging/pep517_backend/_backend.py b/packaging/pep517_backend/_backend.py
index 9adbc50f2f..14bc911aaa 100644
--- a/packaging/pep517_backend/_backend.py
+++ b/packaging/pep517_backend/_backend.py
@@ -103,6 +103,5 @@ def get_requires_for_build_sdist(
) + [
'docutils', # provides `rst2man`
'jinja2', # used in `hacking/build-ansible.py generate-man`
- 'straight.plugin', # used in `hacking/build-ansible.py` for subcommand
'pyyaml', # needed for importing in-tree `ansible-core` from `lib/`
]
diff --git a/test/integration/targets/canonical-pep517-self-packaging/minimum-build-constraints.txt b/test/integration/targets/canonical-pep517-self-packaging/minimum-build-constraints.txt
index ea5d808482..3ba47aeb4b 100644
--- a/test/integration/targets/canonical-pep517-self-packaging/minimum-build-constraints.txt
+++ b/test/integration/targets/canonical-pep517-self-packaging/minimum-build-constraints.txt
@@ -13,4 +13,3 @@ docutils == 0.16
Jinja2 == 3.0.0
MarkupSafe == 2.0.0
PyYAML == 5.3
-straight.plugin == 1.4.2
diff --git a/test/integration/targets/canonical-pep517-self-packaging/modernish-build-constraints.txt b/test/integration/targets/canonical-pep517-self-packaging/modernish-build-constraints.txt
index 7f744afde8..9b8e9d0aa6 100644
--- a/test/integration/targets/canonical-pep517-self-packaging/modernish-build-constraints.txt
+++ b/test/integration/targets/canonical-pep517-self-packaging/modernish-build-constraints.txt
@@ -8,4 +8,3 @@ docutils == 0.19
Jinja2 == 3.1.2
MarkupSafe == 2.1.2
PyYAML == 6.0
-straight.plugin == 1.5.0 # WARNING: v1.5.0 doesn't have a Git tag / src
diff --git a/test/sanity/code-smell/docs-build.requirements.in b/test/sanity/code-smell/docs-build.requirements.in
index 000eed7571..80e8f66bc7 100644
--- a/test/sanity/code-smell/docs-build.requirements.in
+++ b/test/sanity/code-smell/docs-build.requirements.in
@@ -4,6 +4,5 @@ resolvelib < 0.10.0
sphinx == 5.3.0
sphinx-notfound-page
sphinx-ansible-theme
-straight.plugin
rstcheck < 6 # rstcheck 6.x has problem with rstcheck.core triggered by include files w/ sphinx directives https://github.com/rstcheck/rstcheck-core/issues/3
antsibull-docs == 1.9.0 # currently approved version
diff --git a/test/sanity/code-smell/docs-build.requirements.txt b/test/sanity/code-smell/docs-build.requirements.txt
index 99a4195589..663e2c6c53 100644
--- a/test/sanity/code-smell/docs-build.requirements.txt
+++ b/test/sanity/code-smell/docs-build.requirements.txt
@@ -44,7 +44,6 @@ sphinxcontrib-jquery==2.0.0
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==1.0.3
sphinxcontrib-serializinghtml==1.1.5
-straight.plugin==1.5.0
Twiggy==0.5.1
types-docutils==0.18.3
typing_extensions==4.5.0
diff --git a/test/sanity/code-smell/package-data.requirements.in b/test/sanity/code-smell/package-data.requirements.in
index 9cb006c72a..acec62eff9 100644
--- a/test/sanity/code-smell/package-data.requirements.in
+++ b/test/sanity/code-smell/package-data.requirements.in
@@ -3,5 +3,4 @@ jinja2
pyyaml # ansible-core requirement
resolvelib < 0.10.0
rstcheck < 6 # match version used in other sanity tests
-straight.plugin
antsibull-changelog
diff --git a/test/sanity/code-smell/package-data.requirements.txt b/test/sanity/code-smell/package-data.requirements.txt
index fc436d6799..6411020e47 100644
--- a/test/sanity/code-smell/package-data.requirements.txt
+++ b/test/sanity/code-smell/package-data.requirements.txt
@@ -8,6 +8,5 @@ PyYAML==6.0
resolvelib==0.9.0
rstcheck==5.0.0
semantic-version==2.10.0
-straight.plugin==1.5.0
types-docutils==0.18.3
typing_extensions==4.5.0