diff options
author | William Deegan <bill@baddogconsulting.com> | 2021-09-19 01:59:34 (GMT) |
---|---|---|
committer | William Deegan <bill@baddogconsulting.com> | 2021-09-19 01:59:45 (GMT) |
commit | 98f40ebf2d5eebab488b286f313112cac9eb5141 (patch) | |
tree | 54b14403f4e2548e055f6d1097f22599614a19f2 | |
parent | b4d4449b3890121502758d503aacac1c5f138065 (diff) | |
download | SCons-98f40ebf2d5eebab488b286f313112cac9eb5141.zip SCons-98f40ebf2d5eebab488b286f313112cac9eb5141.tar.gz SCons-98f40ebf2d5eebab488b286f313112cac9eb5141.tar.bz2 |
Fix Issue #4021 - Textfile wrongly replacing '$$(' with '$' '
-rwxr-xr-x | CHANGES.txt | 2 | ||||
-rwxr-xr-x | RELEASE.txt | 6 | ||||
-rw-r--r-- | SCons/Tool/textfile.py | 14 | ||||
-rw-r--r-- | test/textfile/fixture/SConstruct | 5 | ||||
-rw-r--r-- | test/textfile/textfile.py | 11 |
5 files changed, 22 insertions, 16 deletions
diff --git a/CHANGES.txt b/CHANGES.txt index 6ac5519..23c7412 100755 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -12,6 +12,8 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER From William Deegan: - Fix reproducible builds. Restore logic respecting SOURCE_DATE_EPOCH when set. - Fix version tests to work with updated scons --version output. (Date format changed) + - Fix issue #4021. Change the way subst() is used in Textfile() to not evaluate '$$(' -> '$', + but instead it should yield '$(' instead. From Daniel Moody: - Fix ninja tool to never use for_sig substitution because ninja does not use signatures. This diff --git a/RELEASE.txt b/RELEASE.txt index faa017f..6cccb40 100755 --- a/RELEASE.txt +++ b/RELEASE.txt @@ -1,10 +1,10 @@ -A new SCons release, 4.1.0, is now available +A new SCons release, 4.2.0, is now available on the SCons download page: https://scons.org/pages/download.html -Here is a summary of the changes since 4.1.0: +Here is a summary of the changes since 4.2.0: NEW FUNCTIONALITY ----------------- @@ -31,6 +31,8 @@ FIXES Code contributed by MongoDB. - Fix ninja tool to never use for_sig substitution because ninja does not use signatures. This issue affected CommandGeneratorAction function actions specifically. +- Fix issue #4021. Change the way subst() is used in Textfile() to not evaluate '$$(' -> '$', + but instead it should yield '$(' instead. IMPROVEMENTS ------------ diff --git a/SCons/Tool/textfile.py b/SCons/Tool/textfile.py index c1b597f..7fdc8b7 100644 --- a/SCons/Tool/textfile.py +++ b/SCons/Tool/textfile.py @@ -1,6 +1,6 @@ -# -*- python -*- +# MIT License # -# __COPYRIGHT__ +# Copyright The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the @@ -20,9 +20,8 @@ # 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. -# -__doc__ = """ +""" Textfile/Substfile builder for SCons. Create file 'target' which typically is a textfile. The 'source' @@ -44,8 +43,6 @@ Textfile/Substfile builder for SCons. is unpredictable whether the expansion will occur. """ -__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" - import SCons @@ -58,6 +55,7 @@ TEXTFILE_FILE_WRITE_MODE = 'w' LINESEP = '\n' + def _do_subst(node, subs): """ Fetch the node contents and replace all instances of the keys with @@ -86,7 +84,7 @@ def _action(target, source, env): # prepare the line separator linesep = env['LINESEPARATOR'] if linesep is None: - linesep = LINESEP # os.linesep + linesep = LINESEP # os.linesep elif is_String(linesep): pass elif isinstance(linesep, Value): @@ -114,7 +112,7 @@ def _action(target, source, env): if callable(value): value = value() if is_String(value): - value = env.subst(value) + value = env.subst(value, raw=1) else: value = str(value) subs.append((k, value)) diff --git a/test/textfile/fixture/SConstruct b/test/textfile/fixture/SConstruct index 8cfe909..60e7225 100644 --- a/test/textfile/fixture/SConstruct +++ b/test/textfile/fixture/SConstruct @@ -1,6 +1,5 @@ DefaultEnvironment(tools=[]) - env = Environment(tools=['textfile']) data0 = ['Goethe', 'Schiller'] data = ['lalala', 42, data0, 'tanteratei'] @@ -10,6 +9,10 @@ env.Textfile('foo2', data, LINESEPARATOR='|*') env.Textfile('foo1a.txt', data + ['']) env.Textfile('foo2a.txt', data + [''], LINESEPARATOR='|*') +issue_4021_textfile = r'<HintPath>..\..\..\@HINT_PATH@\Datalogics.PDFL.dll</HintPath>' +env.Textfile('issue-4021.txt', issue_4021_textfile, + SUBST_DICT={'@HINT_PATH@': r'NETCore\bin\$$(Platform)\$$(Configuration)'}) + # recreate the list with the data wrapped in Value() data0 = list(map(Value, data0)) data = list(map(Value, data)) diff --git a/test/textfile/textfile.py b/test/textfile/textfile.py index 0f2e18e..936eaf5 100644 --- a/test/textfile/textfile.py +++ b/test/textfile/textfile.py @@ -1,6 +1,7 @@ #!/usr/bin/env python +# MIT License # -# __COPYRIGHT__ +# Copyright The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the @@ -20,9 +21,6 @@ # 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__" import TestSCons @@ -30,7 +28,7 @@ import os test = TestSCons.TestSCons() -foo1 = test.workpath('foo1.txt') +# foo1 = test.workpath('foo1.txt') # foo2 = test.workpath('foo2.txt') # foo1a = test.workpath('foo1a.txt') # foo2a = test.workpath('foo2a.txt') @@ -51,6 +49,8 @@ foo2Text = '|*'.join(textparts) foo1aText = foo1Text + linesep foo2aText = foo2Text + '|*' +issue_4021_text = r'<HintPath>..\..\..\NETCore\bin\$(Platform)\$(Configuration)\Datalogics.PDFL.dll</HintPath>' + test.up_to_date(arguments='.') files = list(map(test.workpath, ( @@ -81,6 +81,7 @@ test.must_match('foo1a.txt', foo1aText, mode=match_mode) test.must_match('bar1a.txt', foo1aText, mode=match_mode) test.must_match('foo2a.txt', foo2aText, mode=match_mode) test.must_match('bar2a.txt', foo2aText, mode=match_mode) +test.must_match('issue-4021.txt', issue_4021_text, mode=match_mode) check_times() # write the contents and make sure the files |