]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/python/config/tools/doc.py
2 # Copyright (c) 2016 Stefan Seefeld
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)
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
18 def QuickBook(env
, target
, source
, dependencies
=[]):
19 """Compile a QuickBook document to BoostBook."""
21 for d
in dependencies
:
22 env
.Depends(target
, d
)
23 env
.Command(target
, source
, 'quickbook --input-file=$SOURCE --output-file=$TARGET')
26 def BoostBook(env
, target
, source
, resources
=[], args
=[]):
27 """Compile a BoostBook document to DocBook."""
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
))
35 def BoostHTML(env
, target
, source
, resources
=[], args
=[]):
36 """Compile a DocBook document to HTML."""
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
))
44 r
= File(r
).path
[len(prefix
)+1:]
45 env
.Depends(target
, target
+ r
)
46 env
.Command(target
+ r
, r
, Copy('$TARGET', '$SOURCE'))
49 def BoostRST(env
, target
, source
, resources
=[]):
50 """Compile an RST document to HTML."""
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')
61 def BoostSphinx(env
, target
, source
):
62 env
.Sphinx(target
, source
)
71 env
.AddMethod(QuickBook
)
72 env
.AddMethod(BoostBook
)
73 env
.AddMethod(BoostHTML
)
74 env
.AddMethod(BoostRST
)
75 env
.AddMethod(BoostSphinx
)