summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2002-05-02 13:40:38 (GMT)
committerSteven Knight <knight@baldmt.com>2002-05-02 13:40:38 (GMT)
commit39d50eb2332228e827b56638877862f4c709a6bf (patch)
tree9043e61875931b89bcd8c235470838a19bd3a284 /src
parent14b0749ef9a6232ad1375f750baf00e0fea14e56 (diff)
downloadSCons-39d50eb2332228e827b56638877862f4c709a6bf.zip
SCons-39d50eb2332228e827b56638877862f4c709a6bf.tar.gz
SCons-39d50eb2332228e827b56638877862f4c709a6bf.tar.bz2
Add a Split() function (like argmunge()) in anticipation of removing the automatic white-space splitting from Builders in 0.08.
Diffstat (limited to 'src')
-rw-r--r--src/CHANGES.txt4
-rw-r--r--src/RELEASE.txt32
-rw-r--r--src/engine/SCons/Builder.py3
-rw-r--r--src/engine/SCons/Node/__init__.py6
-rw-r--r--src/engine/SCons/Script/SConscript.py1
-rw-r--r--src/engine/SCons/Util.py12
-rw-r--r--src/engine/SCons/UtilTests.py8
7 files changed, 58 insertions, 8 deletions
diff --git a/src/CHANGES.txt b/src/CHANGES.txt
index f152670..caaaf3e 100644
--- a/src/CHANGES.txt
+++ b/src/CHANGES.txt
@@ -109,6 +109,10 @@ RELEASE 0.07 - Thu, 25 Apr 2002 06:24:50 -0500
A -X option indicates it's an executable, not a script to feed
to the Python interpreter.
+ - Add a Split() function (identical to SCons.Util.argmunge()) for use
+ in the next release, when Builders will no longer automatically split
+ strings on white space.
+
From Steve Leblanc:
- Add the SConscriptChdir() method.
diff --git a/src/RELEASE.txt b/src/RELEASE.txt
index 1d0a5a9..803869a 100644
--- a/src/RELEASE.txt
+++ b/src/RELEASE.txt
@@ -67,6 +67,38 @@ RELEASE 0.07 - Thu, 25 Apr 2002 06:24:50 -0500
open(str(target), 'w').write(open(str(source), 'r').read())
return 0
+ Please not the following UPCOMING very important change:
+
+ - As of the next SCons release (0.08), Builder objects will no longer
+ automatically split target and source file strings on white space.
+ SCons will interpret the string arguments for the target or source
+ files as the complete name of the file, even if the name contains
+ white space.
+
+ Consequently, any builder calls that you have defined which supply
+ multiple file names in a single string, such as:
+
+ env.Program(target = 'foo', source = 'f1.c f2.c')
+
+ These calls will need to be changed by next release. You may
+ either split up the string into an array of individual file name
+ strings by hand:
+
+ env.Program(target = 'foo', source = ['f1.c', 'f2.c'])
+
+ Or you may use the newly-provided Split() function to turn a
+ string of white-space separated file names into an array:
+
+ env.Program(target = 'foo', source = Split('f1.c f2.c'))
+
+ The Split() function preserves the functionality that the builder
+ objects currently invoke internally: if the argument is a string,
+ it will be split on white space; if the argument is already a list,
+ the list will be returned.
+
+ (You may, of course, also use the string.split() function from
+ the standard Python library to convert your strings.)
+
Owing to an extensive test suite, the SCons team believes that this
release is of sufficient quality that you can use it for real work,
despite the "alpha" label.
diff --git a/src/engine/SCons/Builder.py b/src/engine/SCons/Builder.py
index 05330e4..a28a31d 100644
--- a/src/engine/SCons/Builder.py
+++ b/src/engine/SCons/Builder.py
@@ -218,6 +218,9 @@ class BuilderBase:
"""
def adjustixes(files, pre, suf):
ret = []
+ # FOR RELEASE 0.08:
+ #if not SCons.Util.is_List(files):
+ # files = [files]
files = SCons.Util.argmunge(files)
for f in files:
diff --git a/src/engine/SCons/Node/__init__.py b/src/engine/SCons/Node/__init__.py
index 68e4c73..68a55f8 100644
--- a/src/engine/SCons/Node/__init__.py
+++ b/src/engine/SCons/Node/__init__.py
@@ -398,6 +398,9 @@ arg2nodes_lookups = []
def arg2nodes(arg, node_factory=None):
+ # FOR RELEASE 0.08:
+ #"""This function converts a string or list into a list of Node
+ #instances."""
"""This function converts a string or list into a list of Node instances.
It follows the rules outlined in the SCons design document by accepting
any of the following inputs:
@@ -408,6 +411,9 @@ def arg2nodes(arg, node_factory=None):
in the list are not split at spaces.
In all cases, the function returns a list of Node instances."""
+ # FOR RELEASE 0.08:
+ #if not SCons.Util.is_List(arg):
+ # arg = [arg]
narg = SCons.Util.argmunge(arg)
nodes = []
diff --git a/src/engine/SCons/Script/SConscript.py b/src/engine/SCons/Script/SConscript.py
index a6f293d..79e2a60 100644
--- a/src/engine/SCons/Script/SConscript.py
+++ b/src/engine/SCons/Script/SConscript.py
@@ -263,5 +263,6 @@ def BuildDefaultGlobals():
globals['SConscript'] = SConscript
globals['SConscriptChdir'] = SConscriptChdir
globals['SetCommandHandler'] = SCons.Action.SetCommandHandler
+ globals['Split'] = SCons.Util.Split
globals['WhereIs'] = SCons.Util.WhereIs
return globals
diff --git a/src/engine/SCons/Util.py b/src/engine/SCons/Util.py
index 08edde7..7912abb 100644
--- a/src/engine/SCons/Util.py
+++ b/src/engine/SCons/Util.py
@@ -297,12 +297,16 @@ def to_String(s):
return str(s)
def argmunge(arg):
- """This function converts a string or list into a list of strings or Nodes.
- It follows the rules outlined in the SCons design document by accepting
- any of the following inputs:
+ return Split(arg)
+
+def Split(arg):
+ """This function converts a string or list into a list of strings
+ or Nodes. This makes things easier for users by allowing files to
+ be specified as a white-space separated list to be split.
+ The input rules are:
- A single string containing names separated by spaces. These will be
split apart at the spaces.
- - A single None instance
+ - A single Node instance
- A list containing either strings or Node instances. Any strings
in the list are not split at spaces.
In all cases, the function returns a list of Nodes and strings."""
diff --git a/src/engine/SCons/UtilTests.py b/src/engine/SCons/UtilTests.py
index 34dba99..4f3195f 100644
--- a/src/engine/SCons/UtilTests.py
+++ b/src/engine/SCons/UtilTests.py
@@ -240,10 +240,10 @@ class UtilTestCase(unittest.TestCase):
if hasattr(types, 'UnicodeType'):
exec "assert not is_List(u'')"
- def test_argmunge(self):
- assert argmunge("foo bar") == ["foo", "bar"]
- assert argmunge(["foo", "bar"]) == ["foo", "bar"]
- assert argmunge("foo") == ["foo"]
+ def test_Split(self):
+ assert Split("foo bar") == ["foo", "bar"]
+ assert Split(["foo", "bar"]) == ["foo", "bar"]
+ assert Split("foo") == ["foo"]
def test_is_String(self):
assert is_String("")