scripts/install.py

changeset 8240
93b8a353c4bf
parent 8214
51f0d3e047ec
child 8243
cc717c2ae956
--- a/scripts/install.py	Wed Apr 14 19:38:19 2021 +0200
+++ b/scripts/install.py	Wed Apr 14 19:59:16 2021 +0200
@@ -24,6 +24,7 @@
 import shlex
 import datetime
 import getpass
+import contextlib
 
 # Define the globals.
 progName = None
@@ -1744,10 +1745,8 @@
     if not fileName:
         return
     
-    try:
+    with contextlib.suppress(OSError):
         os.rename(fileName, fileName + ".orig")
-    except OSError:
-        pass
     try:
         hgOut = subprocess.check_output(["hg", "identify", "-i"])   # secok
         hgOut = hgOut.decode()
@@ -2059,24 +2058,20 @@
             json.dump(installInfo, installInfoFile, indent=2)
     
     # do some cleanup
-    try:
+    with contextlib.suppress(OSError):
         if installFromSource:
             os.remove(configName)
             configNameC = configName + 'c'
             if os.path.exists(configNameC):
                 os.remove(configNameC)
             os.rename(configName + ".orig", configName)
-    except OSError:
-        pass
-    try:
+    with contextlib.suppress(OSError):
         if installFromSource and infoName:
             os.remove(infoName)
             infoNameC = infoName + 'c'
             if os.path.exists(infoNameC):
                 os.remove(infoNameC)
             os.rename(infoName + ".orig", infoName)
-    except OSError:
-        pass
     
     print("\nInstallation complete.")
     print()

eric ide

mercurial