-
-
Notifications
You must be signed in to change notification settings - Fork 316
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ability for SConscript to fail on missing script #3154
Conversation
SConscript call now takes an optional must_exist flag, which defaults to False for compatiility with current behavior. If True, an exception is raised if the file is missing. To improve readability, the decision is moved off to a new function rather than being inline in _SConscript. A global setting to control the overall behavior is also added. A deprecation warning is added for the current behavior, which is printed only once. Signed-off-by: Mats Wichmann <mats@linux.com>
If you can add some tests for this change I think we'll be able to merge it. |
Testcases added to confirm the behavior of: first attempt to call a non-existent script gives a deprecation warning, additional ones give plain warning; True/False values for must_warn behave as expected; if scons default is changed to exception the call fails but if must_warn=False it still works. Tweaked the logic to actually get that last bit to work. Also minor doc update. Signed-off-by: Mats Wichmann <mats@linux.com>
Re: adding |
Every time I update a function or a method, I've been adding proper docstrings (describe arguments and return values). So that's what I'm requesting you do if possible. The idea is to make the API docs more useful over time. |
I understand now. I'll see about this... SConscript is fairly rich interface so it's not trivial. Can scons help with an arg spit out the docsrting for that method/builder? |
You might try using file fixture for your test's SConstruct |
Signed-off-by: Mats Wichmann <mats@linux.com>
Made an effort at a docstring. This is in the google style, which as I recall doesn't fully work with the current obsolete doc builder (see #3121 for that issue). I can recast it in reST style if preferred, although I never seem to get those to work right. |
I could redo this as a file fixture, but it's not really that complicated. New to these tests, not sure if it's better to try to write it as multiple distinct test cases, or an all-in-one like this effort did. The test is running and passing, even though the Travis CI builds are not overall passing, did not examine those yet. Py2.7:
Py3.6:
|
The test is fine as is. The Docstring is great! Thanks for all the effort here. |
oh. Hold up. Your new test and one other are failing on travis ci. |
okay, two tests expected the existing warning string, and are unhappy that the first-time message is the deprecation warning with different text. I can update those two to expect the new message - is that ok? Can also get rid of the deprecation message... |
Sure. |
There was actually a subtle problem as well as wrong string... the addition/use of the DeprecatedMissingSConscriptWarning class broke the command-line option to turn off warnings on missing sconscripts. |
Signed-off-by: Mats Wichmann <mats@linux.com>
Also handle_missing_SConscript(), internal interface added by this patch series. Signed-off-by: Mats Wichmann <mats@linux.com>
Minor edit to resolve conflict on CHANGES.txt. Merging! Thanks for the good work! |
oh. I'll wait for regressions to complete and the merge. |
SConscript call now takes an optional must_exist flag, which defaults
to False for compatiility with current behavior. If True, an exception
is raised if the file is missing. To improve readability, the
decision is moved off to a new function rather than being inline in
_SConscript.
A global setting to control the overall behavior is also added.
A deprecation warning is added for the current behavior, which is
printed only once.
A test case is now available.
Fixes #3162
Contributor Checklist:
master/src/CHANGES.txt
directory (and read theREADME.txt
in that directory)