eric7/UI/upgrader.py

branch
eric7
changeset 8972
54816b8f740f
parent 8970
188ff9ce8657
child 8994
3bebd76dc6ea
equal deleted inserted replaced
8971:0a846d71f27c 8972:54816b8f740f
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 os
15 import subprocess 14 import subprocess
16 import sys 15 import sys
17 import time 16 import time
18 17
19 from eric7config import getConfig 18
19 _pyqtPackages = [
20 "pyqt6", "pyqt6-sip", "pyqt6-webengine", "pyqt6-charts",
21 "pyqt6-qscintilla", "pyqt6-qt6", "pyqt6-webengine-qt6",
22 "pyqt6-charts-qt6"
23 ]
24 _ericPackages = ["eric-ide"]
20 25
21 26
22 def upgradePyQt(): 27 def doUpgrade(packages):
23 """ 28 """
24 Function to upgrade the PyQt packages via pip. 29 Function to upgrade the given packages via pip.
25 30
26 @return flag indicating a successful installation 31 @param packages list of packages to be upgraded
27 @rtype bool 32 @type list of str
28 """
29 pyqtPackages = [
30 "pyqt6", "pyqt6-sip", "pyqt6-webengine", "pyqt6-charts",
31 "pyqt6-qscintilla", "pyqt6-qt6", "pyqt6-webengine-qt6",
32 "pyqt6-charts-qt6"
33 ]
34
35 exitCode = subprocess.run( # secok
36 [sys.executable, "-m", "pip", "install", "--prefer-binary",
37 "--upgrade"] + pyqtPackages
38 ).returncode
39 ok = (exitCode == 0)
40
41 return ok
42
43
44 def upgradeEric():
45 """
46 Function to upgrade the eric-ide package via pip.
47
48 @return flag indicating a successful installation 33 @return flag indicating a successful installation
49 @rtype bool 34 @rtype bool
50 """ 35 """
51 exitCode = subprocess.run( # secok 36 exitCode = subprocess.run( # secok
52 [sys.executable, "-m", "pip", "install", "--prefer-binary", 37 [sys.executable, "-m", "pip", "install", "--prefer-binary",
53 "--upgrade", "eric-ide"] 38 "--upgrade"] + packages
54 ).returncode 39 ).returncode
55 ok = (exitCode == 0) 40 ok = (exitCode == 0)
56 41
57 return ok 42 return ok
58 43
82 ddindex = 1 67 ddindex = 1
83 68
84 ericStartArgs = sys.argv[ddindex + 1:] 69 ericStartArgs = sys.argv[ddindex + 1:]
85 if not ericStartArgs: 70 if not ericStartArgs:
86 # create default start arguments 71 # create default start arguments
87 ericStartArgs = [ 72 ericStartArgs = ["-m", "eric7", "--start-session"]
88 os.path.join(getConfig("ericDir"), "eric7.py"),
89 "--start-session",
90 ]
91 73
92 upgraderArgs = sys.argv[1:ddindex] 74 upgraderArgs = sys.argv[1:ddindex]
93 75
94 # now perform the upgrade and start eric, if it was successful 76 # now perform the upgrade and start eric, if it was successful
95 if upgraderArgs[0] == "--pyqt": 77 if upgraderArgs[0] == "--pyqt":
96 ok = upgradePyQt() 78 ok = doUpgrade(_pyqtPackages)
97 elif upgraderArgs[0] == "--eric": 79 elif upgraderArgs[0] == "--eric":
98 ok = upgradeEric() 80 ok = doUpgrade(_ericPackages)
81 elif upgraderArgs[0] == "--ericpyqt":
82 ok = doUpgrade(_ericPackages + _pyqtPackages)
99 else: 83 else:
100 ok = False 84 ok = False
101 85
102 if ok: 86 if ok:
103 startEric(ericStartArgs) 87 startEric(ericStartArgs)

eric ide

mercurial