diff options
author | Mats Wichmann <mats@linux.com> | 2023-08-04 14:37:28 (GMT) |
---|---|---|
committer | Mats Wichmann <mats@linux.com> | 2023-08-04 14:42:12 (GMT) |
commit | f3d1936c34333b8b535269a007a5598e93029bc0 (patch) | |
tree | d57e134d5dca344c8da28b7c62290f2c4ac6127e /SCons/SConsign.py | |
parent | e141cd3288ece58340a1a9e5d99a8c4f810366a9 (diff) | |
download | SCons-f3d1936c34333b8b535269a007a5598e93029bc0.zip SCons-f3d1936c34333b8b535269a007a5598e93029bc0.tar.gz SCons-f3d1936c34333b8b535269a007a5598e93029bc0.tar.bz2 |
"Modernize" to Python 3.6 via tool
$ pyupgrade --py36-plus $(<filelist)
Here's mostly what it's done:
- No more 'stringliteral'.encode('utf-8'): now b'stringliteral'
- No more unicode literals
- the default open mode is 'r', leaves out if default
- some f-string conversions (if shorter)
- catch OSError instead of subclasses
- no more mention of "object"
- generator expression instead of list comp. when safe
- a few tests had a shebang but actually began with blank line
- remove coding: utf-8 comment, per pep 3120 this is the default now
Manually - if a file in test/ was modified, then did the copyright
header conversion.
Signed-off-by: Mats Wichmann <mats@linux.com>
Diffstat (limited to 'SCons/SConsign.py')
-rw-r--r-- | SCons/SConsign.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/SCons/SConsign.py b/SCons/SConsign.py index 3d56304..1215c6a 100644 --- a/SCons/SConsign.py +++ b/SCons/SConsign.py @@ -87,7 +87,7 @@ def Get_DataBase(dir): except KeyError: path = d.entry_abspath(DB_Name) try: db = DataBase[d] = DB_Module.open(path, mode) - except (IOError, OSError): + except OSError: pass else: if mode != "r": @@ -339,7 +339,7 @@ class DirFile(Dir): try: fp = open(self.sconsign, 'rb') - except IOError: + except OSError: fp = None try: @@ -378,11 +378,11 @@ class DirFile(Dir): try: file = open(temp, 'wb') fname = temp - except IOError: + except OSError: try: file = open(self.sconsign, 'wb') fname = self.sconsign - except IOError: + except OSError: return for key, entry in self.entries.items(): entry.convert_to_sconsign() @@ -393,7 +393,7 @@ class DirFile(Dir): mode = os.stat(self.sconsign)[0] os.chmod(self.sconsign, 0o666) os.unlink(self.sconsign) - except (IOError, OSError): + except OSError: # Try to carry on in the face of either OSError # (things like permission issues) or IOError (disk # or network issues). If there's a really dangerous @@ -414,7 +414,7 @@ class DirFile(Dir): os.chmod(self.sconsign, mode) try: os.unlink(temp) - except (IOError, OSError): + except OSError: pass ForDirectory = DB |