|
|
@ -250,7 +250,7 @@ def addAnchors(path):
|
|
|
|
f.write(line + "\n")
|
|
|
|
f.write(line + "\n")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def run_through_template(input, set_verbose):
|
|
|
|
def run_through_template(input, set_verbose, substitutions):
|
|
|
|
tmpfile = './tmp/output'
|
|
|
|
tmpfile = './tmp/output'
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
with open(tmpfile, 'w') as out:
|
|
|
|
with open(tmpfile, 'w') as out:
|
|
|
@ -260,6 +260,9 @@ def run_through_template(input, set_verbose):
|
|
|
|
"-o", "../scripts/tmp",
|
|
|
|
"-o", "../scripts/tmp",
|
|
|
|
"../scripts/"+input
|
|
|
|
"../scripts/"+input
|
|
|
|
]
|
|
|
|
]
|
|
|
|
|
|
|
|
for k, v in substitutions.items():
|
|
|
|
|
|
|
|
args.append("--substitution=%s=%s" % (k, v))
|
|
|
|
|
|
|
|
|
|
|
|
if set_verbose:
|
|
|
|
if set_verbose:
|
|
|
|
args.insert(2, "-v")
|
|
|
|
args.insert(2, "-v")
|
|
|
|
log("EXEC: %s" % " ".join(args))
|
|
|
|
log("EXEC: %s" % " ".join(args))
|
|
|
@ -392,7 +395,7 @@ def cleanup_env():
|
|
|
|
shutil.rmtree("./tmp")
|
|
|
|
shutil.rmtree("./tmp")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def main(requested_target_name, keep_intermediates):
|
|
|
|
def main(requested_target_name, keep_intermediates, substitutions):
|
|
|
|
prepare_env()
|
|
|
|
prepare_env()
|
|
|
|
log("Building spec [target=%s]" % requested_target_name)
|
|
|
|
log("Building spec [target=%s]" % requested_target_name)
|
|
|
|
|
|
|
|
|
|
|
@ -407,7 +410,7 @@ def main(requested_target_name, keep_intermediates):
|
|
|
|
|
|
|
|
|
|
|
|
target = get_build_target("../specification/targets.yaml", target_name)
|
|
|
|
target = get_build_target("../specification/targets.yaml", target_name)
|
|
|
|
build_spec(target=target, out_filename=templated_file)
|
|
|
|
build_spec(target=target, out_filename=templated_file)
|
|
|
|
run_through_template(templated_file, VERBOSE)
|
|
|
|
run_through_template(templated_file, VERBOSE, substitutions)
|
|
|
|
fix_relative_titles(
|
|
|
|
fix_relative_titles(
|
|
|
|
target=target, filename=templated_file,
|
|
|
|
target=target, filename=templated_file,
|
|
|
|
out_filename=rst_file,
|
|
|
|
out_filename=rst_file,
|
|
|
@ -417,13 +420,21 @@ def main(requested_target_name, keep_intermediates):
|
|
|
|
|
|
|
|
|
|
|
|
if requested_target_name == "all":
|
|
|
|
if requested_target_name == "all":
|
|
|
|
shutil.copy("../supporting-docs/howtos/client-server.rst", "tmp/howto.rst")
|
|
|
|
shutil.copy("../supporting-docs/howtos/client-server.rst", "tmp/howto.rst")
|
|
|
|
run_through_template("tmp/howto.rst", False) # too spammy to mark -v on this
|
|
|
|
run_through_template("tmp/howto.rst", False, substitutions) # too spammy to mark -v on this
|
|
|
|
rst2html("tmp/howto.rst", "gen/howtos.html")
|
|
|
|
rst2html("tmp/howto.rst", "gen/howtos.html")
|
|
|
|
|
|
|
|
|
|
|
|
if not keep_intermediates:
|
|
|
|
if not keep_intermediates:
|
|
|
|
cleanup_env()
|
|
|
|
cleanup_env()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def extract_major(s):
|
|
|
|
|
|
|
|
major_version = s
|
|
|
|
|
|
|
|
match = re.match("^(r\d)+(\.\d+)?$", s)
|
|
|
|
|
|
|
|
if match:
|
|
|
|
|
|
|
|
major_version = match.group(1)
|
|
|
|
|
|
|
|
return major_version
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
if __name__ == '__main__':
|
|
|
|
parser = ArgumentParser(
|
|
|
|
parser = ArgumentParser(
|
|
|
|
"gendoc.py - Generate the Matrix specification as HTML to the gen/ folder."
|
|
|
|
"gendoc.py - Generate the Matrix specification as HTML to the gen/ folder."
|
|
|
@ -441,9 +452,23 @@ if __name__ == '__main__':
|
|
|
|
"--verbose", "-v", action="store_true",
|
|
|
|
"--verbose", "-v", action="store_true",
|
|
|
|
help="Turn on verbose mode."
|
|
|
|
help="Turn on verbose mode."
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
parser.add_argument(
|
|
|
|
|
|
|
|
"--client_release", "-c", action="store", default="unstable",
|
|
|
|
|
|
|
|
help="The client-server release tag to generate, e.g. r1.2"
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
parser.add_argument(
|
|
|
|
|
|
|
|
"--server_release", "-s", action="store", default="unstable",
|
|
|
|
|
|
|
|
help="The server-server release tag to generate, e.g. r1.2"
|
|
|
|
|
|
|
|
)
|
|
|
|
args = parser.parse_args()
|
|
|
|
args = parser.parse_args()
|
|
|
|
if not args.target:
|
|
|
|
if not args.target:
|
|
|
|
parser.print_help()
|
|
|
|
parser.print_help()
|
|
|
|
sys.exit(1)
|
|
|
|
sys.exit(1)
|
|
|
|
VERBOSE = args.verbose
|
|
|
|
VERBOSE = args.verbose
|
|
|
|
main(args.target, args.nodelete)
|
|
|
|
substitutions = {
|
|
|
|
|
|
|
|
"%CLIENT_RELEASE_LABEL%": args.client_release,
|
|
|
|
|
|
|
|
"%CLIENT_MAJOR_VERSION%": extract_major(args.client_release),
|
|
|
|
|
|
|
|
"%SERVER_RELEASE_LABEL%": args.server_release,
|
|
|
|
|
|
|
|
"%SERVER_MAJOR_VERSION%": extract_major(args.server_release),
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
main(args.target, args.nodelete, substitutions)
|
|
|
|