[SCM] efficient 2D data-plotting library branch, master, updated. 8cfbee7cbbe8767904e3ef4e31fc33ef66893172

Picca Frédéric-Emmanuel picca at synchrotron-soleil.fr
Tue Nov 16 22:15:15 UTC 2010


The following commit has been merged in the master branch:
commit c92e44acc076d68ebeef7134fed7e77f8de7bce3
Author: Picca Frédéric-Emmanuel <picca at synchrotron-soleil.fr>
Date:   Tue Nov 16 17:14:34 2010 -0500

    * add the doc target for the sphinx documentation

diff --git a/setup.py b/setup.py
index ec1b805..0c3d426 100644
--- a/setup.py
+++ b/setup.py
@@ -25,6 +25,11 @@ from numpy.distutils.core import setup, Extension
 import os, os.path as osp
 join = osp.join
 
+try:
+    import sphinx
+except:
+    sphinx = None
+
 #TODO: copy qtdesigner plugins in Lib\site-packages\PyQt4\plugins\designer\python
 #      note: this directory doesn't exist for a default PyQt4 install
 
@@ -61,6 +66,34 @@ if os.name == 'nt':
 else:
     SCRIPTS = ['guiqwt-tests']
 
+
+### sphinx ###
+from distutils.command.build import build as dftbuild
+from distutils.cmd import Command
+class build(dftbuild):
+    def has_doc(self):
+        if sphinx is None: return False
+        setup_dir = os.path.dirname(os.path.abspath(__file__))
+        return os.path.isdir(os.path.join(setup_dir, 'doc'))
+
+    sub_commands = dftbuild.sub_commands + [('build_doc', has_doc)]
+
+cmdclass = {'build' : build }
+
+if sphinx:
+    from sphinx.setup_command import BuildDoc
+    import sys
+    class build_doc(BuildDoc):
+        def run(self):
+            # make sure the python path is pointing to the newly built
+            # code so that the documentation is built on this and not a
+            # previously installed version
+            build = self.get_finalized_command('build')
+            sys.path.insert(0, os.path.abspath(build.build_lib))
+            sphinx.setup_command.BuildDoc.run(self)
+            sys.path.pop(0)
+    cmdclass['build_doc'] = build_doc
+
 setup(name=LIBNAME, version=version,
       description=DESCRIPTION, long_description=LONG_DESCRIPTION,
       packages=PACKAGES, package_data=PACKAGE_DATA,
@@ -88,4 +121,5 @@ setup(name=LIBNAME, version=version,
         'Operating System :: Unix',
         'Programming Language :: Python :: 2.6',
         ],
+      cmdclass=cmdclass
       )

-- 
efficient 2D data-plotting library



More information about the debian-science-commits mailing list