summaryrefslogtreecommitdiffstats
path: root/subcmds/sync.py
diff options
context:
space:
mode:
Diffstat (limited to 'subcmds/sync.py')
-rw-r--r--subcmds/sync.py17
1 files changed, 8 insertions, 9 deletions
diff --git a/subcmds/sync.py b/subcmds/sync.py
index 23098972..8460bcec 100644
--- a/subcmds/sync.py
+++ b/subcmds/sync.py
@@ -21,7 +21,6 @@ import multiprocessing
21import netrc 21import netrc
22import optparse 22import optparse
23import os 23import os
24import socket
25import sys 24import sys
26import tempfile 25import tempfile
27import time 26import time
@@ -1376,7 +1375,7 @@ later is required to fix a server side protocol bug.
1376 else: 1375 else:
1377 try: 1376 try:
1378 info = netrc.netrc() 1377 info = netrc.netrc()
1379 except IOError: 1378 except OSError:
1380 # .netrc file does not exist or could not be opened. 1379 # .netrc file does not exist or could not be opened.
1381 pass 1380 pass
1382 else: 1381 else:
@@ -1435,7 +1434,7 @@ later is required to fix a server side protocol bug.
1435 try: 1434 try:
1436 with open(smart_sync_manifest_path, "w") as f: 1435 with open(smart_sync_manifest_path, "w") as f:
1437 f.write(manifest_str) 1436 f.write(manifest_str)
1438 except IOError as e: 1437 except OSError as e:
1439 raise SmartSyncError( 1438 raise SmartSyncError(
1440 "error: cannot write manifest to %s:\n%s" 1439 "error: cannot write manifest to %s:\n%s"
1441 % (smart_sync_manifest_path, e), 1440 % (smart_sync_manifest_path, e),
@@ -1446,7 +1445,7 @@ later is required to fix a server side protocol bug.
1446 raise SmartSyncError( 1445 raise SmartSyncError(
1447 "error: manifest server RPC call failed: %s" % manifest_str 1446 "error: manifest server RPC call failed: %s" % manifest_str
1448 ) 1447 )
1449 except (socket.error, IOError, xmlrpc.client.Fault) as e: 1448 except (OSError, xmlrpc.client.Fault) as e:
1450 raise SmartSyncError( 1449 raise SmartSyncError(
1451 "error: cannot connect to manifest server %s:\n%s" 1450 "error: cannot connect to manifest server %s:\n%s"
1452 % (manifest.manifest_server, e), 1451 % (manifest.manifest_server, e),
@@ -1931,7 +1930,7 @@ class _FetchTimes:
1931 try: 1930 try:
1932 with open(self._path) as f: 1931 with open(self._path) as f:
1933 self._saved = json.load(f) 1932 self._saved = json.load(f)
1934 except (IOError, ValueError): 1933 except (OSError, ValueError):
1935 platform_utils.remove(self._path, missing_ok=True) 1934 platform_utils.remove(self._path, missing_ok=True)
1936 self._saved = {} 1935 self._saved = {}
1937 1936
@@ -1947,7 +1946,7 @@ class _FetchTimes:
1947 try: 1946 try:
1948 with open(self._path, "w") as f: 1947 with open(self._path, "w") as f:
1949 json.dump(self._seen, f, indent=2) 1948 json.dump(self._seen, f, indent=2)
1950 except (IOError, TypeError): 1949 except (OSError, TypeError):
1951 platform_utils.remove(self._path, missing_ok=True) 1950 platform_utils.remove(self._path, missing_ok=True)
1952 1951
1953 1952
@@ -1994,7 +1993,7 @@ class LocalSyncState:
1994 try: 1993 try:
1995 with open(self._path) as f: 1994 with open(self._path) as f:
1996 self._state = json.load(f) 1995 self._state = json.load(f)
1997 except (IOError, ValueError): 1996 except (OSError, ValueError):
1998 platform_utils.remove(self._path, missing_ok=True) 1997 platform_utils.remove(self._path, missing_ok=True)
1999 self._state = {} 1998 self._state = {}
2000 1999
@@ -2004,7 +2003,7 @@ class LocalSyncState:
2004 try: 2003 try:
2005 with open(self._path, "w") as f: 2004 with open(self._path, "w") as f:
2006 json.dump(self._state, f, indent=2) 2005 json.dump(self._state, f, indent=2)
2007 except (IOError, TypeError): 2006 except (OSError, TypeError):
2008 platform_utils.remove(self._path, missing_ok=True) 2007 platform_utils.remove(self._path, missing_ok=True)
2009 2008
2010 def PruneRemovedProjects(self): 2009 def PruneRemovedProjects(self):
@@ -2137,7 +2136,7 @@ class PersistentTransport(xmlrpc.client.Transport):
2137 try: 2136 try:
2138 p.feed(data) 2137 p.feed(data)
2139 except xml.parsers.expat.ExpatError as e: 2138 except xml.parsers.expat.ExpatError as e:
2140 raise IOError( 2139 raise OSError(
2141 f"Parsing the manifest failed: {e}\n" 2140 f"Parsing the manifest failed: {e}\n"
2142 f"Please report this to your manifest server admin.\n" 2141 f"Please report this to your manifest server admin.\n"
2143 f'Here is the full response:\n{data.decode("utf-8")}' 2142 f'Here is the full response:\n{data.decode("utf-8")}'