summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMats Wichmann <mats@linux.com>2021-03-27 16:40:14 (GMT)
committerMats Wichmann <mats@linux.com>2021-03-28 13:32:13 (GMT)
commit833d487a79ba53e71640fd122b9470f50e8bef34 (patch)
tree49a20f58e15e482314e47855e23c337b9eebf78f
parent693dd796c0a155e9c63412cc944bea3e336d726d (diff)
downloadSCons-833d487a79ba53e71640fd122b9470f50e8bef34.zip
SCons-833d487a79ba53e71640fd122b9470f50e8bef34.tar.gz
SCons-833d487a79ba53e71640fd122b9470f50e8bef34.tar.bz2
Stop stripping INSTALLSTR
The install module now calls the substitution routine with a raw argument. Fixes issue 2018 Signed-off-by: Mats Wichmann <mats@linux.com>
-rwxr-xr-xCHANGES.txt1
-rw-r--r--SCons/Tool/install.py9
-rw-r--r--test/Install/INSTALLSTR.py6
3 files changed, 12 insertions, 4 deletions
diff --git a/CHANGES.txt b/CHANGES.txt
index 31b3fb1..cc98000 100755
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -45,6 +45,7 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER
- Remove long-deprecated construction variables PDFCOM, WIN32_INSERT_DEF,
WIN32DEFPREFIX, WIN32DEFSUFFIX, WIN32EXPPREFIX, WIN32EXPSUFFIX.
All have been replaced by other names since at least 1.0.
+ - Don't strip spaces in INSTALLSTR by using raw subst (issue 2018)
From Dillan Mills:
- Add support for the (TARGET,SOURCE,TARGETS,SOURCES,CHANGED_TARGETS,CHANGED_SOURCES}.relpath property.
diff --git a/SCons/Tool/install.py b/SCons/Tool/install.py
index e79203e..d73d678 100644
--- a/SCons/Tool/install.py
+++ b/SCons/Tool/install.py
@@ -35,8 +35,13 @@ from shutil import copy2, copymode, copystat
import SCons.Action
import SCons.Tool
-from SCons.Tool.linkCommon import StringizeLibSymlinks, CreateLibSymlinks, EmitLibSymlinks
import SCons.Util
+from SCons.Subst import SUBST_RAW
+from SCons.Tool.linkCommon import (
+ StringizeLibSymlinks,
+ CreateLibSymlinks,
+ EmitLibSymlinks,
+)
#
# We keep track of *all* installed files.
@@ -257,7 +262,7 @@ def installFuncVersionedLib(target, source, env):
def stringFunc(target, source, env):
installstr = env.get('INSTALLSTR')
if installstr:
- return env.subst_target_source(installstr, 0, target, source)
+ return env.subst_target_source(installstr, SUBST_RAW, target, source)
target = str(target[0])
source = str(source[0])
if os.path.isdir(source):
diff --git a/test/Install/INSTALLSTR.py b/test/Install/INSTALLSTR.py
index 145b81d..ace04f4 100644
--- a/test/Install/INSTALLSTR.py
+++ b/test/Install/INSTALLSTR.py
@@ -36,16 +36,18 @@ test = TestSCons.TestSCons()
test.subdir('install')
+# Check that spaces aren't stripped in INSTALLSTR by using
+# extra whitespace in the string (issue 2018)
test.write('SConstruct', """\
DefaultEnvironment(tools=[])
-env = Environment(tools=[], INSTALLSTR = 'INSTALL $SOURCE => $TARGET!')
+env = Environment(tools=[], INSTALLSTR='INSTALL $SOURCE => $TARGET!')
env.Install('install', 'file')
""")
test.write('file', "file\n")
test.run(stdout=test.wrap_stdout("""\
-INSTALL file => %s!
+INSTALL file => %s!
""") % os.path.join('install', 'file'))
test.must_match(['install', 'file'], "file\n")