From fcd10ca3c39538542594aec5f894fc00fa58bdb1 Mon Sep 17 00:00:00 2001 From: Greg Noel Date: Tue, 20 Apr 2010 21:09:45 +0000 Subject: http://scons.tigris.org/issues/show_bug.cgi?id=2345 One-line changes: Wrap pickle.dump with staticmethod(). Keep softspace in Unbuffered wrapper class for backward compatibility with 3.x. Use ModuleType as a factory function rather than a base class. Derive exception class from something derived from BaseException (required for 3.x). --- QMTest/TestCmd.py | 2 +- QMTest/TestSCons.py | 2 +- runtest.py | 1 + src/engine/SCons/Util.py | 2 +- src/engine/SCons/dblite.py | 2 +- 5 files changed, 5 insertions(+), 4 deletions(-) diff --git a/QMTest/TestCmd.py b/QMTest/TestCmd.py index ab1c212..e715acc 100644 --- a/QMTest/TestCmd.py +++ b/QMTest/TestCmd.py @@ -574,7 +574,7 @@ except ImportError: # so we're going to cobble up something that looks just enough # like its API for our purposes below. from types import ModuleType - class subprocess(ModuleType): pass + subprocess = ModuleType('subprocess') subprocess.PIPE = 'PIPE' subprocess.STDOUT = 'STDOUT' diff --git a/QMTest/TestSCons.py b/QMTest/TestSCons.py index 0317149..fa3163b 100644 --- a/QMTest/TestSCons.py +++ b/QMTest/TestSCons.py @@ -807,7 +807,7 @@ SConscript( sconscript ) logfile, sconf_dir, sconstruct, doCheckLog=1, doCheckStdout=1): - class NoMatch: + class NoMatch(Exception): def __init__(self, p): self.pos = p diff --git a/runtest.py b/runtest.py index a5225f1..32e99d6 100644 --- a/runtest.py +++ b/runtest.py @@ -752,6 +752,7 @@ tests = list(map(Test, tests)) class Unbuffered: def __init__(self, file): self.file = file + self.softspace = 0 ## backward compatibility; not supported in Py3k def write(self, arg): self.file.write(arg) self.file.flush() diff --git a/src/engine/SCons/Util.py b/src/engine/SCons/Util.py index 259a133..20be4e4 100644 --- a/src/engine/SCons/Util.py +++ b/src/engine/SCons/Util.py @@ -1406,7 +1406,6 @@ class UniqueList(UserList): self.unique = False - class Unbuffered: """ A proxy class that wraps a file object, flushing after every write, @@ -1414,6 +1413,7 @@ class Unbuffered: """ def __init__(self, file): self.file = file + self.softspace = 0 ## backward compatibility; not supported in Py3k def write(self, arg): try: self.file.write(arg) diff --git a/src/engine/SCons/dblite.py b/src/engine/SCons/dblite.py index 5acd0f2..71aaff3 100644 --- a/src/engine/SCons/dblite.py +++ b/src/engine/SCons/dblite.py @@ -45,7 +45,7 @@ class dblite: # http://mail.python.org/pipermail/python-bugs-list/2003-March/016877.html _open = builtins.open - _pickle_dump = pickle.dump + _pickle_dump = staticmethod(pickle.dump) _os_chmod = os.chmod try: _os_chown = os.chown -- cgit v0.12