cleanup: convert exceptions to OSError
In Python 3, these exceptions were merged into OSError, so switch
everything over to that.
Change-Id: If876a28b692de5aa5c62a3bdc8c000793ce52c63
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/390376
Reviewed-by: Aravind Vasudevan <aravindvasudev@google.com>
Commit-Queue: Mike Frysinger <vapier@google.com>
Tested-by: Mike Frysinger <vapier@google.com>
diff --git a/project.py b/project.py
index 5c9f31c..be53def 100644
--- a/project.py
+++ b/project.py
@@ -431,7 +431,7 @@
mode = os.stat(dest)[stat.ST_MODE]
mode = mode & ~(stat.S_IWUSR | stat.S_IWGRP | stat.S_IWOTH)
os.chmod(dest, mode)
- except IOError:
+ except OSError:
logger.error("error: Cannot copy file %s to %s", src, dest)
@@ -466,7 +466,7 @@
if not platform_utils.isdir(dest_dir):
os.makedirs(dest_dir)
platform_utils.symlink(relSrc, absDest)
- except IOError:
+ except OSError:
logger.error(
"error: Cannot link file %s to %s", relSrc, absDest
)
@@ -1198,7 +1198,7 @@
with tarfile.open(tarpath, "r") as tar:
tar.extractall(path=path)
return True
- except (IOError, tarfile.TarError) as e:
+ except (OSError, tarfile.TarError) as e:
logger.error("error: Cannot extract archive %s: %s", tarpath, e)
return False
@@ -1309,7 +1309,7 @@
alt_dir = os.path.join(
self.objdir, "objects", fd.readline().rstrip()
)
- except IOError:
+ except OSError:
alt_dir = None
else:
alt_dir = None
@@ -3584,7 +3584,7 @@
try:
with open(path) as fd:
line = fd.readline()
- except IOError as e:
+ except OSError as e:
raise NoManifestException(path, str(e))
try:
line = line.decode()