summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.opendev.org>2019-12-18 13:47:59 +0000
committerGerrit Code Review <review@openstack.org>2019-12-18 13:47:59 +0000
commit009b13b2df8cff141ec74c208d7cd46df0992fb8 (patch)
tree3d66113bddfa6896adc90688d2ff0d4c21f045b8
parentaa64e18b88b6b95994b97351058f706198e88554 (diff)
parent8e4ae2b86c9a4a9f475b5fe6cbd5250be4737812 (diff)
downloadcliff-009b13b2df8cff141ec74c208d7cd46df0992fb8.tar.gz
Merge "Add autoprogram_cliff_app_dist_name config opt"2.18.0
-rw-r--r--cliff/command.py6
-rw-r--r--cliff/sphinxext.py4
-rw-r--r--doc/source/user/sphinxext.rst8
3 files changed, 16 insertions, 2 deletions
diff --git a/cliff/command.py b/cliff/command.py
index c020edc..35f1ef7 100644
--- a/cliff/command.py
+++ b/cliff/command.py
@@ -137,8 +137,10 @@ class Command(object):
(h.obj.get_epilog() for h in self._hooks),
)
parts.extend(hook_epilogs)
- app_dist_name = _get_distribution_for_module(
- inspect.getmodule(self.app)
+ app_dist_name = getattr(
+ self, 'app_dist_name', _get_distribution_for_module(
+ inspect.getmodule(self.app)
+ )
)
dist_name = _get_distribution_for_module(inspect.getmodule(self))
if dist_name and dist_name != app_dist_name:
diff --git a/cliff/sphinxext.py b/cliff/sphinxext.py
index 8a9a2e6..265cccc 100644
--- a/cliff/sphinxext.py
+++ b/cliff/sphinxext.py
@@ -322,6 +322,9 @@ class AutoprogramCliffDirective(rst.Directive):
:returns: A list of nested docutil nodes
"""
command = command_class(None, None)
+ if not getattr(command, 'app_dist_name', None):
+ command.app_dist_name = (
+ self.env.config.autoprogram_cliff_app_dist_name)
parser = command.get_parser(command_name)
ignored_opts = ignored_opts or []
@@ -375,3 +378,4 @@ def setup(app):
app.add_directive('autoprogram-cliff', AutoprogramCliffDirective)
app.add_config_value('autoprogram_cliff_application', '', True)
app.add_config_value('autoprogram_cliff_ignored', ['--help'], True)
+ app.add_config_value('autoprogram_cliff_app_dist_name', None, True)
diff --git a/doc/source/user/sphinxext.rst b/doc/source/user/sphinxext.rst
index ae1cabe..46ac97e 100644
--- a/doc/source/user/sphinxext.rst
+++ b/doc/source/user/sphinxext.rst
@@ -125,6 +125,14 @@ Directive
.. seealso:: The ``:ignored:`` directive option.
+ `autoprogram_cliff_app_dist_name`
+ The name of the python distribution (the name used with pip, as opposed to
+ the package name used for importing) providing the commands/applications
+ being documented. Generated documentation for plugin components includes
+ a message indicating the name of the plugin. Setting this option tells
+ cliff the name of the distribution providing components natively so their
+ documentation does not include this message.
+
.. seealso::
Module `sphinxcontrib.autoprogram`