From 8f278c2aa1d0823fd7bf764ef90d303ea117fe98 Mon Sep 17 00:00:00 2001 From: juergen <juergen@5a81b35b-ba03-0410-adc8-b2c5c5119f08> Date: Wed, 23 Jun 2010 15:51:11 +0000 Subject: [PATCH] adding partial support for doctest and linkcheck to docu generating script git-svn-id: https://dng.biozentrum.unibas.ch/svn/openstructure/trunk@2455 5a81b35b-ba03-0410-adc8-b2c5c5119f08 --- doc/make.py | 32 ++++++++++++++++++++++++++++++-- modules/io/doc/io.rst | 13 +++++++++++++ 2 files changed, 43 insertions(+), 2 deletions(-) diff --git a/doc/make.py b/doc/make.py index bdc035dd8..c643565a1 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 33258a6a2..c410b5062 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:: + + -- GitLab