eric7/UI/upgrader.py

branch
eric7
changeset 8994
3bebd76dc6ea
parent 8972
54816b8f740f
child 9001
a00cd6b55728
--- a/eric7/UI/upgrader.py	Sun Mar 20 17:59:49 2022 +0100
+++ b/eric7/UI/upgrader.py	Tue Mar 22 19:28:43 2022 +0100
@@ -11,6 +11,7 @@
 the requested packages and will restart eric.
 """
 
+import contextlib
 import subprocess
 import sys
 import time
@@ -57,9 +58,6 @@
     """
     Main entry point into the upgrader.
     """
-    # wait a few seconds to give eric the chance to fully shut down
-    time.sleep(2)
-    
     try:
         ddindex = sys.argv.index("--")
     except ValueError:
@@ -73,12 +71,25 @@
     
     upgraderArgs = sys.argv[1:ddindex]
     
+    upgradeType = ""
+    upgradeDelay = 2
+    
+    for arg in upgraderArgs:
+        if arg.startswith("--delay="):
+            with contextlib.suppress(ValueError):
+                upgradeDelay = int(arg.split("=")[1].strip())
+        elif arg.startswith("--type="):
+            upgradeType=arg.split("=")[1].strip()
+    
+    # wait a few seconds to give eric the chance to fully shut down
+    time.sleep(upgradeDelay)
+    
     # now perform the upgrade and start eric, if it was successful
-    if upgraderArgs[0] == "--pyqt":
+    if upgradeType == "pyqt":
         ok = doUpgrade(_pyqtPackages)
-    elif upgraderArgs[0] == "--eric":
+    elif upgradeType == "eric":
         ok = doUpgrade(_ericPackages)
-    elif upgraderArgs[0] == "--ericpyqt":
+    elif upgradeType == "ericpyqt":
         ok = doUpgrade(_ericPackages + _pyqtPackages)
     else:
         ok = False

eric ide

mercurial