shithub: aubio

Download patch

ref: 7800335d5269df34a7aad8a02fcf09df37207c87
parent: 4b251ae94c0ea51c85f7ff121550129bda53dbab
author: Paul Brossier <piem@piem.org>
date: Fri Sep 16 14:33:17 EDT 2016

wscript: build sphinx documentation if sphinx-build is found in PATH

--- a/wscript
+++ b/wscript
@@ -326,6 +326,12 @@
         except ctx.errors.ConfigurationError:
           ctx.to_log('doxygen was not found (ignoring)')
 
+        # check if sphinx-build is installed, optional
+        try:
+          ctx.find_program('sphinx-build', var='SPHINX')
+        except ctx.errors.ConfigurationError:
+          ctx.to_log('sphinx-build was not found (ignoring)')
+
 def build(bld):
     bld.env['VERSION'] = VERSION
     bld.env['LIB_VERSION'] = LIB_VERSION
@@ -365,6 +371,16 @@
         bld.install_files( '${PREFIX}' + '/share/doc/libaubio-doc',
                 bld.path.ant_glob('doc/web/html/**'),
                 cwd = bld.path.find_dir ('doc/web'),
+                relative_trick = True)
+
+    # build documentation from source files using sphinx-build
+    if bld.env['SPHINX']:
+        bld( name = 'sphinx', rule = 'make html',
+                source = ['doc/conf.py'] + bld.path.ant_glob('doc/**.rst'),
+                cwd = 'doc')
+        bld.install_files( '${PREFIX}' + '/share/doc/libaubio-doc/sphinx',
+                bld.path.ant_glob('doc/_build/html/**'),
+                cwd = bld.path.find_dir ('doc/_build/html'),
                 relative_trick = True)
 
 def shutdown(bld):