uninstall.py

changeset 3670
f0cb7579c0b4
parent 3621
15f23ed3f216
child 3678
2866383fd342
equal deleted inserted replaced
3669:ac84ac3c0f05 3670:f0cb7579c0b4
1 #!/usr/bin/env python3 1 #!/usr/bin/env python3
2 # -*- coding: utf-8 -*- 2 # -*- coding: utf-8 -*-
3 3
4 # Copyright (c) 2002 - 2014 Detlev Offenbach <detlev@die-offenbachs.de> 4 # Copyright (c) 2002 - 2014 Detlev Offenbach <detlev@die-offenbachs.de>
5 # 5 #
6 # This is the uninstall script for eric5. 6 # This is the uninstall script for eric6.
7 7
8 """ 8 """
9 Uninstallation script for the eric5 IDE and all eric5 related tools. 9 Uninstallation script for the eric6 IDE and all eric6 related tools.
10 """ 10 """
11 11
12 from __future__ import unicode_literals 12 from __future__ import unicode_literals
13 13
14 import sys 14 import sys
15 import os 15 import os
16 import shutil 16 import shutil
17 import glob 17 import glob
18 import distutils.sysconfig 18 import distutils.sysconfig
19 19
20 # get a local eric5config.py out of the way 20 # get a local eric6config.py out of the way
21 if os.path.exists("eric5config.py"): 21 if os.path.exists("eric6config.py"):
22 os.rename("eric5config.py", "eric5config.py.orig") 22 os.rename("eric6config.py", "eric6config.py.orig")
23 from eric5config import getConfig 23 from eric6config import getConfig
24 24
25 # Define the globals. 25 # Define the globals.
26 progName = None 26 progName = None
27 pyModDir = None 27 pyModDir = None
28 progLanguages = ["Python", "Ruby", "QSS"] 28 progLanguages = ["Python", "Ruby", "QSS"]
39 """ 39 """
40 Exit the uninstall script. 40 Exit the uninstall script.
41 41
42 @param rcode result code to report back (integer) 42 @param rcode result code to report back (integer)
43 """ 43 """
44 # restore the local eric5config.py 44 # restore the local eric6config.py
45 if os.path.exists("eric5config.py.orig"): 45 if os.path.exists("eric6config.py.orig"):
46 if os.path.exists("eric5config.py"): 46 if os.path.exists("eric6config.py"):
47 os.remove("eric5config.py") 47 os.remove("eric6config.py")
48 os.rename("eric5config.py.orig", "eric5config.py") 48 os.rename("eric6config.py.orig", "eric6config.py")
49 49
50 50
51 def usage(rcode=2): 51 def usage(rcode=2):
52 """ 52 """
53 Display a usage message and exit. 53 Display a usage message and exit.
97 global pyModDir 97 global pyModDir
98 98
99 # Remove the menu entry for Linux systems 99 # Remove the menu entry for Linux systems
100 if sys.platform.startswith("linux"): 100 if sys.platform.startswith("linux"):
101 for name in ["/usr/share/pixmaps/eric.png", 101 for name in ["/usr/share/pixmaps/eric.png",
102 "/usr/share/applications/eric5.desktop", 102 "/usr/share/applications/eric6.desktop",
103 "/usr/share/pixmaps/ericWeb.png", 103 "/usr/share/pixmaps/ericWeb.png",
104 "/usr/share/applications/eric5_webbrowser.desktop"]: 104 "/usr/share/applications/eric6_webbrowser.desktop"]:
105 if os.path.exists(name): 105 if os.path.exists(name):
106 os.remove(name) 106 os.remove(name)
107 107
108 # Remove the wrapper scripts 108 # Remove the wrapper scripts
109 rem_wnames = [ 109 rem_wnames = [
110 "eric5-api", "eric5-compare", 110 "eric6-api", "eric6-compare",
111 "eric5-configure", "eric5-diff", 111 "eric6-configure", "eric6-diff",
112 "eric5-doc", 112 "eric6-doc",
113 "eric5-qregexp", "eric5-re", 113 "eric6-qregexp", "eric6-re",
114 "eric5-trpreviewer", "eric5-uipreviewer", 114 "eric6-trpreviewer", "eric6-uipreviewer",
115 "eric5-unittest", "eric5", 115 "eric6-unittest", "eric6",
116 "eric5-tray", "eric5-editor", 116 "eric6-tray", "eric6-editor",
117 "eric5-plugininstall", "eric5-pluginuninstall", 117 "eric6-plugininstall", "eric6-pluginuninstall",
118 "eric5-pluginrepository", "eric5-sqlbrowser", 118 "eric6-pluginrepository", "eric6-sqlbrowser",
119 "eric5-webbrowser", "eric5-iconeditor", 119 "eric6-webbrowser", "eric6-iconeditor",
120 ] 120 ]
121 rem_wnames2 = [ 121 rem_wnames2 = [
122 "eric5_api", "eric5_compare", 122 "eric6_api", "eric6_compare",
123 "eric5_configure", "eric5_diff", 123 "eric6_configure", "eric6_diff",
124 "eric5_doc", "eric5_qregularexpression", 124 "eric6_doc", "eric6_qregularexpression",
125 "eric5_qregexp", "eric5_re", 125 "eric6_qregexp", "eric6_re",
126 "eric5_trpreviewer", "eric5_uipreviewer", 126 "eric6_trpreviewer", "eric6_uipreviewer",
127 "eric5_unittest", "eric5", 127 "eric6_unittest", "eric6",
128 "eric5_tray", "eric5_editor", 128 "eric6_tray", "eric6_editor",
129 "eric5_plugininstall", "eric5_pluginuninstall", 129 "eric6_plugininstall", "eric6_pluginuninstall",
130 "eric5_pluginrepository", "eric5_sqlbrowser", 130 "eric6_pluginrepository", "eric6_sqlbrowser",
131 "eric5_webbrowser", "eric5_iconeditor", 131 "eric6_webbrowser", "eric6_iconeditor",
132 "eric5_snap", 132 "eric6_snap",
133 ] 133 ]
134 if includePythonVariant: 134 if includePythonVariant:
135 marker = PythonMarkers[sys.version_info.major] 135 marker = PythonMarkers[sys.version_info.major]
136 rem_wnames.extend([n + marker for n in rem_wnames2]) 136 rem_wnames.extend([n + marker for n in rem_wnames2])
137 else: 137 else:
142 rwname = wrapperName(getConfig('bindir'), rem_wname) 142 rwname = wrapperName(getConfig('bindir'), rem_wname)
143 if os.path.exists(rwname): 143 if os.path.exists(rwname):
144 os.remove(rwname) 144 os.remove(rwname)
145 145
146 # Cleanup our config file(s) 146 # Cleanup our config file(s)
147 for name in ['eric5config.py', 'eric5config.pyc', 'eric5.pth']: 147 for name in ['eric6config.py', 'eric6config.pyc', 'eric6.pth']:
148 e5cfile = os.path.join(pyModDir, name) 148 e5cfile = os.path.join(pyModDir, name)
149 if os.path.exists(e5cfile): 149 if os.path.exists(e5cfile):
150 os.remove(e5cfile) 150 os.remove(e5cfile)
151 e5cfile = os.path.join(pyModDir, "__pycache__", name) 151 e5cfile = os.path.join(pyModDir, "__pycache__", name)
152 path, ext = os.path.splitext(e5cfile) 152 path, ext = os.path.splitext(e5cfile)
162 if os.path.exists(dirpath): 162 if os.path.exists(dirpath):
163 shutil.rmtree(dirpath, True) 163 shutil.rmtree(dirpath, True)
164 164
165 # Cleanup translations 165 # Cleanup translations
166 for name in glob.glob( 166 for name in glob.glob(
167 os.path.join(getConfig('ericTranslationsDir'), 'eric5_*.qm')): 167 os.path.join(getConfig('ericTranslationsDir'), 'eric6_*.qm')):
168 if os.path.exists(name): 168 if os.path.exists(name):
169 os.remove(name) 169 os.remove(name)
170 170
171 # Cleanup API files 171 # Cleanup API files
172 apidir = getConfig('apidir') 172 apidir = getConfig('apidir')
179 os.path.join(apidir, progLanguage.lower(), "*.bas")): 179 os.path.join(apidir, progLanguage.lower(), "*.bas")):
180 os.remove(apiname) 180 os.remove(apiname)
181 181
182 if sys.platform == "darwin": 182 if sys.platform == "darwin":
183 # delete the Mac app bundle 183 # delete the Mac app bundle
184 if os.path.exists("/Developer/Applications/Eric5"): 184 if os.path.exists("/Developer/Applications/Eric6"):
185 shutil.rmtree("/Developer/Applications/Eric5") 185 shutil.rmtree("/Developer/Applications/Eric6")
186 try: 186 try:
187 macAppBundlePath = getConfig("macAppBundlePath") 187 macAppBundlePath = getConfig("macAppBundlePath")
188 macAppBundleName = getConfig("macAppBundleName") 188 macAppBundleName = getConfig("macAppBundleName")
189 except AttributeError: 189 except AttributeError:
190 macAppBundlePath = "/Applications" 190 macAppBundlePath = "/Applications"
191 macAppBundleName = "eric5.app" 191 macAppBundleName = "eric6.app"
192 if os.path.exists("/Applications/" + macAppBundleName): 192 if os.path.exists("/Applications/" + macAppBundleName):
193 shutil.rmtree("/Applications/" + macAppBundleName) 193 shutil.rmtree("/Applications/" + macAppBundleName)
194 bundlePath = os.path.join(macAppBundlePath, macAppBundleName) 194 bundlePath = os.path.join(macAppBundlePath, macAppBundleName)
195 if os.path.exists(bundlePath): 195 if os.path.exists(bundlePath):
196 shutil.rmtree(bundlePath) 196 shutil.rmtree(bundlePath)
248 raise 248 raise
249 except: 249 except:
250 print("""An internal error occured. Please report all the output of""" 250 print("""An internal error occured. Please report all the output of"""
251 """ the program,\n""" 251 """ the program,\n"""
252 """including the following traceback, to""" 252 """including the following traceback, to"""
253 """ eric5-bugs@eric-ide.python-projects.org.\n""") 253 """ eric-bugs@eric-ide.python-projects.org.\n""")
254 raise 254 raise

eric ide

mercurial