File: make_docs.py

package info (click to toggle)
pida 0.3.1-2
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 2,408 kB
  • ctags: 4,300
  • sloc: python: 19,400; sh: 124; makefile: 21; xml: 11
file content (34 lines) | stat: -rw-r--r-- 921 bytes parent folder | download
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
#! /usr/bin/python

import os

rst_dir = 'rst'
html_dir = 'html'
latex_dir = 'latex'

rst2html_command = 'rst2html --toc-top-backlinks'
rst2tex_command = 'rst2latex'

def chdir():
    os.chdir('docs')

def main():
    chdir()
    for name in os.listdir(rst_dir):
        if name.endswith('.rst'):
            in_path = os.path.join(rst_dir, name)
            out_path_html = os.path.join(html_dir,
                                name.replace('.rst', '.html'))
            out_path_tex = os.path.join(latex_dir,
                                name.replace('.rst', '.tex'))
            os.system('%s %s > %s' % (rst2html_command,
                                      in_path, out_path_html))
            os.system('%s %s > %s' % (rst2tex_command,
                                      in_path, out_path_tex))


if __name__ == '__main__':
    main()

#cd ../../docs
#rst2latex rst/pida-manual.rst > html/pida-manual.html