Use python1.5 in default Aegis builds. Fix testing infrastructure for Python 1.5.
authorstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Tue, 30 Mar 2004 15:14:35 +0000 (15:14 +0000)
committerstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Tue, 30 Mar 2004 15:14:35 +0000 (15:14 +0000)
git-svn-id: http://scons.tigris.org/svn/scons/trunk@933 fdb21ef1-2011-0410-befe-b5e4ea1792b1

config
etc/SConscript
etc/TestCommon.py
etc/TestSCons.py
src/engine/SCons/Environment.py
src/setupTests.py
test/SConsignFile.py

diff --git a/config b/config
index 3dd4a782a3907e8567c73ab99306cd5646dbdc81..8df5dba1ab13a5610f735378b368ab73f312b476 100644 (file)
--- 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";
 
index 4309ddb1c8d02d544a1aea7dee9fc9e594c1eb7d..e68663d7c1d8e65c98706d0f93d7111ff2fe028f 100644 (file)
@@ -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:
index 0354e5badaec54aed05fe44bddbce81e852101bc..bf84ed39828b5610bff2f9a2640767c4f32fa189 100644 (file)
@@ -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 \
index 33049c560430ef48c944d369f3b3af2be6622e09..b39b5811f756b65f7199ce6fcb39b3979424a30f 100644 (file)
@@ -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
index 73b563aa49d32edd9e9beb9db3a37bc57178cde9..8f576f5195ca6b40c715250400f002dc322ffa3b 100644 (file)
@@ -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'
index 7ef38335db8334d488b16ced1baa1884a6c0c7ca..a0987452024dea19944a352ac0988adb728f0736 100644 (file)
@@ -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)
 
index 606f20bd7f7735094f49ff64fa147e1daca1302d..c919c79b79a43ed5c0fdfb0ac9aeeac50adc749c 100644 (file)
@@ -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()