summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2004-03-30 15:14:35 +0000
committerSteven Knight <knight@baldmt.com>2004-03-30 15:14:35 +0000
commit1d77f7097830acce939fcaa8315ae659f1ecc7dd (patch)
treec5639ef50c3c4014b2875ba9d77c4c6301b162b9
parentb46dad1a6665597b93ffd6cee6e89100e1d76c5e (diff)
downloadscons-1d77f7097830acce939fcaa8315ae659f1ecc7dd.tar.gz
Use python1.5 in default Aegis builds. Fix testing infrastructure for Python 1.5.
-rw-r--r--config6
-rw-r--r--etc/SConscript2
-rw-r--r--etc/TestCommon.py81
-rw-r--r--etc/TestSCons.py20
-rw-r--r--src/engine/SCons/Environment.py154
-rw-r--r--src/setupTests.py11
-rw-r--r--test/SConsignFile.py51
7 files changed, 177 insertions, 148 deletions
diff --git a/config b/config
index 3dd4a782..8df5dba1 100644
--- a/config
+++ b/config
@@ -50,7 +50,7 @@
*
* Look in aesub(5) for more information about command substitutions.
*/
-build_command = "python ${Source bootstrap.py} -Y${SUBSTitute : \\ -Y $Search_Path} date='${DAte %Y/%m/%d %H:%M:%S}' developer=${DEVeloper} version=${VERsion} change=${Change}";
+build_command = "python1.5 ${Source bootstrap.py} -Y${SUBSTitute : \\ -Y $Search_Path} date='${DAte %Y/%m/%d %H:%M:%S}' developer=${DEVeloper} version=${VERsion} change=${Change}";
/*
* SCons removes its targets before constructing them, which qualifies it
@@ -258,9 +258,9 @@ diff_command =
* is set appropriately during a baseline test. So we just use the
* proper aesub variable to comment out the expanded $spe.
*/
-test_command = "python ${Source runtest.py Absolute} -p tar-gz -v ${SUBSTitute '\\.[CD][0-9]+$' '' ${VERsion}} -q ${File_Name}";
+test_command = "python1.5 ${Source runtest.py Absolute} -p tar-gz -v ${SUBSTitute '\\.[CD][0-9]+$' '' ${VERsion}} -q ${File_Name}";
-batch_test_command = "python ${Source runtest.py Absolute} -p tar-gz -v ${SUBSTitute '\\.[CD][0-9]+$' '' ${VERsion}} -o ${Output} ${File_Names} ${COMment $spe}";
+batch_test_command = "python1.5 ${Source runtest.py Absolute} -p tar-gz -v ${SUBSTitute '\\.[CD][0-9]+$' '' ${VERsion}} -o ${Output} ${File_Names} ${COMment $spe}";
new_test_filename = "test/CHANGETHIS.py";
diff --git a/etc/SConscript b/etc/SConscript
index 4309ddb1..e68663d7 100644
--- a/etc/SConscript
+++ b/etc/SConscript
@@ -31,6 +31,7 @@ Import('env')
files = [
'TestCmd.py',
+ 'TestCommon.py',
'TestSCons.py',
'unittest.py',
]
@@ -38,7 +39,6 @@ files = [
def copy(target, source, env):
t = str(target[0])
s = str(source[0])
- print "copy() < %s > %s" % (s, t)
open(t, 'wb').write(open(s, 'rb').read())
for file in files:
diff --git a/etc/TestCommon.py b/etc/TestCommon.py
index 0354e5ba..bf84ed39 100644
--- a/etc/TestCommon.py
+++ b/etc/TestCommon.py
@@ -46,13 +46,13 @@ provided by the TestCommon class:
The TestCommon module also provides the following variables
TestCommon.python_executable
- TestCommon._exe
- TestCommon._obj
- TestCommon._shobj
- TestCommon.lib_
- TestCommon._lib
- TestCommon.dll_
- TestCommon._dll
+ TestCommon.exe_suffix
+ TestCommon.obj_suffix
+ TestCommon.shobj_suffix
+ TestCommon.lib_prefix
+ TestCommon.lib_suffix
+ TestCommon.dll_prefix
+ TestCommon.dll_suffix
"""
@@ -73,7 +73,7 @@ The TestCommon module also provides the following variables
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
__author__ = "Steven Knight <knight at baldmt dot com>"
-__revision__ = "TestCommon.py 0.6.D001 2004/03/20 17:39:42 knight"
+__revision__ = "TestCommon.py 0.6.D002 2004/03/29 06:21:41 knight"
__version__ = "0.6"
import os
@@ -87,41 +87,48 @@ from TestCmd import *
from TestCmd import __all__
__all__.extend([ 'TestCommon',
- '_exe', '_obj', '_shobj', 'lib_', '_lib', 'dll_', '_dll', ])
+ 'exe_suffix',
+ 'obj_suffix',
+ 'shobj_suffix',
+ 'lib_prefix',
+ 'lib_suffix',
+ 'dll_prefix',
+ 'dll_suffix',
+ ])
# Variables that describe the prefixes and suffixes on this system.
if sys.platform == 'win32':
- _exe = '.exe'
- _obj = '.obj'
- _shobj = '.obj'
- lib_ = ''
- _lib = '.lib'
- dll_ = ''
- _dll = '.dll'
+ exe_suffix = '.exe'
+ obj_suffix = '.obj'
+ shobj_suffix = '.obj'
+ lib_prefix = ''
+ lib_suffix = '.lib'
+ dll_prefix = ''
+ dll_suffix = '.dll'
elif sys.platform == 'cygwin':
- _exe = '.exe'
- _obj = '.o'
- _shobj = '.os'
- lib_ = 'lib'
- _lib = '.a'
- dll_ = ''
- _dll = '.dll'
+ exe_suffix = '.exe'
+ obj_suffix = '.o'
+ shobj_suffix = '.os'
+ lib_prefix = 'lib'
+ lib_suffix = '.a'
+ dll_prefix = ''
+ dll_suffix = '.dll'
elif string.find(sys.platform, 'irix') != -1:
- _exe = ''
- _obj = '.o'
- _shobj = '.o'
- lib_ = 'lib'
- _lib = '.a'
- dll_ = 'lib'
- _dll = '.so'
+ exe_suffix = ''
+ obj_suffix = '.o'
+ shobj_suffix = '.o'
+ lib_prefix = 'lib'
+ lib_suffix = '.a'
+ dll_prefix = 'lib'
+ dll_suffix = '.so'
else:
- _exe = ''
- _obj = '.o'
- _shobj = '.os'
- lib_ = 'lib'
- _lib = '.a'
- dll_ = 'lib'
- _dll = '.so'
+ exe_suffix = ''
+ obj_suffix = '.o'
+ shobj_suffix = '.os'
+ lib_prefix = 'lib'
+ lib_suffix = '.a'
+ dll_prefix = 'lib'
+ dll_suffix = '.so'
def is_List(e):
return type(e) is types.ListType \
diff --git a/etc/TestSCons.py b/etc/TestSCons.py
index 33049c56..b39b5811 100644
--- a/etc/TestSCons.py
+++ b/etc/TestSCons.py
@@ -22,9 +22,27 @@ import string
import sys
from TestCommon import *
+from TestCommon import __all__
+
+__all__.extend([ 'TestSCons',
+ 'python',
+ '_exe',
+ '_obj',
+ '_shobj',
+ 'lib_',
+ '_lib',
+ 'dll_',
+ '_dll'
+ ])
python = python_executable
-
+_exe = exe_suffix
+_obj = obj_suffix
+_shobj = shobj_suffix
+_lib = lib_suffix
+lib_ = lib_prefix
+_dll = dll_suffix
+dll_ = dll_prefix
def gccFortranLibs():
"""Test whether -lfrtbegin is required. This can probably be done in
diff --git a/src/engine/SCons/Environment.py b/src/engine/SCons/Environment.py
index 73b563aa..8f576f51 100644
--- a/src/engine/SCons/Environment.py
+++ b/src/engine/SCons/Environment.py
@@ -105,7 +105,11 @@ def our_deepcopy(x):
for key in x.keys():
copy[key] = our_deepcopy(x[key])
elif SCons.Util.is_List(x):
- copy = x.__class__(map(our_deepcopy, x))
+ copy = map(our_deepcopy, x)
+ try:
+ copy = x.__class__(copy)
+ except AttributeError:
+ pass
else:
copy = x
return copy
@@ -455,52 +459,48 @@ class Base:
"""
kw = our_deepcopy(kw)
for key, val in kw.items():
+ # It would be easier on the eyes to write this using
+ # "continue" statements whenever we finish processing an item,
+ # but Python 1.5.2 apparently doesn't let you use "continue"
+ # within try:-except: blocks, so we have to nest our code.
try:
orig = self._dict[key]
except KeyError:
# No existing variable in the environment, so just set
# it to the new value.
self._dict[key] = val
- continue
-
- try:
- # Most straightforward: just try to add them together.
- # This will work in most cases, when the original and
- # new values are of compatible types.
- self._dict[key] = orig + val
- continue
- except TypeError:
- pass
-
- try:
- # Try to update a dictionary value with another.
- # If orig isn't a dictionary, it won't have an
- # update() method; if val isn't a dictionary, it
- # won't have a keys() method. Either way, it's
- # an AttributeError.
- orig.update(val)
- continue
- except AttributeError:
- pass
-
- try:
- # Check if the original is a list.
- add_to_orig = orig.append
- except AttributeError:
- pass
else:
- # The original is a list, so append the new value to it
- # (if there's a value to append).
- if val:
- add_to_orig(val)
- continue
-
- # The original isn't a list, but the new value is (by process
- # of elimination), so insert the original in the new value
- # (if there's one to insert) and replace the variable with it.
- if orig:
- val.insert(0, orig)
- self._dict[key] = val
+ try:
+ # Most straightforward: just try to add them
+ # together. This will work in most cases, when the
+ # original and new values are of compatible types.
+ self._dict[key] = orig + val
+ except TypeError:
+ try:
+ # Try to update a dictionary value with another.
+ # If orig isn't a dictionary, it won't have an
+ # update() method; if val isn't a dictionary,
+ # it won't have a keys() method. Either way,
+ # it's an AttributeError.
+ orig.update(val)
+ except AttributeError:
+ try:
+ # Check if the original is a list.
+ add_to_orig = orig.append
+ except AttributeError:
+ # The original isn't a list, but the new
+ # value is (by process of elimination),
+ # so insert the original in the new value
+ # (if there's one to insert) and replace
+ # the variable with it.
+ if orig:
+ val.insert(0, orig)
+ self._dict[key] = val
+ else:
+ # The original is a list, so append the new
+ # value to it (if there's a value to append).
+ if val:
+ add_to_orig(val)
def AppendENVPath(self, name, newpath, envname = 'ENV', sep = os.pathsep):
"""Append path elements to the path 'name' in the 'ENV'
@@ -690,52 +690,48 @@ class Base:
"""
kw = our_deepcopy(kw)
for key, val in kw.items():
+ # It would be easier on the eyes to write this using
+ # "continue" statements whenever we finish processing an item,
+ # but Python 1.5.2 apparently doesn't let you use "continue"
+ # within try:-except: blocks, so we have to nest our code.
try:
orig = self._dict[key]
except KeyError:
# No existing variable in the environment, so just set
# it to the new value.
self._dict[key] = val
- continue
-
- try:
- # Most straightforward: just try to add them together.
- # This will work in most cases, when the original and
- # new values are of compatible types.
- self._dict[key] = val + orig
- continue
- except TypeError:
- pass
-
- try:
- # Try to update a dictionary value with another.
- # If orig isn't a dictionary, it won't have an
- # update() method; if val isn't a dictionary, it
- # won't have a keys() method. Either way, it's
- # an AttributeError.
- orig.update(val)
- continue
- except AttributeError:
- pass
-
- try:
- # Check if the added value is a list.
- add_to_val = val.append
- except AttributeError:
- pass
else:
- # The added value is a list, so append the original to it
- # (if there's a value to append).
- if orig:
- add_to_val(orig)
- self._dict[key] = val
- continue
-
- # The added value isn't a list, but the original is (by
- # process of elimination), so insert the the new value in
- # the original (if there's one to insert).
- if val:
- orig.insert(0, val)
+ try:
+ # Most straightforward: just try to add them
+ # together. This will work in most cases, when the
+ # original and new values are of compatible types.
+ self._dict[key] = val + orig
+ except TypeError:
+ try:
+ # Try to update a dictionary value with another.
+ # If orig isn't a dictionary, it won't have an
+ # update() method; if val isn't a dictionary,
+ # it won't have a keys() method. Either way,
+ # it's an AttributeError.
+ orig.update(val)
+ except AttributeError:
+ try:
+ # Check if the added value is a list.
+ add_to_val = val.append
+ except AttributeError:
+ # The added value isn't a list, but the
+ # original is (by process of elimination),
+ # so insert the the new value in the original
+ # (if there's one to insert).
+ if val:
+ orig.insert(0, val)
+ else:
+ # The added value is a list, so append
+ # the original to it (if there's a value
+ # to append).
+ if orig:
+ add_to_val(orig)
+ self._dict[key] = val
def PrependENVPath(self, name, newpath, envname = 'ENV', sep = os.pathsep):
"""Prepend path elements to the path 'name' in the 'ENV'
diff --git a/src/setupTests.py b/src/setupTests.py
index 7ef38335..a0987452 100644
--- a/src/setupTests.py
+++ b/src/setupTests.py
@@ -41,7 +41,7 @@ python = TestSCons.python
class MyTestSCons(TestSCons.TestSCons):
def installed(self, lib):
lines = string.split(self.stdout(), '\n')
- return lines[-3] == 'Installed SCons library modules into %s' % lib
+ return ('Installed SCons library modules into %s' % lib) in lines
try:
cwd = os.environ['SCONS_CWD']
@@ -70,10 +70,13 @@ test.subdir('root', 'prefix')
root = test.workpath('root')
prefix = test.workpath('prefix')
+lib_dir = os.path.join(root + sys.prefix, 'lib')
v = string.split(string.split(sys.version)[0], '.')
-standard_lib = '%s/usr/lib/python%s.%s/site-packages/' % (root, v[0], v[1])
-standalone_lib = '%s/usr/lib/scons' % root
-version_lib = '%s/usr/lib/%s' % (root, scons_version)
+standard_lib = os.path.join(lib_dir,
+ 'python%s.%s' % (v[0], v[1]),
+ 'site-packages/')
+standalone_lib = os.path.join(lib_dir, 'scons')
+version_lib = os.path.join(lib_dir, scons_version)
os.system("gunzip -c %s | tar xf -" % tar_gz)
diff --git a/test/SConsignFile.py b/test/SConsignFile.py
index 606f20bd..c919c79b 100644
--- a/test/SConsignFile.py
+++ b/test/SConsignFile.py
@@ -60,20 +60,25 @@ test.write(['work1', 'subdir', 'f4.in'], "work1/subdir/f4.in\n")
test.run(chdir = 'work1')
-test.fail_test(not os.path.exists(test.workpath('work1', '.sconsign.dbm')))
-test.fail_test(os.path.exists(test.workpath('work1', '.sconsign')))
-test.fail_test(os.path.exists(test.workpath('work1', 'subdir', '.sconsign')))
-
-test.fail_test(test.read(['work1', 'f1.out']) != "work1/f1.in\n")
-test.fail_test(test.read(['work1', 'f2.out']) != "work1/f2.in\n")
-test.fail_test(test.read(['work1', 'subdir', 'f3.out']) != "work1/subdir/f3.in\n")
-test.fail_test(test.read(['work1', 'subdir', 'f4.out']) != "work1/subdir/f4.in\n")
+def any_dbm_file(prefix):
+ return os.path.exists(prefix) \
+ or os.path.exists(prefix + '.dat') \
+ or os.path.exists(prefix + '.dir')
+
+test.fail_test(not any_dbm_file(test.workpath('work1', '.sconsign.dbm')))
+test.must_not_exist(test.workpath('work1', '.sconsign'))
+test.must_not_exist(test.workpath('work1', 'subdir', '.sconsign'))
+
+test.must_match(['work1', 'f1.out'], "work1/f1.in\n")
+test.must_match(['work1', 'f2.out'], "work1/f2.in\n")
+test.must_match(['work1', 'subdir', 'f3.out'], "work1/subdir/f3.in\n")
+test.must_match(['work1', 'subdir', 'f4.out'], "work1/subdir/f4.in\n")
test.up_to_date(chdir = 'work1', arguments = '.')
-test.fail_test(not os.path.exists(test.workpath('work1', '.sconsign.dbm')))
-test.fail_test(os.path.exists(test.workpath('work1', '.sconsign')))
-test.fail_test(os.path.exists(test.workpath('work1', 'subdir', '.sconsign')))
+test.fail_test(not any_dbm_file(test.workpath('work1', '.sconsign.dbm')))
+test.must_not_exist(test.workpath('work1', '.sconsign'))
+test.must_not_exist(test.workpath('work1', 'subdir', '.sconsign'))
#
test.write(['work2', 'SConstruct'], """
@@ -94,21 +99,21 @@ test.write(['work2', 'subdir', 'f8.in'], "work2/subdir/f8.in\n")
test.run(chdir = 'work2')
-test.fail_test(not os.path.exists(test.workpath('work2', 'my_sconsign')))
-test.fail_test(os.path.exists(test.workpath('work2', '.sconsign.dbm')))
-test.fail_test(os.path.exists(test.workpath('work2', '.sconsign')))
-test.fail_test(os.path.exists(test.workpath('work2', 'subdir', '.sconsign')))
+test.fail_test(not any_dbm_file(test.workpath('work2', 'my_sconsign')))
+test.fail_test(any_dbm_file(test.workpath('work2', '.sconsign.dbm')))
+test.must_not_exist(test.workpath('work2', '.sconsign'))
+test.must_not_exist(test.workpath('work2', 'subdir', '.sconsign'))
-test.fail_test(test.read(['work2', 'f5.out']) != "work2/f5.in\n")
-test.fail_test(test.read(['work2', 'f6.out']) != "work2/f6.in\n")
-test.fail_test(test.read(['work2', 'subdir', 'f7.out']) != "work2/subdir/f7.in\n")
-test.fail_test(test.read(['work2', 'subdir', 'f8.out']) != "work2/subdir/f8.in\n")
+test.must_match(['work2', 'f5.out'], "work2/f5.in\n")
+test.must_match(['work2', 'f6.out'], "work2/f6.in\n")
+test.must_match(['work2', 'subdir', 'f7.out'], "work2/subdir/f7.in\n")
+test.must_match(['work2', 'subdir', 'f8.out'], "work2/subdir/f8.in\n")
test.up_to_date(chdir = 'work2', arguments = '.')
-test.fail_test(not os.path.exists(test.workpath('work2', 'my_sconsign')))
-test.fail_test(os.path.exists(test.workpath('work2', '.sconsign.dbm')))
-test.fail_test(os.path.exists(test.workpath('work2', '.sconsign')))
-test.fail_test(os.path.exists(test.workpath('work2', 'subdir', '.sconsign')))
+test.fail_test(not any_dbm_file(test.workpath('work2', 'my_sconsign')))
+test.fail_test(any_dbm_file(test.workpath('work2', '.sconsign.dbm')))
+test.must_not_exist(test.workpath('work2', '.sconsign'))
+test.must_not_exist(test.workpath('work2', 'subdir', '.sconsign'))
test.pass_test()