X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=doc%2Fchm-builder.py;fp=doc%2Fchm-builder.py;h=8ac5b2518957d2eaf3e37d04f31586bd433b76f4;hb=dee2d8a24e84bec51a3dec2b4b2955517c254c1d;hp=0000000000000000000000000000000000000000;hpb=c52b397260f8b6f2c50595de36f06bc5e074163f;p=bertos.git diff --git a/doc/chm-builder.py b/doc/chm-builder.py new file mode 100644 index 00000000..8ac5b251 --- /dev/null +++ b/doc/chm-builder.py @@ -0,0 +1,38 @@ +""" +To be used on windows platform only to generate BeRTOS .chm documentation. +Requires doxygen.exe and hhc.exe to be in the system PATH. +""" +from __future__ import with_statement +import os, sys + +def move(old_path, new_path): + if os.path.exists(new_path): + os.unlink(new_path) + os.rename(old_path, new_path) + + +if sys.platform != 'win32': + print "This program can be run only on a Windows machine" + sys.exit(-1) + +if len(sys.argv) < 1: + print "Usage: " + sys.argv[0] + " [custom_doxyfile]" + sys.exit(-1) + +toc_modifier = r"doc\chm-toc-modifier.py" +toc_file = r"doc\reference\html\index.hhc" +bertos_toc = r"bertos-toc.hhc" + +if os.system("doxygen " + sys.argv[1]): + print "doxygen error" +if os.system(toc_modifier + " " + toc_file + " " + bertos_toc): + print "toc-modifier error" +move(bertos_toc, toc_file) + +# compile CHM +os.system(r"hhc doc\reference\html\index.hhp") + +chm_target = r"doc\bertos-doc.chm" +move(r"doc\reference\html\bertos-doc.chm", chm_target) + +