Skip to content
Snippets Groups Projects
Commit 8f278c2a authored by juergen's avatar juergen
Browse files

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
parent 8e1fb8be
No related branches found
No related tags found
No related merge requests found
import os, sys, re import os, sys, re
import shutil import shutil
from ost import settings from ost import settings
from optparse import OptionParser
if len(sys.argv)==2: if len(sys.argv)==2:
root_dir=sys.argv[1] root_dir=sys.argv[1]
else: else:
...@@ -59,9 +62,34 @@ def _CollectRstDocs(outdir, dirname, fnames): ...@@ -59,9 +62,34 @@ def _CollectRstDocs(outdir, dirname, fnames):
for img in img_list: for img in img_list:
img_name = os.path.join(dirname,img) img_name = os.path.join(dirname,img)
_CreateAndCopy(img_name, outdir) _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',): for sub_dir in ('modules',):
os.path.walk(sub_dir, _CollectRstDocs, 'doc/source') os.path.walk(sub_dir, _CollectRstDocs, 'doc/source')
sphinx_bin=settings.Locate(['sphinx-build', 'sphinx-build-2.6']) 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')) 'doc/build'))
...@@ -175,3 +175,16 @@ For a list of file formats supported by :func:`SaveSequence` see :doc:`formats`. ...@@ -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 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`. For a list of file formats supported by :func:`SaveAlignment` see :doc:`formats`.
.. testsetup:: *
import io
.. doctest::
CHECKME
.. testcode::
print 'hi'
.. testoutput::
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment