From 6f94c86e5ef250ef76474221fca17e24e12e14f9 Mon Sep 17 00:00:00 2001 From: William Deegan Date: Wed, 17 Aug 2022 11:17:12 -0700 Subject: doc and docstring updates --- SCons/Script/Main.py | 11 +++++------ SCons/Script/Main.xml | 2 +- SCons/Script/SConsOptions.py | 11 +++++------ 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/SCons/Script/Main.py b/SCons/Script/Main.py index 442ee56..1b06a64 100644 --- a/SCons/Script/Main.py +++ b/SCons/Script/Main.py @@ -493,7 +493,7 @@ def SetOption(name, value): return OptionsParser.values.set_option(name, value) -def ValidateOptions(throw_exception=False): +def ValidateOptions(throw_exception=False) -> None: """Validate options passed to SCons on the command line. If you call this after you set all your command line options with AddOption(), @@ -501,12 +501,11 @@ def ValidateOptions(throw_exception=False): So if you added an option --xyz and you call SCons with --xyy you can cause SCons to issue an error message and exit by calling this function. - args: - throw_exception (bool): Should this function raise an error if there's an - invalid option, or issue a message and exit with error status. + :param bool throw_exception: (Optional) Should this function raise an error if there's an invalid option on the command line, or issue a message and exit with error status. - Raises: - SConsBadOptionError + :raises SConsBadOptionError: If throw_exception is True and there are invalid options on command line. + + .. versionadded:: 4.4.1 """ OptionsParser.raise_exception_on_error = throw_exception diff --git a/SCons/Script/Main.xml b/SCons/Script/Main.xml index ec09d35..cd4cc1a 100644 --- a/SCons/Script/Main.xml +++ b/SCons/Script/Main.xml @@ -988,7 +988,7 @@ except SConsBadOptionError as e: print("Message is :%s" % e.opt_str) Exit(3) - + This function is useful to force SCons to fail fast before you execute any expensive logic later in your build logic. diff --git a/SCons/Script/SConsOptions.py b/SCons/Script/SConsOptions.py index aab8c7e..f3b4708 100644 --- a/SCons/Script/SConsOptions.py +++ b/SCons/Script/SConsOptions.py @@ -290,12 +290,11 @@ class SConsOptionGroup(optparse.OptionGroup): class SConsBadOptionError(optparse.BadOptionError): - """ - Instance attributes: - opt_str : str - The offending option specified on command line which is not recognized - parser : OptionParser - the active argument parser + """Exception used to indicate that invalid command line options were specified + + :ivar str opt_str: The offending option specified on command line which is not recognized + :ivar OptionParser parser: The active argument parser + """ def __init__(self, opt_str, parser=None): -- cgit v0.12