[SCM] dataset manipulation GUI generator branch, master, updated. upstream/1.2.2-15-gde67e50

Frédéric-Emmanuel PICCA picca at synchrotron-soleil.fr
Mon Nov 8 10:38:44 UTC 2010


The following commit has been merged in the master branch:
commit 85623853868a6309b557d90f2419cfce135d0839
Author: Frédéric-Emmanuel PICCA <picca at synchrotron-soleil.fr>
Date:   Mon Nov 8 09:43:09 2010 +0100

    * add the sphinx target

diff --git a/setup.py b/setup.py
index d6e8862..ef37e14 100644
--- a/setup.py
+++ b/setup.py
@@ -23,6 +23,10 @@ Licensed under the terms of the CECILL License
 from distutils.core import setup
 import os, os.path as osp
 
+try:
+    import sphinx
+except:
+    sphinx = None
 
 def get_package_data(name, extlist):
     """
@@ -60,6 +64,34 @@ if os.name == 'nt':
 else:
     SCRIPTS = ['guidata-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,
@@ -75,5 +107,5 @@ setup(name=LIBNAME, version=version,
         'Operating System :: POSIX',
         'Operating System :: Unix',
         'Programming Language :: Python :: 2.6',
-        ],
+        ],cmdclass=cmdclass
       )

-- 
dataset manipulation GUI generator



More information about the debian-science-commits mailing list