gendoc: Allow multiple targets

pull/977/head
Richard van der Hoff 9 years ago
parent a482cda8a8
commit a8eed29e9f

@ -393,14 +393,14 @@ def cleanup_env():
shutil.rmtree("./tmp") shutil.rmtree("./tmp")
def main(requested_target_name, keep_intermediates, substitutions): def main(targets, keep_intermediates, substitutions):
prepare_env() prepare_env()
log("Building spec [target=%s]" % requested_target_name)
targets = [requested_target_name] if targets == ["all"]:
if requested_target_name == "all":
targets = get_build_targets("../specification/targets.yaml") + ["howtos"] targets = get_build_targets("../specification/targets.yaml") + ["howtos"]
log("Building spec [target=%s]" % targets)
templated_files = [] templated_files = []
for target_name in targets: for target_name in targets:
templated_file = "tmp/templated_%s.rst" % (target_name,) templated_file = "tmp/templated_%s.rst" % (target_name,)
@ -448,7 +448,7 @@ if __name__ == '__main__':
help="Do not delete intermediate files. They will be found in tmp/" help="Do not delete intermediate files. They will be found in tmp/"
) )
parser.add_argument( parser.add_argument(
"--target", "-t", default="all", "--target", "-t", action="append",
help="Specify the build target to build from specification/targets.yaml. " + help="Specify the build target to build from specification/targets.yaml. " +
"The value 'all' will build all of the targets therein." "The value 'all' will build all of the targets therein."
) )
@ -465,9 +465,6 @@ if __name__ == '__main__':
help="The server-server release tag to generate, e.g. r1.2" help="The server-server release tag to generate, e.g. r1.2"
) )
args = parser.parse_args() args = parser.parse_args()
if not args.target:
parser.print_help()
sys.exit(1)
VERBOSE = args.verbose VERBOSE = args.verbose
substitutions = { substitutions = {
"%CLIENT_RELEASE_LABEL%": args.client_release, "%CLIENT_RELEASE_LABEL%": args.client_release,
@ -475,4 +472,4 @@ if __name__ == '__main__':
"%SERVER_RELEASE_LABEL%": args.server_release, "%SERVER_RELEASE_LABEL%": args.server_release,
"%SERVER_MAJOR_VERSION%": extract_major(args.server_release), "%SERVER_MAJOR_VERSION%": extract_major(args.server_release),
} }
main(args.target, args.nodelete, substitutions) main(args.target or ["all"], args.nodelete, substitutions)

Loading…
Cancel
Save