From 925c4d8d0402d5fe1fb8c9252ac398b7f3525098 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Wed, 13 Jan 2021 10:30:46 +0800 Subject: [PATCH] doc/_ext: add python_path option to ceph-mgr-commands so we can add more python paths in addition to the one used for finding mgr modules. Signed-off-by: Kefu Chai --- doc/_ext/ceph_commands.py | 3 +++ doc/api/mon_command_api.rst | 1 + 2 files changed, 4 insertions(+) diff --git a/doc/_ext/ceph_commands.py b/doc/_ext/ceph_commands.py index 685dd2933f6..94790cd0220 100644 --- a/doc/_ext/ceph_commands.py +++ b/doc/_ext/ceph_commands.py @@ -221,6 +221,7 @@ class CephMgrCommands(Directive): required_arguments = 1 optional_arguments = 0 final_argument_whitespace = False + option_spec = {'python_path': directives.unchanged} def _normalize_path(self, dirname): my_dir = os.path.dirname(os.path.realpath(__file__)) @@ -315,6 +316,8 @@ class CephMgrCommands(Directive): def run(self): module_path = self._normalize_path(self.arguments[0]) sys.path.insert(0, module_path) + for path in self.options.get('python_path', '').split(':'): + sys.path.insert(0, self._normalize_path(path)) os.environ['UNITTEST'] = 'true' modules = [name for name in os.listdir(module_path) if self._is_mgr_module(module_path, name)] diff --git a/doc/api/mon_command_api.rst b/doc/api/mon_command_api.rst index 1ef7594c5ce..51a752a846e 100644 --- a/doc/api/mon_command_api.rst +++ b/doc/api/mon_command_api.rst @@ -1,2 +1,3 @@ .. ceph-mgr-commands:: src/pybind/mgr + :python_path: src/pybind .. ceph-mon-commands:: src/mon/MonCommands.h src/mgr/MgrCommands.h -- 2.39.5