diff options
author | William Deegan <bill@baddogconsulting.com> | 2019-10-08 14:00:07 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-10-08 14:00:07 (GMT) |
commit | 0ad7620c6451cb3fa0ca2ac091131f21701be9b5 (patch) | |
tree | a34d8ba5c57dc97eb9e4e9b11a8507fcf20ff329 | |
parent | b161cf3f51e376a82208081e3f83dd96e2a4d6bf (diff) | |
parent | 43cebd68db3696a4a7fdd2d38a81842d18d6d2cd (diff) | |
download | SCons-0ad7620c6451cb3fa0ca2ac091131f21701be9b5.zip SCons-0ad7620c6451cb3fa0ca2ac091131f21701be9b5.tar.gz SCons-0ad7620c6451cb3fa0ca2ac091131f21701be9b5.tar.bz2 |
Merge pull request #3434 from mwichmann/CmdStringHolder
[WIP] CmdStringHolder should not fail in Subst
-rwxr-xr-x | src/CHANGES.txt | 1 | ||||
-rw-r--r-- | src/engine/SCons/Subst.py | 2 | ||||
-rw-r--r-- | test/Subst/bug3428.py | 55 |
3 files changed, 57 insertions, 1 deletions
diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 015622e..0a30bfa 100755 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -15,6 +15,7 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER From Mats Wichmann - Replace instances of string find method with "in" checks where the index from find() was not used. + - CmdStringHolder fix from issue #3428 - Turn previously deprecated debug options into failures: --debug=tree, --debug=dtree, --debug=stree, --debug=nomemoizer. diff --git a/src/engine/SCons/Subst.py b/src/engine/SCons/Subst.py index 6f62198..2de64c5 100644 --- a/src/engine/SCons/Subst.py +++ b/src/engine/SCons/Subst.py @@ -409,7 +409,7 @@ def scons_subst(strSubst, env, mode=SUBST_RAW, target=None, source=None, gvars={ handles separating command lines into lists of arguments, so see that function if that's what you're looking for. """ - if isinstance(strSubst, str) and strSubst.find('$') < 0: + if (isinstance(strSubst, str) and '$' not in strSubst) or isinstance(strSubst, CmdStringHolder): return strSubst class StringSubber(object): diff --git a/test/Subst/bug3428.py b/test/Subst/bug3428.py new file mode 100644 index 0000000..00587e6 --- /dev/null +++ b/test/Subst/bug3428.py @@ -0,0 +1,55 @@ +#!/usr/bin/env python +# +# __COPYRIGHT__ +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# + +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + +""" +Verify that CmdStringHolder doesn't trip in Subst on doing +a string-only operation that does not work on UserString class. +Issue: https://github.com/SCons/scons/issues/3428 +""" + +import TestSCons + +test = TestSCons.TestSCons(match = TestSCons.match_re_dotall) + + +test.write('SConstruct', """\ +env = Environment() +env.Append(LIBPATH=["path1/sub1","path1/sub2"]) +lst = env.Flatten(env.subst_list("$LIBPATH")) +for i in lst: + env.Dir(i) +""") + +test.run(status=0) + + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: |