diff options
Diffstat (limited to 'lib/spack/spack/cmd/common/arguments.py')
-rw-r--r-- | lib/spack/spack/cmd/common/arguments.py | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/lib/spack/spack/cmd/common/arguments.py b/lib/spack/spack/cmd/common/arguments.py index e49d893485..8302a43754 100644 --- a/lib/spack/spack/cmd/common/arguments.py +++ b/lib/spack/spack/cmd/common/arguments.py @@ -6,6 +6,7 @@ import argparse import os.path +import textwrap from llnl.util.lang import stable_partition @@ -415,6 +416,40 @@ the build yourself. Format: %%Y%%m%%d-%%H%%M-[cdash-track]""" cdash_subgroup.add_argument("--cdash-buildstamp", default=None, help=cdash_help["buildstamp"]) +def print_cdash_help(): + parser = argparse.ArgumentParser( + formatter_class=argparse.RawDescriptionHelpFormatter, + epilog=textwrap.dedent( + """\ +environment variables: +SPACK_CDASH_AUTH_TOKEN + authentication token to present to CDash + """ + ), + ) + add_cdash_args(parser, True) + parser.print_help() + + +def sanitize_reporter_options(namespace: argparse.Namespace): + """Sanitize options that affect generation and configuration of reports, like + CDash or JUnit. + + Args: + namespace: options parsed from cli + """ + has_any_cdash_option = ( + namespace.cdash_upload_url or namespace.cdash_build or namespace.cdash_site + ) + if namespace.log_format == "junit" and has_any_cdash_option: + raise argparse.ArgumentTypeError("cannot pass any cdash option when --log-format=junit") + + # If any CDash option is passed, assume --log-format=cdash is implied + if namespace.log_format is None and has_any_cdash_option: + namespace.log_format = "cdash" + namespace.reporter = _cdash_reporter(namespace) + + class ConfigSetAction(argparse.Action): """Generic action for setting spack config options from CLI. |