diff options
author | William Deegan <bill@baddogconsulting.com> | 2021-07-12 20:56:55 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-12 20:56:55 (GMT) |
commit | 6d6617770514971b8ef3dccc8c3588779494c334 (patch) | |
tree | 137af1fe493070426eb6b087d6f39d3ea76ca72a /SCons | |
parent | cfbb83a3729bf757a1f711107481eb2e6004e63d (diff) | |
parent | 85435d13de7c2b896ba2623bf52479aa3c388cd6 (diff) | |
download | SCons-6d6617770514971b8ef3dccc8c3588779494c334.zip SCons-6d6617770514971b8ef3dccc8c3588779494c334.tar.gz SCons-6d6617770514971b8ef3dccc8c3588779494c334.tar.bz2 |
Merge pull request #3959 from mwichmann/nowarn-missing-sconscript
Change warnings behavior of missing SConscript
Diffstat (limited to 'SCons')
-rw-r--r-- | SCons/Script/SConscript.py | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/SCons/Script/SConscript.py b/SCons/Script/SConscript.py index 596fca0..6188151 100644 --- a/SCons/Script/SConscript.py +++ b/SCons/Script/SConscript.py @@ -148,31 +148,37 @@ stack_bottom = '% Stack boTTom %' # hard to define a variable w/this name :) def handle_missing_SConscript(f, must_exist=None): """Take appropriate action on missing file in SConscript() call. - Print a warning or raise an exception on missing file. + Print a warning or raise an exception on missing file, unless + missing is explicitly allowed by the *must_exist* value. On first warning, print a deprecation message. Args: f (str): path of missing configuration file - must_exist (bool): raise exception if file does not exist + must_exist (bool): if true, fail. If false, but not ``None``, + allow the file to be missing. The default is ``None``, + which means issue the warning. The default is deprecated. Raises: - UserError if 'must_exist' is True or if global - SCons.Script._no_missing_sconscript is True. + UserError: if *must_exist* is true or if global + :data:`SCons.Script._no_missing_sconscript` is true. """ if must_exist or (SCons.Script._no_missing_sconscript and must_exist is not False): msg = "Fatal: missing SConscript '%s'" % f.get_internal_path() raise SCons.Errors.UserError(msg) - if SCons.Script._warn_missing_sconscript_deprecated and must_exist is None: - msg = "Calling missing SConscript without error is deprecated.\n" + \ - "Transition by adding must_exist=0 to SConscript calls.\n" + \ - "Missing SConscript '%s'" % f.get_internal_path() - SCons.Warnings.warn(SCons.Warnings.MissingSConscriptWarning, msg) - SCons.Script._warn_missing_sconscript_deprecated = False - else: - msg = "Ignoring missing SConscript '%s'" % f.get_internal_path() - SCons.Warnings.warn(SCons.Warnings.MissingSConscriptWarning, msg) + if must_exist is None: + if SCons.Script._warn_missing_sconscript_deprecated: + msg = ( + "Calling missing SConscript without error is deprecated.\n" + "Transition by adding must_exist=False to SConscript calls.\n" + "Missing SConscript '%s'" % f.get_internal_path() + ) + SCons.Warnings.warn(SCons.Warnings.MissingSConscriptWarning, msg) + SCons.Script._warn_missing_sconscript_deprecated = False + else: + msg = "Ignoring missing SConscript '%s'" % f.get_internal_path() + SCons.Warnings.warn(SCons.Warnings.MissingSConscriptWarning, msg) def _SConscript(fs, *files, **kw): top = fs.Top |