summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam Deegan <bill@baddogconsulting.com>2020-02-21 02:59:06 (GMT)
committerGitHub <noreply@github.com>2020-02-21 02:59:06 (GMT)
commit731b4bbca9ec4f1f80e3a27e1cc428ad3721e46f (patch)
tree8ff45f6557761716a2ebb3d648479453dcf80a26
parent962736590a7367450460a594ef2cd3f594fe72ec (diff)
parent431a6523f9895c2bad2c0ad315c8bc77c0a96bbb (diff)
downloadSCons-731b4bbca9ec4f1f80e3a27e1cc428ad3721e46f.zip
SCons-731b4bbca9ec4f1f80e3a27e1cc428ad3721e46f.tar.gz
SCons-731b4bbca9ec4f1f80e3a27e1cc428ad3721e46f.tar.bz2
Merge pull request #3556 from mwichmann/substfilesuffix
Change errant TEXTFILESUFFIX to SUBSTFILESUFFIX
-rwxr-xr-xsrc/CHANGES.txt1
-rw-r--r--src/engine/SCons/Tool/textfile.py2
-rw-r--r--test/textfile/fixture/SConstruct.issue-354023
-rw-r--r--test/textfile/fixture/SConstruct.issue-35504
-rw-r--r--test/textfile/fixture/substfile.in (renamed from test/textfile/fixture/foo-3550.in)0
-rw-r--r--test/textfile/issue-3540.py48
-rw-r--r--test/textfile/issue-3550.py12
7 files changed, 84 insertions, 6 deletions
diff --git a/src/CHANGES.txt b/src/CHANGES.txt
index 025e046..574f64b 100755
--- a/src/CHANGES.txt
+++ b/src/CHANGES.txt
@@ -74,6 +74,7 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER
- Add an alternate warning message cl.exe is not found and msvc config
cache is in use (SCONS_CACHE_MSVC_CONFIG was given) - config cache
may be out of date.
+ - Fixed bug where changing TEXTFILESUFFIX would cause Substfile() to rebuild. (Github Issue #3540)
- Script/Main.py now uses importlib instead of imp module.
diff --git a/src/engine/SCons/Tool/textfile.py b/src/engine/SCons/Tool/textfile.py
index c233658..b404304 100644
--- a/src/engine/SCons/Tool/textfile.py
+++ b/src/engine/SCons/Tool/textfile.py
@@ -171,7 +171,7 @@ _text_builder = SCons.Builder.Builder(
suffix='$TEXTFILESUFFIX',
)
-_subst_varlist = _common_varlist + ['SUBSTFILEPREFIX', 'TEXTFILESUFFIX']
+_subst_varlist = _common_varlist + ['SUBSTFILEPREFIX', 'SUBSTFILESUFFIX']
_subst_builder = SCons.Builder.Builder(
action=SCons.Action.Action(_action, _strfunc, varlist=_subst_varlist),
source_factory=SCons.Node.FS.File,
diff --git a/test/textfile/fixture/SConstruct.issue-3540 b/test/textfile/fixture/SConstruct.issue-3540
new file mode 100644
index 0000000..021689a
--- /dev/null
+++ b/test/textfile/fixture/SConstruct.issue-3540
@@ -0,0 +1,23 @@
+"""
+Test for GH Issue 3540
+
+textfile()'s action is not sensitive to changes in TEXTFILESUFFIX (rather was sensitive to SUBSTFILESUFFIX)
+
+"""
+
+DefaultEnvironment(tools=[])
+
+text_file_suffix = ARGUMENTS.get('text_file_suffix', 'DEFAULTSUFFIX')
+
+env = Environment(tools=['textfile'],
+ TEXTFILESUFFIX=text_file_suffix)
+
+env['FOO_PATH'] = "test-value-1"
+
+foo = env.Substfile(
+ target="substfile",
+ source="substfile.in",
+ SUBST_DICT={
+ "@foo_path@": "$FOO_PATH",
+ }
+)
diff --git a/test/textfile/fixture/SConstruct.issue-3550 b/test/textfile/fixture/SConstruct.issue-3550
index 8502717..0239ade 100644
--- a/test/textfile/fixture/SConstruct.issue-3550
+++ b/test/textfile/fixture/SConstruct.issue-3550
@@ -4,8 +4,8 @@ env = Environment(tools=['textfile'])
env['FOO_PATH'] = r'Z:\mongo\build\install\bin'
foo = env.Substfile(
- target="foo",
- source="foo-3550.in",
+ target="substfile",
+ source="substfile.in",
SUBST_DICT={
"@foo_path@": "$FOO_PATH",
}
diff --git a/test/textfile/fixture/foo-3550.in b/test/textfile/fixture/substfile.in
index c806a04..c806a04 100644
--- a/test/textfile/fixture/foo-3550.in
+++ b/test/textfile/fixture/substfile.in
diff --git a/test/textfile/issue-3540.py b/test/textfile/issue-3540.py
new file mode 100644
index 0000000..b53f06a
--- /dev/null
+++ b/test/textfile/issue-3540.py
@@ -0,0 +1,48 @@
+#!/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__"
+"""
+Test for GH Issue 3540
+
+textfile()'s action is not sensitive to changes in TEXTFILEPREFIX (rather was sensitive to SUBSTFILEPREFIX)
+
+"""
+
+import TestSCons
+
+test = TestSCons.TestSCons()
+
+# test.verbose_set(1)
+
+test.file_fixture('fixture/substfile.in', 'substfile.in')
+test.file_fixture('fixture/SConstruct.issue-3540', 'SConstruct')
+
+test.run()
+test.must_exist('substfile')
+
+test.up_to_date(options='text_file_suffix=BLAH')
+
+
+test.pass_test()
diff --git a/test/textfile/issue-3550.py b/test/textfile/issue-3550.py
index 60430ed..5951d1b 100644
--- a/test/textfile/issue-3550.py
+++ b/test/textfile/issue-3550.py
@@ -23,21 +23,27 @@
#
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+"""
+Test for GH Issue 3550
+
+ You can't pass a Windows path in a value to be interpolated,
+ because SCons will try to pass it through re.sub which rejects certain character sequences.
+"""
import TestSCons
test = TestSCons.TestSCons()
-test.verbose_set(1)
+# test.verbose_set(1)
match_mode = 'r'
test.file_fixture('fixture/SConstruct.issue-3550', 'SConstruct')
-test.file_fixture('fixture/foo-3550.in', 'foo-3550.in')
+test.file_fixture('fixture/substfile.in', 'substfile.in')
test.run(arguments='.')
-test.must_match('foo',
+test.must_match('substfile',
r'''foo_path: Z:\mongo\build\install\bin
''', mode=match_mode)