From: stevenknight Date: Wed, 31 Mar 2004 12:28:33 +0000 (+0000) Subject: Avoid infinite recursion when comparing Environments, better sys.version use in src... X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=7a15e47c9a5361c6cf32677b3c7e027315ec03d4;p=scons.git Avoid infinite recursion when comparing Environments, better sys.version use in src/setup/Tests.py. git-svn-id: http://scons.tigris.org/svn/scons/trunk@934 fdb21ef1-2011-0410-befe-b5e4ea1792b1 --- diff --git a/src/engine/SCons/Environment.py b/src/engine/SCons/Environment.py index 8f576f51..62650d7a 100644 --- a/src/engine/SCons/Environment.py +++ b/src/engine/SCons/Environment.py @@ -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] diff --git a/src/setupTests.py b/src/setupTests.py index a0987452..06688af5 100644 --- a/src/setupTests.py +++ b/src/setupTests.py @@ -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)