]> git.notmuchmail.org Git - notmuch/commitdiff
doc: add new python bindings to main documentation tree.
authorDavid Bremner <david@tethera.net>
Sat, 11 Jul 2020 13:20:27 +0000 (10:20 -0300)
committerDavid Bremner <david@tethera.net>
Wed, 15 Jul 2020 11:37:11 +0000 (08:37 -0300)
A separate conf.py and doc directory (or will be needed if someone wants
to build the bindings docs separately from notmuch.

configure
doc/conf.py
doc/index.rst
doc/python-bindings.rst [new file with mode: 0644]

index c8690d3a647b3da7d832c82935dadda56ff4828a..b4ee7f377bbbce420c00642b3fb8b503950f3a9c 100755 (executable)
--- a/configure
+++ b/configure
@@ -801,6 +801,7 @@ if [ $have_python3 -eq 1 ]; then
     if "$python" -c 'import cffi,setuptools; cffi.FFI().verify()' >/dev/null 2>&1; then
         printf "Yes.\n"
         have_python3_cffi=1
+        WITH_PYTHON_DOCS=1
     else
         printf "No (will not install CFFI-based python bindings).\n"
     fi
@@ -1554,6 +1555,9 @@ EOF
 if [ $WITH_EMACS = "1" ]; then
     printf "tags.add('WITH_EMACS')\n" >> sphinx.config
 fi
+if [ $WITH_PYTHON_DOCS = "1" ]; then
+    printf "tags.add('WITH_PYTHON')\n" >> sphinx.config
+fi
 printf "rsti_dir = '%s'\n" $(realpath emacs) >> sphinx.config
 
 # Finally, after everything configured, inform the user how to continue.
index fdff2a2c8ac524bacb86bb346ad03dfc2f31d997..94e266af5878c8590802780f23e8e8c99a42b81e 100644 (file)
@@ -4,6 +4,8 @@
 import sys
 import os
 
+extensions = [ 'sphinx.ext.autodoc' ]
+
 # The suffix of source filenames.
 source_suffix = '.rst'
 
@@ -22,6 +24,9 @@ for pathdir in ['.', '..']:
         with open(version_file,'r') as infile:
             version=infile.read().replace('\n','')
 
+# for autodoc
+sys.path.insert(0, os.path.join(location, '..', 'bindings', 'python-cffi', 'notmuch2'))
+
 # read generated config
 for pathdir in ['.', '..']:
     conf_file = os.path.join(location,pathdir,'sphinx.config')
@@ -50,6 +55,9 @@ else:
     # the docstring include files
     exclude_patterns.append('notmuch-emacs.rst')
 
+if not tags.has('WITH_PYTHON'):
+    exclude_patterns.append('python-bindings.rst')
+
 # The name of the Pygments (syntax highlighting) style to use.
 pygments_style = 'sphinx'
 
index 4440d93aad285ba1d3da14d692ba9f54c47af3c6..a3bf348084b8c2f8140515328a107436ffdb732f 100644 (file)
@@ -26,6 +26,7 @@ Contents:
    man7/notmuch-search-terms
    man1/notmuch-show
    man1/notmuch-tag
+   python-bindings
 
 Indices and tables
 ==================
diff --git a/doc/python-bindings.rst b/doc/python-bindings.rst
new file mode 100644 (file)
index 0000000..e1ad26a
--- /dev/null
@@ -0,0 +1,5 @@
+Python Bindings
+===============
+
+.. automodule:: notmuch2
+   :members: