waf/playground/rst/wscript

82 lines
1.4 KiB
Plaintext
Raw Permalink Normal View History

2013-08-25 21:34:45 +02:00
#!/usr/bin/env python
import os, re, subprocess
from waflib import Options, TaskGen, Utils
2024-05-20 21:04:25 +02:00
top = out = '.'
2013-08-25 21:34:45 +02:00
def options(opt):
opt.load('rst')
opt.load('tex')
def configure(conf):
conf.load('rst')
conf.load('tex')
def build(bld):
2013-08-25 22:35:49 +02:00
bld(
features='rst',
target='test0.html',
source='test0.rst',
)
bld(
target='generated.rst',
2024-05-20 21:04:25 +02:00
rule=lambda tsk: tsk.outputs[0].write("Generated contents in %s" % tsk.outputs[0].name),
2013-08-25 22:35:49 +02:00
)
2024-05-20 21:04:25 +02:00
2013-08-25 23:01:28 +02:00
bld(
target='generated.csv',
2024-05-20 21:04:25 +02:00
rule=lambda tsk: tsk.outputs[0].write("a,b,c\n1,2,%s" % tsk.outputs[0].name),
2013-08-25 23:01:28 +02:00
)
2013-08-25 21:34:45 +02:00
bld(
2024-05-20 21:04:25 +02:00
target='generated.html',
rule=lambda tsk: tsk.outputs[0].write("<p>Generated HTML data</p>"),
2013-08-25 21:34:45 +02:00
)
2024-05-20 21:04:25 +02:00
for x in bld.path.ant_glob("**/*.svg", remove=False):
2013-08-25 21:34:45 +02:00
bld(
rule='inkscape --export-area-drawing --export-png=${TGT[0].bldpath()} ${SRC[0].bldpath()}',
source=x,
target=x.change_ext('.png'),
)
bld(
rule='inkscape --export-area-drawing --export-pdf=${TGT[0].bldpath()} ${SRC[0].bldpath()}',
source=x,
target=x.change_ext('.pdf'),
)
2024-05-20 21:04:25 +02:00
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',
)
2013-08-26 01:57:29 +02:00
bld(
target='generated.tex',
2024-05-20 21:04:25 +02:00
rule=lambda tsk: tsk.outputs[0].write("Generated contents in %s" % tsk.outputs[0].name)),
2013-08-26 01:57:29 +02:00
)
2013-08-25 21:34:45 +02:00
bld(
features='rst',
type='rst2latex',
target='test2.tex',
source='test2.rst',
)
bld(
features='tex',
source='test2.tex',
)