[MOAB-dev] r2933 - in MOAB/trunk/tools/iMesh/python: . doc
jvporter at wisc.edu
jvporter at wisc.edu
Fri Jun 5 16:37:22 CDT 2009
Author: jvporter
Date: 2009-06-05 16:37:21 -0500 (Fri, 05 Jun 2009)
New Revision: 2933
Modified:
MOAB/trunk/tools/iMesh/python/doc/build.rst
MOAB/trunk/tools/iMesh/python/setup.py
Log:
* Add documentation building support for setup.py
* Document documentation building (this is like the chicken and the egg)
Modified: MOAB/trunk/tools/iMesh/python/doc/build.rst
===================================================================
--- MOAB/trunk/tools/iMesh/python/doc/build.rst 2009-06-05 19:03:38 UTC (rev 2932)
+++ MOAB/trunk/tools/iMesh/python/doc/build.rst 2009-06-05 21:37:21 UTC (rev 2933)
@@ -31,6 +31,25 @@
documentation (you're reading it!), `Sphinx <http://sphinx.pocoo.org/>`_ is
required.
+Testing
+=======
+
+To run unit/regression tests on the package, you may specify ``test`` as an
+argument to `setup.py`. The test command also accepts a verbosity level (an
+integer), specified with ``-v`` or ``--verbosity``.
+
+Building Documentation
+======================
+
+The documentation that you're currently reading can be built from `setup.py` by
+specifying ``doc`` as an argument. This command supports the following options:
+
++-----------------------+--------+---------------------------------------+
+| ``--builder=BUILDER`` | ``-b`` | documentation builder (default: html) |
++-----------------------+--------+---------------------------------------+
+| ``--target=TARGET`` | ``-t`` | target directory for output |
++-----------------------+--------+---------------------------------------+
+
With MOAB
=========
Modified: MOAB/trunk/tools/iMesh/python/setup.py
===================================================================
--- MOAB/trunk/tools/iMesh/python/setup.py 2009-06-05 19:03:38 UTC (rev 2932)
+++ MOAB/trunk/tools/iMesh/python/setup.py 2009-06-05 21:37:21 UTC (rev 2933)
@@ -41,8 +41,8 @@
'iMesh_tag.c']
)
-class test(Command):
- description = 'Execute tests'
+class TestCommand(Command):
+ description = 'Execute a variety of unit tests'
user_options = [
('verbosity=', 'v', 'verbosity level')
]
@@ -74,6 +74,33 @@
os.chdir(old)
+class DocCommand(Command):
+ description = 'Build documentation'
+ user_options = [
+ ('builder=', 'b', 'documentation builder'),
+ ('target=', 't', 'target directory')
+ ]
+
+ def initialize_options(self):
+ self.builder = 'html'
+ self.target = None
+ self.root = os.path.normpath(os.path.join(
+ os.path.abspath(sys.argv[0]), '../doc'))
+
+ def finalize_options(self):
+ if not self.target:
+ self.target = '_build/' + self.builder
+ self.target = os.path.abspath(os.path.join(self.root, self.target))
+
+ def run(self):
+ old = os.getcwd()
+
+ os.chdir(self.root)
+ os.system('sphinx-build -b "%s" -d _build/doctrees . "%s"' %
+ (self.builder, self.target))
+ os.chdir(old)
+
+
setup(name = 'PyTAPS',
version = '1.0b1',
description = 'Python bindings for iBase and iMesh interfaces',
@@ -85,5 +112,6 @@
ext_modules = [iBase, iMesh],
py_modules = ['itaps.helpers'],
- cmdclass = {'test' : test}
+ cmdclass = { 'test' : TestCommand,
+ 'doc' : DocCommand }
)
More information about the moab-dev
mailing list