summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGary Oberbrunner <garyo@oberbrunner.com>2012-03-03 09:04:19 -0500
committerGary Oberbrunner <garyo@oberbrunner.com>2012-03-03 09:04:19 -0500
commit6cc3e72bad6d45970c13d9ffd6bba23c14bcd0df (patch)
tree4a9d7848f5acfc8c732bc10495d1207e4332b0f9
parent49778dc452463b2e9f801c95a0154163f149530c (diff)
parent343e936abc78e3332bebd0b423a96e017359ee13 (diff)
downloadscons-6cc3e72bad6d45970c13d9ffd6bba23c14bcd0df.tar.gz
Merged in dirkbaechle/scons/issue2809 (pull request #14)
-rw-r--r--QMTest/TestSCons.py2
-rw-r--r--QMTest/TestSConsMSVS.py4
-rw-r--r--SConstruct2
-rw-r--r--bin/scons-doc.py2
-rw-r--r--bin/scons-proc.py4
-rwxr-xr-x[-rw-r--r--]bootstrap.py23
-rw-r--r--src/engine/SCons/Action.py2
-rw-r--r--src/engine/SCons/Conftest.py2
-rw-r--r--src/engine/SCons/SConfTests.py2
-rw-r--r--src/engine/SCons/Tool/msvs.py66
-rw-r--r--test/update-release-info/update-release-info.py26
11 files changed, 63 insertions, 72 deletions
diff --git a/QMTest/TestSCons.py b/QMTest/TestSCons.py
index 27cfcb89..4f04a486 100644
--- a/QMTest/TestSCons.py
+++ b/QMTest/TestSCons.py
@@ -33,7 +33,7 @@ from TestCommon import __all__
default_version = '2.1.0.alpha.yyyymmdd'
-copyright_years = '2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011'
+copyright_years = '2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012'
python_version_unsupported = (2, 3, 0)
python_version_deprecated = (2, 4, 0)
diff --git a/QMTest/TestSConsMSVS.py b/QMTest/TestSConsMSVS.py
index 604f1915..1cff81d6 100644
--- a/QMTest/TestSConsMSVS.py
+++ b/QMTest/TestSConsMSVS.py
@@ -710,7 +710,7 @@ expected_vcprojfile_10_0 = """\
\t\t<NMakeForcedUsingAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(NMakeForcedUsingAssemblies)</NMakeForcedUsingAssemblies>
\t</PropertyGroup>
\t<ItemGroup>
-\t\t<ClInclude Include="sdk.h" />
+\t\t<ClInclude Include="sdk_dir\sdk.h" />
\t</ItemGroup>
\t<ItemGroup>
\t\t<ClInclude Include="test.h" />
@@ -787,7 +787,7 @@ env=Environment(platform='win32', tools=['msvs'], MSVS_VERSION='10.0',
HOST_ARCH='%(HOST_ARCH)s')
testsrc = ['test1.cpp', 'test2.cpp']
-testincs = ['sdk.h']
+testincs = ['sdk_dir\sdk.h']
testlocalincs = ['test.h']
testresources = ['test.rc']
testmisc = ['readme.txt']
diff --git a/SConstruct b/SConstruct
index 1748b5bb..337ca409 100644
--- a/SConstruct
+++ b/SConstruct
@@ -5,7 +5,7 @@
# When this gets changed, you must also change the copyright_years string
# in QMTest/TestSCons.py so the test scripts look for the right string.
-copyright_years = '2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011'
+copyright_years = '2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012'
# This gets inserted into the man pages to reflect the month of release.
month_year = 'MONTH YEAR'
diff --git a/bin/scons-doc.py b/bin/scons-doc.py
index f99dfa74..cf5d5b29 100644
--- a/bin/scons-doc.py
+++ b/bin/scons-doc.py
@@ -845,7 +845,7 @@ def process(filename, fout=sys.stdout):
if data.startswith('<?xml '):
first_line, data = data.split('\n', 1)
- sys.stdout.write(first_line + '\n')
+ fout.write(first_line + '\n')
x = MySGML(fout)
for c in data:
diff --git a/bin/scons-proc.py b/bin/scons-proc.py
index 6d158165..1f537c71 100644
--- a/bin/scons-proc.py
+++ b/bin/scons-proc.py
@@ -17,7 +17,7 @@ import string
import sys
import xml.sax
try:
- from io import StringIO
+ from io import StringIO # usable as of 2.6; takes unicode only
except ImportError:
# No 'io' module or no StringIO in io
exec('from cStringIO import StringIO')
@@ -105,7 +105,7 @@ for f in args:
content = content.replace('-->\n', '-->')
input = xml_preamble + content + xml_postamble
try:
- saxparser.parse(StringIO(input))
+ saxparser.parse(StringIO(unicode(input)))
except:
sys.stderr.write("error in %s\n" % f)
raise
diff --git a/bootstrap.py b/bootstrap.py
index 2656f4fa..0d1a3fc5 100644..100755
--- a/bootstrap.py
+++ b/bootstrap.py
@@ -1,3 +1,4 @@
+#!/usr/bin/env python
#
# __COPYRIGHT__
#
@@ -28,15 +29,15 @@ import subprocess
__doc__ = """bootstrap.py
-This script supports "bootstrap" execution of the current SCons in
-this local source tree by copying of all necessary Python scripts and
-modules from underneath the src/ subdirectory into a subdirectory (named
-"bootstrap/" by default), and then executing the copied SCons with the
-supplied command-line arguments.
+Execute SCons from this source tree. It copies Python scripts and modules
+from src/ subdirectory into a subdirectory named "bootstrap/" (by default),
+and executes SCons from there with the supplied command-line arguments.
-There are a handful of options that are specific to this bootstrap.py
-script and which are *not* passed on to the underlying SCons script.
-All of these begin with the string "bootstrap_":
+This is a minimal build of SCons to bootstrap the full build of all the
+packages, as specified in our local SConstruct file.
+
+Some options are specific to this bootstrap.py script and are *not* passed
+on to the SCons script. All of these begin with the string "bootstrap_":
--bootstrap_dir=DIR
@@ -59,7 +60,7 @@ All of these begin with the string "bootstrap_":
Only updates the bootstrap subdirectory, and then exits.
-In addition to the above options, the bootstrap.py script understands
+In addition to the above, the bootstrap.py script understands
the following SCons options:
-C, --directory
@@ -68,10 +69,6 @@ the following SCons options:
Because we change directory right away to the specified directory,
the SCons script itself doesn't need to, so this option gets
"eaten" by the bootstrap.py script.
-
-This is essentially a minimal build of SCons to bootstrap ourselves into
-executing it for the full build of all the packages, as specified in our
-local SConstruct file.
"""
script_dir = os.path.abspath(os.path.dirname(__file__))
diff --git a/src/engine/SCons/Action.py b/src/engine/SCons/Action.py
index 6909a9ac..c1eef756 100644
--- a/src/engine/SCons/Action.py
+++ b/src/engine/SCons/Action.py
@@ -899,7 +899,7 @@ class CommandGeneratorAction(ActionBase):
show=_null, execute=_null, chdir=_null, executor=None):
act = self._generate(target, source, env, 0, executor)
if act is None:
- raise UserError("While building `%s': "
+ raise SCons.Errors.UserError("While building `%s': "
"Cannot deduce file extension from source files: %s"
% (repr(list(map(str, target))), repr(list(map(str, source)))))
return act(target, source, env, exitstatfunc, presub,
diff --git a/src/engine/SCons/Conftest.py b/src/engine/SCons/Conftest.py
index 04a6bc2a..d4662780 100644
--- a/src/engine/SCons/Conftest.py
+++ b/src/engine/SCons/Conftest.py
@@ -554,7 +554,7 @@ def CheckDeclaration(context, symbol, includes = None, language = None):
lang, suffix, msg = _lang2suffix(language)
if msg:
- context.Display("Cannot check for declaration %s: %s\n" % (type_name, msg))
+ context.Display("Cannot check for declaration %s: %s\n" % (symbol, msg))
return msg
src = includetext + includes
diff --git a/src/engine/SCons/SConfTests.py b/src/engine/SCons/SConfTests.py
index b05c4cc8..e6048860 100644
--- a/src/engine/SCons/SConfTests.py
+++ b/src/engine/SCons/SConfTests.py
@@ -697,6 +697,8 @@ int main() {
assert r, "__cplusplus not declared in C++ ??"
r = sconf.CheckDeclaration('__cplusplus', language = 'C')
assert not r, "__cplusplus declared in C ??"
+ r = sconf.CheckDeclaration('unknown', language = 'Unknown')
+ assert not r, "unknown language was supported ??"
finally:
sconf.Finish()
diff --git a/src/engine/SCons/Tool/msvs.py b/src/engine/SCons/Tool/msvs.py
index 6c273a7d..40773247 100644
--- a/src/engine/SCons/Tool/msvs.py
+++ b/src/engine/SCons/Tool/msvs.py
@@ -786,19 +786,15 @@ class _GenerateV7DSP(_DSPGenerator):
# First remove any common prefix
commonprefix = None
- if len(sources) > 1:
- s = list(map(os.path.normpath, sources))
- # take the dirname because the prefix may include parts
- # of the filenames (e.g. if you have 'dir\abcd' and
- # 'dir\acde' then the cp will be 'dir\a' )
- cp = os.path.dirname( os.path.commonprefix(s) )
- if cp and s[0][len(cp)] == os.sep:
- # +1 because the filename starts after the separator
- sources = [s[len(cp)+1:] for s in sources]
- commonprefix = cp
- elif len(sources) == 1:
- commonprefix = os.path.dirname( sources[0] )
- sources[0] = os.path.basename( sources[0] )
+ s = list(map(os.path.normpath, sources))
+ # take the dirname because the prefix may include parts
+ # of the filenames (e.g. if you have 'dir\abcd' and
+ # 'dir\acde' then the cp will be 'dir\a' )
+ cp = os.path.dirname( os.path.commonprefix(s) )
+ if cp and s[0][len(cp)] == os.sep:
+ # +1 because the filename starts after the separator
+ sources = [s[len(cp)+1:] for s in sources]
+ commonprefix = cp
hierarchy = makeHierarchy(sources)
self.printSources(hierarchy, commonprefix=commonprefix)
@@ -1116,19 +1112,15 @@ class _GenerateV10DSP(_DSPGenerator):
# First remove any common prefix
sources = self.sources[kind]
commonprefix = None
- if len(sources) > 1:
- s = list(map(os.path.normpath, sources))
- # take the dirname because the prefix may include parts
- # of the filenames (e.g. if you have 'dir\abcd' and
- # 'dir\acde' then the cp will be 'dir\a' )
- cp = os.path.dirname( os.path.commonprefix(s) )
- if cp and s[0][len(cp)] == os.sep:
- # +1 because the filename starts after the separator
- sources = [s[len(cp)+1:] for s in sources]
- commonprefix = cp
- elif len(sources) == 1:
- commonprefix = os.path.dirname( sources[0] )
- sources[0] = os.path.basename( sources[0] )
+ s = list(map(os.path.normpath, sources))
+ # take the dirname because the prefix may include parts
+ # of the filenames (e.g. if you have 'dir\abcd' and
+ # 'dir\acde' then the cp will be 'dir\a' )
+ cp = os.path.dirname( os.path.commonprefix(s) )
+ if cp and s[0][len(cp)] == os.sep:
+ # +1 because the filename starts after the separator
+ sources = [s[len(cp)+1:] for s in sources]
+ commonprefix = cp
hierarchy = makeHierarchy(sources)
self.printFilters(hierarchy, kind)
@@ -1143,19 +1135,15 @@ class _GenerateV10DSP(_DSPGenerator):
# First remove any common prefix
sources = self.sources[kind]
commonprefix = None
- if len(sources) > 1:
- s = list(map(os.path.normpath, sources))
- # take the dirname because the prefix may include parts
- # of the filenames (e.g. if you have 'dir\abcd' and
- # 'dir\acde' then the cp will be 'dir\a' )
- cp = os.path.dirname( os.path.commonprefix(s) )
- if cp and s[0][len(cp)] == os.sep:
- # +1 because the filename starts after the separator
- sources = [s[len(cp)+1:] for s in sources]
- commonprefix = cp
- elif len(sources) == 1:
- commonprefix = os.path.dirname( sources[0] )
- sources[0] = os.path.basename( sources[0] )
+ s = list(map(os.path.normpath, sources))
+ # take the dirname because the prefix may include parts
+ # of the filenames (e.g. if you have 'dir\abcd' and
+ # 'dir\acde' then the cp will be 'dir\a' )
+ cp = os.path.dirname( os.path.commonprefix(s) )
+ if cp and s[0][len(cp)] == os.sep:
+ # +1 because the filename starts after the separator
+ sources = [s[len(cp)+1:] for s in sources]
+ commonprefix = cp
hierarchy = makeHierarchy(sources)
self.printSources(hierarchy, kind, commonprefix, kind)
diff --git a/test/update-release-info/update-release-info.py b/test/update-release-info/update-release-info.py
index dfcd2368..654a25c1 100644
--- a/test/update-release-info/update-release-info.py
+++ b/test/update-release-info/update-release-info.py
@@ -31,6 +31,9 @@ import os, sys, time
import TestRuntest
+# Needed to ensure we're using the correct year
+this_year=time.localtime()[0]
+
TestSCons = 'QMTest/TestSCons.py' .split('/')
README = 'README' .split('/')
ReleaseConfig = 'ReleaseConfig' .split('/')
@@ -69,14 +72,14 @@ combo_strings = [
"""version_tuple = (2, 0, 0, 'final', 0)
""",
# Index 5: bad release date
-"""release_date = (2011, 12)
-""",
+"""release_date = (%d, 12)
+"""%this_year,
# Index 6: release date (hhhh, mm, dd)
-"""release_date = (2011, 12, 21)
-""",
+"""release_date = (%d, 12, 21)
+"""%this_year,
# Index 7: release date (hhhh, mm, dd, hh, mm, ss)
-"""release_date = (2011, 12, 21, 12, 21, 12)
-""",
+"""release_date = (%d, 12, 21, 12, 21, 12)
+"""%this_year,
]
combo_error = \
@@ -114,8 +117,8 @@ combo_fail(0, 1, 2, stdout =
combo_strings[0] = combo_strings[1] + combo_strings[2] + combo_strings[3]
combo_fail(0, 5, stdout =
-"""ERROR: Invalid release date (2011, 12)
-""")
+"""ERROR: Invalid release date (%d, 12)
+"""%this_year )
def pave(path):
path = path[:-1]
@@ -195,7 +198,8 @@ test.must_match(Announce, """
RELEASE 2.0.0.alpha.yyyymmdd - NEW DATE WILL BE INSERTED HERE
""", mode = 'r')
-years = ', '.join(map(str, range(2001, time.localtime()[0] + 1)))
+
+years = ', '.join(map(str, range(2001, this_year + 1)))
test.must_match(SConstruct, """
month_year = 'MONTH YEAR'
copyright_years = %s
@@ -213,11 +217,11 @@ These files are a part of 33.22.11:
# should get Python floors from TestSCons module.
test.must_match(TestSCons, """
-copyright_years = '2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011'
+copyright_years = '%s'
default_version = '2.0.0.alpha.yyyymmdd'
python_version_unsupported = (2, 3)
python_version_deprecated = (2, 4)
-""", mode = 'r')
+"""%years, mode = 'r')
# should get Python floors from TestSCons module.
test.must_match(Main, """