|
Boost-Build : |
From: Vladimir Prus (ghost_at_[hidden])
Date: 2004-12-03 02:25:19
Hi Dave,
> generators.register-standard docutils.html : ReST : HTML ;
>
> rule init ( docutils-dir )
> {
> docutils-dir ?= [ modules.peek : DOCUTILS_DIR ] ;
>
> if ! $(.initialized)
> {
> .initialized = true ;
> .docutils-dir = [ path.make $(docutils-dir) ] ;
> }
It's not clear to me that duplicate initialization of this module should be
ignored. I'd check if the specified 'docutils-dir' is different from the
first invocation. If yet, I'd issue an error, otherwise, I'd ignore the
second invocation. That's not very important however.
> rule html ( target : source )
This should be
rule html ( target : source : properties * )
{
> {
> docutils-dir on $(target) = $(.docutils-dir) ;
> }
>
> if [ os.name ] = NT
> {
> .setup = "set PYTHONPATH="$(.docutils-dir);$(.docutils-dir)\\extras ;
> }
> else
> {
> .setup = PYTHONPATH=$(.docutils-dir):"$(.docutils-dir)/extras ;
> export PYTHONPATH" ;
> }
I think you might want to look at common.path-variable-setting-command, which
should take care of system differences.
> ---- end docutils.jam ----
>
> So, did I get this right,
Except for 'html' parameter, everithing should be working.
> and if so, how do I use it in a Jamfile? My
> Jamroot looks like:
>
> project mplbook ;
> import boostbook ;
>
> for src in [ glob *.rst ]
> {
> ### What goes here?? ###
> }
Obviously, there should be an invocation of main target rule. You can either
define it yourself (like boostbook.jam defined the 'boostbook' rule, or let
V2 do it for you:
http://boost.org/boost-build2/doc/html/bbv2/extending/rules.html
(Look for "the second approach" phrase). In your case, you want to convert rst
to html, so the main target rules can be reasonably called "html". This patch
does the trick:
Index: boostbook.jam
===================================================================
RCS file: /cvsroot/boost/boost/tools/build/v2/tools/boostbook.jam,v
retrieving revision 1.27
diff -u -r1.27 boostbook.jam
--- boostbook.jam 13 Nov 2004 09:29:55 -0000 1.27
+++ boostbook.jam 3 Dec 2004 07:21:26 -0000
@@ -32,7 +32,7 @@
type.register XML : xml : : main ;
type.register BOOSTBOOK : boostbook : XML ;
type.register DOCBOOK : docbook : XML ;
-type.register HTML : html ;
+type.register HTML : html : : main ;
After applying this change, and fixing 'html' parameters list, I get:
$ bjam -n
...found 7 targets...
...updating 1 target...
docutils.html bin/gcc-3.4/debug/a.html
python foo/tools/rst2html.py
a.rst bin/gcc-3.4/debug/a.html
With Jamroot of:
using docutils : foo ;
import boostbook ;
html a : a.rst ;
HTH,
Volodya
Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk