scripts/uninstall.py

branch
eric7-maintenance
changeset 10460
3b34efa2857c
parent 10349
df7edc29cbfb
parent 10439
21c28b0f9e41
child 10534
783d835d7fe4
equal deleted inserted replaced
10366:411df92e881f 10460:3b34efa2857c
1 #!/usr/bin/env python3 1 #!/usr/bin/env python3
2 # -*- coding: utf-8 -*- 2 # -*- coding: utf-8 -*-
3 3
4 # Copyright (c) 2002 - 2023 Detlev Offenbach <detlev@die-offenbachs.de> 4 # Copyright (c) 2002 - 2024 Detlev Offenbach <detlev@die-offenbachs.de>
5 # 5 #
6 # This is the uninstall script for eric. 6 # This is the uninstall script for eric.
7 # 7 #
8 8
9 """ 9 """
32 32
33 def exit(rcode=0): 33 def exit(rcode=0):
34 """ 34 """
35 Exit the uninstall script. 35 Exit the uninstall script.
36 36
37 @param rcode result code to report back (integer) 37 @param rcode result code to report back
38 @type int
38 """ 39 """
39 global currDir 40 global currDir
40 41
41 # restore the local eric7config.py 42 # restore the local eric7config.py
42 if os.path.exists("eric7config.py.orig"): 43 if os.path.exists("eric7config.py.orig"):
88 def wrapperNames(dname, wfile): 89 def wrapperNames(dname, wfile):
89 """ 90 """
90 Create the platform specific names for the wrapper script. 91 Create the platform specific names for the wrapper script.
91 92
92 @param dname name of the directory to place the wrapper into 93 @param dname name of the directory to place the wrapper into
94 @type str
93 @param wfile basename (without extension) of the wrapper script 95 @param wfile basename (without extension) of the wrapper script
94 @return the names of the wrapper scripts 96 @type str
97 @return list of names of the wrapper scripts
98 @rtype list of str
95 """ 99 """
96 wnames = ( 100 wnames = (
97 (dname + "\\" + wfile + ".cmd", dname + "\\" + wfile + ".bat") 101 [dname + "\\" + wfile + ".cmd", dname + "\\" + wfile + ".bat"]
98 if sys.platform.startswith(("win", "cygwin")) 102 if sys.platform.startswith(("win", "cygwin"))
99 else (dname + "/" + wfile,) 103 else [dname + "/" + wfile]
100 ) 104 )
101 105
102 return wnames 106 return wnames
103 107
104 108
179 "ericDir", 183 "ericDir",
180 ]: 184 ]:
181 with contextlib.suppress(AttributeError): 185 with contextlib.suppress(AttributeError):
182 dirpath = getConfig(name) 186 dirpath = getConfig(name)
183 if os.path.exists(dirpath): 187 if os.path.exists(dirpath):
184 shutil.rmtree(dirpath, True) 188 shutil.rmtree(dirpath, ignore_errors=True)
185 189
186 # Cleanup translations 190 # Cleanup translations
187 for name in glob.glob( 191 for name in glob.glob(
188 os.path.join(getConfig("ericTranslationsDir"), "eric7_*.qm") 192 os.path.join(getConfig("ericTranslationsDir"), "eric7_*.qm")
189 ): 193 ):
241 if importlib.util.find_spec("pywintypes") is None: 245 if importlib.util.find_spec("pywintypes") is None:
242 # links were not created by install.py 246 # links were not created by install.py
243 return 247 return
244 248
245 regPath = ( 249 regPath = (
246 "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer" 250 "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders"
247 + "\\User Shell Folders"
248 ) 251 )
249 252
250 # 1. cleanup desktop links 253 # 1. cleanup desktop links
251 regName = "Desktop" 254 regName = "Desktop"
252 desktopEntry = getWinregEntry(regName, regPath) 255 desktopEntry = getWinregEntry(regName, regPath)
410 413
411 def getConfigDir(): 414 def getConfigDir():
412 """ 415 """
413 Module function to get the name of the directory storing the config data. 416 Module function to get the name of the directory storing the config data.
414 417
415 @return directory name of the config dir (string) 418 @return directory name of the config dir
419 @rtype str
416 """ 420 """
417 cdn = ".eric7" 421 cdn = ".eric7"
418 return os.path.join(os.path.expanduser("~"), cdn) 422 return os.path.join(os.path.expanduser("~"), cdn)
419 423
420 424
425 @param name variable name 429 @param name variable name
426 @type str 430 @type str
427 @param path registry path of the variable 431 @param path registry path of the variable
428 @type str 432 @type str
429 @return value of requested registry variable 433 @return value of requested registry variable
430 @rtype any 434 @rtype Any
431 """ 435 """
432 # From http://stackoverflow.com/a/35286642 436 # From http://stackoverflow.com/a/35286642
433 import winreg # __IGNORE_WARNING_I103__ 437 import winreg # __IGNORE_WARNING_I103__
434 438
435 try: 439 try:

eric ide

mercurial