eric7/UI/upgrader.py

branch
eric7
changeset 8994
3bebd76dc6ea
parent 8972
54816b8f740f
child 9001
a00cd6b55728
equal deleted inserted replaced
8993:d91e674d200c 8994:3bebd76dc6ea
9 9
10 This process must be performed while eric is closed. The script will upgrade 10 This process must be performed while eric is closed. The script will upgrade
11 the requested packages and will restart eric. 11 the requested packages and will restart eric.
12 """ 12 """
13 13
14 import contextlib
14 import subprocess 15 import subprocess
15 import sys 16 import sys
16 import time 17 import time
17 18
18 19
55 56
56 def main(): 57 def main():
57 """ 58 """
58 Main entry point into the upgrader. 59 Main entry point into the upgrader.
59 """ 60 """
60 # wait a few seconds to give eric the chance to fully shut down
61 time.sleep(2)
62
63 try: 61 try:
64 ddindex = sys.argv.index("--") 62 ddindex = sys.argv.index("--")
65 except ValueError: 63 except ValueError:
66 # '--' was not found. Start eric with all parameters given. 64 # '--' was not found. Start eric with all parameters given.
67 ddindex = 1 65 ddindex = 1
71 # create default start arguments 69 # create default start arguments
72 ericStartArgs = ["-m", "eric7", "--start-session"] 70 ericStartArgs = ["-m", "eric7", "--start-session"]
73 71
74 upgraderArgs = sys.argv[1:ddindex] 72 upgraderArgs = sys.argv[1:ddindex]
75 73
74 upgradeType = ""
75 upgradeDelay = 2
76
77 for arg in upgraderArgs:
78 if arg.startswith("--delay="):
79 with contextlib.suppress(ValueError):
80 upgradeDelay = int(arg.split("=")[1].strip())
81 elif arg.startswith("--type="):
82 upgradeType=arg.split("=")[1].strip()
83
84 # wait a few seconds to give eric the chance to fully shut down
85 time.sleep(upgradeDelay)
86
76 # now perform the upgrade and start eric, if it was successful 87 # now perform the upgrade and start eric, if it was successful
77 if upgraderArgs[0] == "--pyqt": 88 if upgradeType == "pyqt":
78 ok = doUpgrade(_pyqtPackages) 89 ok = doUpgrade(_pyqtPackages)
79 elif upgraderArgs[0] == "--eric": 90 elif upgradeType == "eric":
80 ok = doUpgrade(_ericPackages) 91 ok = doUpgrade(_ericPackages)
81 elif upgraderArgs[0] == "--ericpyqt": 92 elif upgradeType == "ericpyqt":
82 ok = doUpgrade(_ericPackages + _pyqtPackages) 93 ok = doUpgrade(_ericPackages + _pyqtPackages)
83 else: 94 else:
84 ok = False 95 ok = False
85 96
86 if ok: 97 if ok:

eric ide

mercurial