From 3b72f7f6f3ad2b8b73ffb4c116bef1c91c2d5049 Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Wed, 15 Apr 2020 14:03:24 -0400 Subject: [PATCH] sphinx: set up the examples so they show up in the generated doc This tweaks the conf.py.in config so that examples shows up in the examples section of the doc. Note: These are examples, not tools, as tools are deployed, and examples are not. Since they are not deployed, just call them examples. Also include iio_info to the list. Signed-off-by: Robin Getz --- bindings/python/doc/conf.py.in | 1 + bindings/python/doc/examples.rst | 12 ++++++++++++ bindings/python/doc/iio_info.rst | 7 +++++++ bindings/python/doc/iio_readdev.rst | 2 +- bindings/python/doc/iio_writedev.rst | 2 +- bindings/python/doc/index.rst | 1 - bindings/python/doc/tools.rst | 8 -------- bindings/python/examples/iio_info.py | 3 +++ 8 files changed, 25 insertions(+), 11 deletions(-) create mode 100644 bindings/python/doc/iio_info.rst delete mode 100644 bindings/python/doc/tools.rst diff --git a/bindings/python/doc/conf.py.in b/bindings/python/doc/conf.py.in index da18eff02..33160cb4e 100644 --- a/bindings/python/doc/conf.py.in +++ b/bindings/python/doc/conf.py.in @@ -13,6 +13,7 @@ import os import sys sys.path.insert(0, os.path.abspath('../.')) +sys.path.insert(0, os.path.abspath('../examples')) import sphinx_rtd_theme diff --git a/bindings/python/doc/examples.rst b/bindings/python/doc/examples.rst index c7ad8f3fe..74f9a0453 100644 --- a/bindings/python/doc/examples.rst +++ b/bindings/python/doc/examples.rst @@ -1,6 +1,18 @@ Examples ================== + +Complete Application Examples +------------------------------ +.. toctree:: + iio_readdev + iio_writedev + iio_info + + +Code Snippets +----------------------------- + Scan contexts and list channels of each device .. code-block:: python diff --git a/bindings/python/doc/iio_info.rst b/bindings/python/doc/iio_info.rst new file mode 100644 index 000000000..7bb3edcfb --- /dev/null +++ b/bindings/python/doc/iio_info.rst @@ -0,0 +1,7 @@ +iio_info +===================== +| iio_info is part of the Libiio package, a library that has been developed to ease the development of software interfacing Linux Industrial I/O (IIO) devices. +| This tool is written using the libiio Python bindings. It works in the same way as the base iio_info works. You can find more informations about it on this `page `_. + +.. automodule:: iio_info + :members: diff --git a/bindings/python/doc/iio_readdev.rst b/bindings/python/doc/iio_readdev.rst index d6eda73ad..013618b83 100644 --- a/bindings/python/doc/iio_readdev.rst +++ b/bindings/python/doc/iio_readdev.rst @@ -3,5 +3,5 @@ iio_readdev | iio_readdev is part of the Libiio package, a library that has been developed to ease the development of software interfacing Linux Industrial I/O (IIO) devices. | This tool is written using the libiio Python bindings. It works in the same way as the base iio_readdev works. You can find more informations about it on this `page `_. -.. automodule:: examples.iio_readdev +.. automodule:: iio_readdev :members: diff --git a/bindings/python/doc/iio_writedev.rst b/bindings/python/doc/iio_writedev.rst index 73935287f..4f069e0d7 100644 --- a/bindings/python/doc/iio_writedev.rst +++ b/bindings/python/doc/iio_writedev.rst @@ -3,5 +3,5 @@ iio_writedev | iio_writedev is part of the Libiio package, a library that has been developed to ease the development of software interfacing Linux Industrial I/O (IIO) devices. | This tool is written using the libiio Python bindings. It works in the same way as the base iio_writedev works. You can find more informations about it on this `page `_. -.. automodule:: examples.iio_writedev +.. automodule:: iio_writedev :members: diff --git a/bindings/python/doc/index.rst b/bindings/python/doc/index.rst index 0e45e8bb9..2167e18e2 100644 --- a/bindings/python/doc/index.rst +++ b/bindings/python/doc/index.rst @@ -43,7 +43,6 @@ Components channel trigger examples - tools Indices and tables ================== diff --git a/bindings/python/doc/tools.rst b/bindings/python/doc/tools.rst deleted file mode 100644 index e2504d220..000000000 --- a/bindings/python/doc/tools.rst +++ /dev/null @@ -1,8 +0,0 @@ -Tools -====================== - -Components ----------------------- -.. toctree:: - iio_readdev - iio_writedev diff --git a/bindings/python/examples/iio_info.py b/bindings/python/examples/iio_info.py index ad055d0ba..26350771f 100755 --- a/bindings/python/examples/iio_info.py +++ b/bindings/python/examples/iio_info.py @@ -21,6 +21,9 @@ from sys import argv def main(): + """ + iio_info main (and only) loop. + """ print('Library version: %u.%u (git tag: %s)' % iio.version) if len(argv) == 3 and argv[1] == '--uri':