Skip to content

Commit

Permalink
build: do not print the default value of --c++-standard in help output
Browse files Browse the repository at this point in the history
before this change, the output of `./configure.py --help` looks like:
```
  --c++-standard CPP_STANDARD
                        C++ standard to build with [default: ]
```

because the default value of `--c++-standard` option is an empty string.
printing out its value is not helpful, and could be confusing.

as the actual default value of this option varies depending on the
used compiler, so even if we print out the deduced C++ standard,
it is still confusing. not to mention that argparse does not
differentiate the defaulted value in the returned namespace from
`parse_args()` from the user specified one. so, a simpler approach
is just do not specify the default value.

in this change, we

* do not specify the default value for `--c++-standard`, so its
  value would be `None` if not specified
* do not print its default value in the `--help` output

Signed-off-by: Kefu Chai <[email protected]>
  • Loading branch information
tchaikov authored and avikivity committed Sep 25, 2024
1 parent cd7f3b8 commit 3b85633
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def standard_supported(standard, compiler='g++'):
arg_parser.add_argument('--ccache', nargs='?', const='ccache', default='', metavar='CCACHE_BINARY_PATH',
help='Use ccache to cache compilation (and optionally provide a path to ccache binary)')
arg_parser.add_argument('--c++-standard', action='store', dest='cpp_standard', default='',
help='C++ standard to build with [default: %(default)s]')
help='C++ standard to build with')
arg_parser.add_argument('--cook', action='append', dest='cook', default=[],
help='Supply this dependency locally for development via `cmake-cooking` (can be repeated)')
arg_parser.add_argument('--verbose', dest='verbose', action='store_true', help='Make configure output more verbose.')
Expand Down Expand Up @@ -159,7 +159,7 @@ def identify_best_standard(cpp_standards, compiler):
raise Exception(f"{compiler} does not seem to support any of Seastar's preferred C++ standards - {cpp_standards}. Please upgrade your compiler.")


if args.cpp_standard == '':
if not args.cpp_standard:
cpp_standards = ['23', '20']
args.cpp_standard = identify_best_standard(cpp_standards, compiler=args.cxx)

Expand Down

0 comments on commit 3b85633

Please sign in to comment.