wscript 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. #!/usr/bin/env python
  2. import os, re, subprocess
  3. from waflib import Options, TaskGen, Utils
  4. def options(opt):
  5. opt.load('rst')
  6. opt.load('tex')
  7. def configure(conf):
  8. conf.load('rst')
  9. conf.load('tex')
  10. def build(bld):
  11. bld(
  12. features='rst',
  13. target='test0.html',
  14. source='test0.rst',
  15. )
  16. bld(
  17. target='generated.rst',
  18. rule=lambda tsk: Utils.writef( tsk.outputs[0].abspath(), "Generated contents in %s" % tsk.outputs[0].name),
  19. )
  20. bld(
  21. target='generated.csv',
  22. rule=lambda tsk: Utils.writef( tsk.outputs[0].abspath(), "a,b,c\n1,2,%s" % tsk.outputs[0].name),
  23. )
  24. bld(
  25. target='generated.html',
  26. rule=lambda tsk: Utils.writef( tsk.outputs[0].abspath(), "<p>Generated HTML data</p>"),
  27. )
  28. bld(
  29. features='rst',
  30. target='test1.html',
  31. source='test1.rst',
  32. )
  33. bld(
  34. features='rst',
  35. target='test1.pdf',
  36. source='test1.rst',
  37. )
  38. for x in bld.path.ant_glob("**/*.svg"):
  39. bld(
  40. rule='inkscape --export-area-drawing --export-png=${TGT[0].bldpath()} ${SRC[0].bldpath()}',
  41. source=x,
  42. target=x.change_ext('.png'),
  43. )
  44. bld(
  45. rule='inkscape --export-area-drawing --export-pdf=${TGT[0].bldpath()} ${SRC[0].bldpath()}',
  46. source=x,
  47. target=x.change_ext('.pdf'),
  48. )
  49. bld(
  50. target='generated.tex',
  51. rule=lambda tsk: Utils.writef( tsk.outputs[0].abspath(), "Generated contents in %s" % tsk.outputs[0].name),
  52. )
  53. bld(
  54. features='rst',
  55. type='rst2latex',
  56. target='test2.tex',
  57. source='test2.rst',
  58. )
  59. bld(
  60. features='tex',
  61. source='test2.tex',
  62. )