]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
doc/conf.py: exclude pybindings docs from build for RTD
authorKefu Chai <kchai@redhat.com>
Thu, 9 Apr 2020 08:51:06 +0000 (16:51 +0800)
committerKefu Chai <kchai@redhat.com>
Thu, 9 Apr 2020 14:47:56 +0000 (22:47 +0800)
because it'd difficult to prepare (dummy) librados,libcephfs and librbd for
their python bindings in the building environment offered by Read the Docs.

Signed-off-by: Kefu Chai <kchai@redhat.com>
doc/conf.py

index 6ed0f7ee5f68eca080c17bc16422b0ca0f2799a7..d69b8f9ab7213a36f7ddf74a62f0f09b05a1c838 100644 (file)
@@ -110,8 +110,21 @@ class Mock(object):
 
 sys.modules['ceph_module'] = Mock()
 
-for pybind in [os.path.join(top_level, 'src/pybind'),
-               os.path.join(top_level, 'src/pybind/mgr'),
-               os.path.join(top_level, 'src/python-common')]:
+if os.environ.get('READTHEDOCS') == 'True':
+    exclude_patterns += ['**/api/*',
+                         '**/api.rst']
+    autodoc_mock_imports = ['cephfs',
+                            'rados',
+                            'rbd',
+                            'ceph']
+    pybinds = ['pybind/mgr',
+               'python-common']
+else:
+    pybinds = ['pybind',
+               'pybind/mgr',
+               'python-common']
+
+for c in pybinds:
+    pybind = os.path.join(top_level, 'src', c)
     if pybind not in sys.path:
         sys.path.insert(0, pybind)