diff --git a/playground/rst/wscript b/playground/rst/wscript index f3f03a56..b7638993 100644 --- a/playground/rst/wscript +++ b/playground/rst/wscript @@ -3,6 +3,8 @@ import os, re, subprocess from waflib import Options, TaskGen, Utils +top = out = '.' + def options(opt): opt.load('rst') opt.load('tex') @@ -20,32 +22,20 @@ def build(bld): bld( target='generated.rst', - rule=lambda tsk: Utils.writef( tsk.outputs[0].abspath(), "Generated contents in %s" % tsk.outputs[0].name), + rule=lambda tsk: tsk.outputs[0].write("Generated contents in %s" % tsk.outputs[0].name), ) - + bld( target='generated.csv', - rule=lambda tsk: Utils.writef( tsk.outputs[0].abspath(), "a,b,c\n1,2,%s" % tsk.outputs[0].name), + rule=lambda tsk: tsk.outputs[0].write("a,b,c\n1,2,%s" % tsk.outputs[0].name), ) - + bld( target='generated.html', - rule=lambda tsk: Utils.writef( tsk.outputs[0].abspath(), "
Generated HTML data
"), + rule=lambda tsk: tsk.outputs[0].write("Generated HTML data
"), ) - bld( - features='rst', - target='test1.html', - source='test1.rst', - ) - - bld( - features='rst', - target='test1.pdf', - source='test1.rst', - ) - - for x in bld.path.ant_glob("**/*.svg"): + for x in bld.path.ant_glob("**/*.svg", remove=False): bld( rule='inkscape --export-area-drawing --export-png=${TGT[0].bldpath()} ${SRC[0].bldpath()}', source=x, @@ -57,9 +47,24 @@ def build(bld): target=x.change_ext('.pdf'), ) + bld.add_group() + + bld( + features='rst', + target='test1.html', + source='test1.rst', + ) + + if bld.env.RST2PDF: + bld( + features='rst', + target='test1.pdf', + source='test1.rst', + ) + bld( target='generated.tex', - rule=lambda tsk: Utils.writef( tsk.outputs[0].abspath(), "Generated contents in %s" % tsk.outputs[0].name), + rule=lambda tsk: tsk.outputs[0].write("Generated contents in %s" % tsk.outputs[0].name)), ) bld( diff --git a/waflib/extras/rst.py b/waflib/extras/rst.py index f3c3a5eb..58b9e173 100644 --- a/waflib/extras/rst.py +++ b/waflib/extras/rst.py @@ -39,7 +39,7 @@ rst_progs = "rst2html rst2xetex rst2latex rst2xml rst2pdf rst2s5 rst2man rst2odt def parse_rst_node(task, node, nodes, names, seen, dirs=None): # TODO add extensibility, to handle custom rst include tags... if dirs is None: - dirs = (node.parent,node.get_bld().parent) + dirs = (node.parent, node.parent.get_bld()) if node in seen: return