From 50ab91473e9abed9823641facb1ffdb9309ac9ea Mon Sep 17 00:00:00 2001 From: Yehuda Sadeh Date: Mon, 29 Nov 2021 15:31:42 -0800 Subject: [PATCH] doc/rgw: fix docs build Workaround rgw modules conflict, as there are two separate modules named rgw: src/pybind/rgw, src/pybind/mgr/rgw Signed-off-by: Yehuda Sadeh --- doc/_ext/ceph_commands.py | 6 ++++++ doc/conf.py | 3 +++ 2 files changed, 9 insertions(+) diff --git a/doc/_ext/ceph_commands.py b/doc/_ext/ceph_commands.py index 046a5e09c39..861a013ea5a 100644 --- a/doc/_ext/ceph_commands.py +++ b/doc/_ext/ceph_commands.py @@ -9,6 +9,7 @@ from jinja2 import Template from pcpp.preprocessor import Preprocessor from sphinx.util import logging from sphinx.util.console import bold +from importlib import reload logger = logging.getLogger(__name__) @@ -310,6 +311,7 @@ class CephMgrCommands(Directive): with self.mocked_modules(): logger.info(bold(f"loading mgr module '{name}'...")) mgr_mod = __import__(name, globals(), locals(), [], 0) + reload(mgr_mod) from tests import M def subclass(x): @@ -355,6 +357,10 @@ class CephMgrCommands(Directive): cmds = [cmd for cmd in cmds if 'hidden' not in cmd.flags] cmds = sorted(cmds, key=lambda cmd: cmd.prefix) self._render_cmds(cmds) + + orig_rgw_mod = sys.modules['pybind_rgw_mod'] + sys.modules['rgw'] = orig_rgw_mod + return [] diff --git a/doc/conf.py b/doc/conf.py index 690843a74ff..c4d5bfb49c6 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -13,6 +13,9 @@ top_level = \ os.path.dirname( os.path.abspath(__file__))) +pybind_rgw_mod = __import__('rgw', globals(), locals(), [], 0) +sys.modules['pybind_rgw_mod'] = pybind_rgw_mod + def parse_ceph_release(): with open(os.path.join(top_level, 'src/ceph_release')) as f: