diff --git a/doc/make.py b/doc/make.py index bdc035dd85f10b87ea1f36701f59420cded1e9ae..c643565a178f35bad8cc17b43d79d9909118ec15 100644 --- a/doc/make.py +++ b/doc/make.py @@ -1,6 +1,9 @@ import os, sys, re import shutil from ost import settings +from optparse import OptionParser + + if len(sys.argv)==2: root_dir=sys.argv[1] else: @@ -59,9 +62,34 @@ def _CollectRstDocs(outdir, dirname, fnames): for img in img_list: img_name = os.path.join(dirname,img) _CreateAndCopy(img_name, outdir) - + + +def ParseArgs(): + parser = OptionParser("usage: ost make.py [options] ") + parser.add_option("-l", "--linkcheck", dest="linkcheck", help="validate all external links") + parser.add_option("-b", "--build-html", dest="html", help="build html documentation") + parser.add_option("-d", "--doctest", dest="doctest", help="run all test") + return parser.parse_args() + +opts, args=ParseArgs() +if not opts.html and\ + not opts.linkcheck and\ + not opts.doctest: + print 'It is mandatory to choose at least one option' + command='ost '+sys.argv[0]+' -h' + os.system(command) + os._exit(-1) + + for sub_dir in ('modules',): os.path.walk(sub_dir, _CollectRstDocs, 'doc/source') sphinx_bin=settings.Locate(['sphinx-build', 'sphinx-build-2.6']) -os.system('%s -b html -c %s %s %s' % (sphinx_bin, 'doc/conf', 'doc/source', +if opts.html: + os.system('%s -b html -c %s %s %s' % (sphinx_bin, 'doc/conf', 'doc/source', + 'doc/build')) +if opts.doctest: + os.system('%s -b doctest -c %s %s %s' % (sphinx_bin, 'doc/conf', 'doc/source', + 'doc/build')) +if opts.linkcheck: + os.system('%s -b linkcheck -c %s %s %s' % (sphinx_bin, 'doc/conf', 'doc/source', 'doc/build')) diff --git a/modules/io/doc/io.rst b/modules/io/doc/io.rst index 33258a6a2045868c717eb32e6f0967122905d854..c410b50621d92e01e7878ecdcab4b644605854a7 100644 --- a/modules/io/doc/io.rst +++ b/modules/io/doc/io.rst @@ -175,3 +175,16 @@ For a list of file formats supported by :func:`SaveSequence` see :doc:`formats`. For a desription of how to use :func:`SaveAlignment` please refer to :func:`SaveSequence`. For a list of file formats supported by :func:`SaveAlignment` see :doc:`formats`. + +.. testsetup:: * + import io + +.. doctest:: + CHECKME + +.. testcode:: + print 'hi' + +.. testoutput:: + +