[master] ba519f4 Make RST output directory configurable as well.

Lasse Karstensen lkarsten at varnish-software.com
Thu Mar 3 14:36:25 CET 2016


commit ba519f4d6a1550f84d1009a98cb3802ca5430964
Author: Lasse Karstensen <lkarsten at varnish-software.com>
Date:   Thu Mar 3 14:21:59 2016 +0100

    Make RST output directory configurable as well.
    
    Avoid some of the mess in src/ when building multiple vmods
    in the same git tree.

diff --git a/lib/libvcc/vmodtool.py b/lib/libvcc/vmodtool.py
index 0851871..c85506e 100755
--- a/lib/libvcc/vmodtool.py
+++ b/lib/libvcc/vmodtool.py
@@ -849,7 +849,7 @@ class SimpleTestCase(unittest.TestCase):
 
 
 #######################################################################
-def runmain(inputvcc, outputprefix="vcc_if"):
+def runmain(inputvcc, rstdir, outputprefix="vcc_if"):
 	# Read the file in
 	lines = []
 	with open(inputvcc, "r") as fp:
@@ -939,7 +939,7 @@ def runmain(inputvcc, outputprefix="vcc_if"):
 	fh.close()
 
 	for suf in ("", ".man"):
-		fp = open("vmod_%s%s.rst" % (vx[0].nam, suf), "w")
+		fp = open(join(rstdir, "vmod_%s%s.rst" % (vx[0].nam, suf)), "w")
 		write_rst_file_warning(fp)
 
 		vx[0].doc_dump(fp, suf)
@@ -962,6 +962,8 @@ if __name__ == "__main__":
 	    help="Be strict when parsing input file. (vmod.vcc)")
 	oparser.add_option('-o', metavar="prefix", default='vcc_if',
 	    help='Output file prefix. (default: "vcc_if")')
+	oparser.add_option('-w', '--rstdir', metavar="directory", default='.',
+	    help='Where to save generated RST files. (default: ".")')
 	oparser.add_option('', '--runtests', action='store_true', default=False,
 	    dest="runtests", help=optparse.SUPPRESS_HELP)
 	(opts, args) = oparser.parse_args()
@@ -984,4 +986,4 @@ if __name__ == "__main__":
 		oparser.print_help()
 		exit(-1)
 
-	runmain(i_vcc, outputprefix=opts.o)
+	runmain(i_vcc, opts.rstdir, outputprefix=opts.o)



More information about the varnish-commit mailing list