mirror of
https://github.com/ansible/ansible-documentation.git
synced 2026-03-26 13:18:58 +07:00
Remove straight.plugin dependency (#80084)
This commit is contained in:
2
changelogs/fragments/build-no-straight.yaml
Normal file
2
changelogs/fragments/build-no-straight.yaml
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
minor_changes:
|
||||||
|
- Removed ``straight.plugin`` from the build and packaging requirements.
|
||||||
@@ -15,4 +15,3 @@ sphinx-intl
|
|||||||
sphinx-ansible-theme >= 0.9.1
|
sphinx-ansible-theme >= 0.9.1
|
||||||
sphinx
|
sphinx
|
||||||
resolvelib
|
resolvelib
|
||||||
straight.plugin # Needed for hacking/build-ansible.py which is the backend build script
|
|
||||||
|
|||||||
@@ -10,16 +10,20 @@ __metaclass__ = type
|
|||||||
|
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
|
import importlib
|
||||||
|
import inspect
|
||||||
import os.path
|
import os.path
|
||||||
|
import pkgutil
|
||||||
import sys
|
import sys
|
||||||
|
import typing as t
|
||||||
from straight.plugin import load
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import argcomplete
|
import argcomplete
|
||||||
except ImportError:
|
except ImportError:
|
||||||
argcomplete = None
|
argcomplete = None
|
||||||
|
|
||||||
|
C = t.TypeVar('C')
|
||||||
|
|
||||||
|
|
||||||
def build_lib_path(this_script=__file__):
|
def build_lib_path(this_script=__file__):
|
||||||
"""Return path to the common build library directory."""
|
"""Return path to the common build library directory."""
|
||||||
@@ -55,6 +59,27 @@ def create_arg_parser(program_name):
|
|||||||
return parser
|
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():
|
def main():
|
||||||
"""
|
"""
|
||||||
Start our run.
|
Start our run.
|
||||||
@@ -69,7 +94,9 @@ def main():
|
|||||||
help='Show tracebacks and other debugging information')
|
help='Show tracebacks and other debugging information')
|
||||||
subparsers = arg_parser.add_subparsers(title='Subcommands', dest='command',
|
subparsers = arg_parser.add_subparsers(title='Subcommands', dest='command',
|
||||||
help='for help use build-ansible.py SUBCOMMANDS -h')
|
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:
|
if argcomplete:
|
||||||
argcomplete.autocomplete(arg_parser)
|
argcomplete.autocomplete(arg_parser)
|
||||||
|
|||||||
@@ -103,6 +103,5 @@ def get_requires_for_build_sdist(
|
|||||||
) + [
|
) + [
|
||||||
'docutils', # provides `rst2man`
|
'docutils', # provides `rst2man`
|
||||||
'jinja2', # used in `hacking/build-ansible.py generate-man`
|
'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/`
|
'pyyaml', # needed for importing in-tree `ansible-core` from `lib/`
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -13,4 +13,3 @@ docutils == 0.16
|
|||||||
Jinja2 == 3.0.0
|
Jinja2 == 3.0.0
|
||||||
MarkupSafe == 2.0.0
|
MarkupSafe == 2.0.0
|
||||||
PyYAML == 5.3
|
PyYAML == 5.3
|
||||||
straight.plugin == 1.4.2
|
|
||||||
|
|||||||
@@ -8,4 +8,3 @@ docutils == 0.19
|
|||||||
Jinja2 == 3.1.2
|
Jinja2 == 3.1.2
|
||||||
MarkupSafe == 2.1.2
|
MarkupSafe == 2.1.2
|
||||||
PyYAML == 6.0
|
PyYAML == 6.0
|
||||||
straight.plugin == 1.5.0 # WARNING: v1.5.0 doesn't have a Git tag / src
|
|
||||||
|
|||||||
@@ -4,6 +4,5 @@ resolvelib < 0.10.0
|
|||||||
sphinx == 5.3.0
|
sphinx == 5.3.0
|
||||||
sphinx-notfound-page
|
sphinx-notfound-page
|
||||||
sphinx-ansible-theme
|
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
|
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
|
antsibull-docs == 1.9.0 # currently approved version
|
||||||
|
|||||||
@@ -44,7 +44,6 @@ sphinxcontrib-jquery==2.0.0
|
|||||||
sphinxcontrib-jsmath==1.0.1
|
sphinxcontrib-jsmath==1.0.1
|
||||||
sphinxcontrib-qthelp==1.0.3
|
sphinxcontrib-qthelp==1.0.3
|
||||||
sphinxcontrib-serializinghtml==1.1.5
|
sphinxcontrib-serializinghtml==1.1.5
|
||||||
straight.plugin==1.5.0
|
|
||||||
Twiggy==0.5.1
|
Twiggy==0.5.1
|
||||||
types-docutils==0.18.3
|
types-docutils==0.18.3
|
||||||
typing_extensions==4.5.0
|
typing_extensions==4.5.0
|
||||||
|
|||||||
@@ -3,5 +3,4 @@ jinja2
|
|||||||
pyyaml # ansible-core requirement
|
pyyaml # ansible-core requirement
|
||||||
resolvelib < 0.10.0
|
resolvelib < 0.10.0
|
||||||
rstcheck < 6 # match version used in other sanity tests
|
rstcheck < 6 # match version used in other sanity tests
|
||||||
straight.plugin
|
|
||||||
antsibull-changelog
|
antsibull-changelog
|
||||||
|
|||||||
@@ -8,6 +8,5 @@ PyYAML==6.0
|
|||||||
resolvelib==0.9.0
|
resolvelib==0.9.0
|
||||||
rstcheck==5.0.0
|
rstcheck==5.0.0
|
||||||
semantic-version==2.10.0
|
semantic-version==2.10.0
|
||||||
straight.plugin==1.5.0
|
|
||||||
types-docutils==0.18.3
|
types-docutils==0.18.3
|
||||||
typing_extensions==4.5.0
|
typing_extensions==4.5.0
|
||||||
|
|||||||
Reference in New Issue
Block a user