File: build_sphinx.py

package info (click to toggle)
obitools 1.2.13%2Bdfsg-5
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 4,652 kB
  • sloc: python: 18,199; ansic: 1,542; makefile: 98
file content (41 lines) | stat: -rw-r--r-- 1,093 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
'''
Created on 10 mars 2015

@author: coissac
'''

from distutils import log
from obidistutils.serenity.checkpackage import install_requirements
from obidistutils.serenity.rerun import rerun_with_anothe_python
from obidistutils.serenity import is_serenity
import os
import sys

try:
    from sphinx.setup_command import BuildDoc as ori_build_sphinx
    
    class build_sphinx(ori_build_sphinx):
        '''
        Build Sphinx documentation in html, epub and man formats 
        '''

        description = __doc__
    
        def run(self):
            self.builder='html'
            self.finalize_options()
            ori_build_sphinx.run(self)
            self.builder='epub'
            self.finalize_options()
            ori_build_sphinx.run(self)
            self.builder='man'
            self.finalize_options()
            ori_build_sphinx.run(self)

except ImportError:
    if not is_serenity() and install_requirements():
        log.info("Restarting installation with all dependencies ok")
        rerun_with_anothe_python(os.path.realpath(sys.executable))