]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
doc/_ext: add python_path option to ceph-mgr-commands
authorKefu Chai <kchai@redhat.com>
Wed, 13 Jan 2021 02:30:46 +0000 (10:30 +0800)
committerKefu Chai <kchai@redhat.com>
Fri, 15 Jan 2021 09:25:27 +0000 (17:25 +0800)
so we can add more python paths in addition to the one used for finding
mgr modules.

Signed-off-by: Kefu Chai <kchai@redhat.com>
doc/_ext/ceph_commands.py
doc/api/mon_command_api.rst

index 685dd2933f6d37fc8c9951bbc70e7dc5b847a1b5..94790cd0220dc5c8add1e5c6cd48514960ee38b0 100644 (file)
@@ -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)]
index 1ef7594c5ce4905378e475c218cd2e462a6bf657..51a752a846ed9ad850c57db5ac8b60fd33861388 100644 (file)
@@ -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