diff options
author | Steven Knight <knight@baldmt.com> | 2003-10-21 12:18:38 (GMT) |
---|---|---|
committer | Steven Knight <knight@baldmt.com> | 2003-10-21 12:18:38 (GMT) |
commit | 5711795d6f0f4dffbcfabc0d823024ca44313b27 (patch) | |
tree | 0c55b5e749ce9acbb8092e92d4d7c0b1a198fff6 /src/engine/SCons/Sig | |
parent | 126c5fee1b33ff06e42659a1f0874697fbd4c080 (diff) | |
download | SCons-5711795d6f0f4dffbcfabc0d823024ca44313b27.zip SCons-5711795d6f0f4dffbcfabc0d823024ca44313b27.tar.gz SCons-5711795d6f0f4dffbcfabc0d823024ca44313b27.tar.bz2 |
Better detection of KeyboardInterrupts. (Christoph Wiedemann)
Diffstat (limited to 'src/engine/SCons/Sig')
-rw-r--r-- | src/engine/SCons/Sig/__init__.py | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/engine/SCons/Sig/__init__.py b/src/engine/SCons/Sig/__init__.py index dfddf34..a2ebd5c 100644 --- a/src/engine/SCons/Sig/__init__.py +++ b/src/engine/SCons/Sig/__init__.py @@ -117,7 +117,7 @@ class _SConsign: """ try: return self.entries[filename] - except: + except (KeyError, AttributeError): return SConsignEntry() def set_entry(self, filename, entry): @@ -198,6 +198,8 @@ class SConsignDB(_SConsign): if type(self.entries) is not type({}): self.entries = {} raise TypeError + except KeyboardInterrupt: + raise except: SCons.Warnings.warn(SCons.Warnings.CorruptSConsignWarning, "Ignoring corrupt sconsign entry : %s"%self.dir.path) @@ -244,11 +246,13 @@ class SConsignDirFile(SConsignDir): try: fp = open(self.sconsign, 'rb') - except: + except IOError: fp = None try: SConsignDir.__init__(self, fp, module) + except KeyboardInterrupt: + raise except: SCons.Warnings.warn(SCons.Warnings.CorruptSConsignWarning, "Ignoring corrupt .sconsign file: %s"%self.sconsign) @@ -274,11 +278,11 @@ class SConsignDirFile(SConsignDir): try: file = open(temp, 'wb') fname = temp - except: + except IOError: try: file = open(self.sconsign, 'wb') fname = self.sconsign - except: + except IOError: return cPickle.dump(self.entries, file, 1) file.close() @@ -287,16 +291,16 @@ class SConsignDirFile(SConsignDir): mode = os.stat(self.sconsign)[0] os.chmod(self.sconsign, 0666) os.unlink(self.sconsign) - except: + except OSError: pass try: os.rename(fname, self.sconsign) - except: + except OSError: open(self.sconsign, 'wb').write(open(fname, 'rb').read()) os.chmod(self.sconsign, mode) try: os.unlink(temp) - except: + except OSError: pass SConsignForDirectory = SConsignDirFile |