]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/python/config/tools/doc.py
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / python / config / tools / doc.py
1 #
2 # Copyright (c) 2016 Stefan Seefeld
3 # All rights reserved.
4 #
5 # Distributed under the Boost Software License, Version 1.0.
6 # (See accompanying file LICENSE_1_0.txt or copy at
7 # http://www.boost.org/LICENSE_1_0.txt)
8
9 from SCons.Script import AddOption, Flatten
10 from SCons.Script import Builder
11 from SCons.Action import Action
12 from SCons.Defaults import Copy
13 from SCons.Script import *
14 from subprocess import check_output, STDOUT, CalledProcessError
15 import sys
16 import os
17
18 def QuickBook(env, target, source, dependencies=[]):
19 """Compile a QuickBook document to BoostBook."""
20
21 for d in dependencies:
22 env.Depends(target, d)
23 env.Command(target, source, 'quickbook --input-file=$SOURCE --output-file=$TARGET')
24
25
26 def BoostBook(env, target, source, resources=[], args=[]):
27 """Compile a BoostBook document to DocBook."""
28
29 bb_prefix = env.GetOption('boostbook_prefix')
30 stylesheet = bb_prefix + '/xsl/docbook.xsl'
31 env.Command(target, source,
32 'xsltproc {} -o $TARGET {} $SOURCE'.format(' '.join(args), stylesheet))
33
34
35 def BoostHTML(env, target, source, resources=[], args=[]):
36 """Compile a DocBook document to HTML."""
37
38 bb_prefix = env.GetOption('boostbook_prefix')
39 stylesheet = bb_prefix + '/xsl/html.xsl'
40 env.Command(target, source,
41 'xsltproc {} -o $TARGET/ {} $SOURCE'.format(' '.join(args), stylesheet))
42 prefix=Dir('.').path
43 for r in resources:
44 r = File(r).path[len(prefix)+1:]
45 env.Depends(target, target + r)
46 env.Command(target + r, r, Copy('$TARGET', '$SOURCE'))
47
48
49 def BoostRST(env, target, source, resources=[]):
50 """Compile an RST document to HTML."""
51
52 prefix=Dir('.').path
53 for r in resources:
54 r = File(r).path[len(prefix)+1:]
55 env.Depends('html/' + r, r)
56 env.Command('html/' + r, r, Copy('$TARGET', '$SOURCE'))
57 env.Command(target, source,
58 'rst2html --link-stylesheet --traceback --trim-footnote-reference-space --footnote-references=superscript --stylesheet=rst.css $SOURCE $TARGET')
59
60
61 def BoostSphinx(env, target, source):
62 env.Sphinx(target, source)
63
64
65 def exists(env):
66 return True
67
68
69 def generate(env):
70
71 env.AddMethod(QuickBook)
72 env.AddMethod(BoostBook)
73 env.AddMethod(BoostHTML)
74 env.AddMethod(BoostRST)
75 env.AddMethod(BoostSphinx)