Avoid infinite recursion when comparing Environments, better sys.version use in src...
authorstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Wed, 31 Mar 2004 12:28:33 +0000 (12:28 +0000)
committerstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Wed, 31 Mar 2004 12:28:33 +0000 (12:28 +0000)
git-svn-id: http://scons.tigris.org/svn/scons/trunk@934 fdb21ef1-2011-0410-befe-b5e4ea1792b1

src/engine/SCons/Environment.py
src/setupTests.py

index 8f576f5195ca6b40c715250400f002dc322ffa3b..62650d7ae6ebb81c7f566cfb8b3ab12acdf3ced8 100644 (file)
@@ -260,7 +260,15 @@ class Base:
             options.Update(self)
 
     def __cmp__(self, other):
-       return cmp(self._dict, other._dict)
+        # Since an Environment now has an '__env__' construction variable
+        # that refers to itself, delete that variable to avoid infinite
+        # loops when comparing the underlying dictionaries in some Python
+        # versions (*cough* 1.5.2 *cough*)...
+        sdict = self._dict.copy()
+        del sdict['__env__']
+        odict = other._dict.copy()
+        del odict['__env__']
+        return cmp(sdict, odict)
 
     def __getitem__(self, key):
         return self._dict[key]
index a0987452024dea19944a352ac0988adb728f0736..06688af5ed45543a83f9e945995084fa302edbbd 100644 (file)
@@ -71,9 +71,8 @@ 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 = os.path.join(lib_dir,
-                            'python%s.%s' % (v[0], v[1]),
+                            'python%s' % sys.version[:3],
                             'site-packages/')
 standalone_lib = os.path.join(lib_dir, 'scons')
 version_lib = os.path.join(lib_dir, scons_version)