scripts/uninstall.py

Sat, 06 Apr 2024 12:50:04 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 06 Apr 2024 12:50:04 +0200
branch
eric7
changeset 10667
a82709c26b19
parent 10518
1682f3203ae5
child 10694
f46c1e224e8a
child 10864
8917b1a45546
permissions
-rw-r--r--

Corrected the uninstallation script for Windows.

12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
1 #!/usr/bin/env python3
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2 # -*- coding: utf-8 -*-
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
3
10439
21c28b0f9e41 Updated copyright for 2024.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10420
diff changeset
4 # Copyright (c) 2002 - 2024 Detlev Offenbach <detlev@die-offenbachs.de>
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
5 #
7960
e8fc383322f7 Harmonized some user visible strings and changed the term 'eric6' to the more generic 'eric'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
6 # This is the uninstall script for eric.
4561
5bc6ed226471 Extended the uninstall script to remove the plug-ins directories, the data directory and the configuration directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4559
diff changeset
7 #
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
8
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
9 """
7960
e8fc383322f7 Harmonized some user visible strings and changed the term 'eric6' to the more generic 'eric'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
10 Uninstallation script for the eric IDE and all eric related tools.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
11 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
12
10300
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
13 import argparse
8501
7b5f10581c35 Removed the support for the deprecated distutils package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8339
diff changeset
14 import contextlib
7b5f10581c35 Removed the support for the deprecated distutils package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8339
diff changeset
15 import glob
10496
f9925e08dbce Changed some import statements for 'importlib' to 'importlib.util' because sometimes the first doesn't work properly (reason unknown but somewhere in the interpreter).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10439
diff changeset
16 import importlib.util
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
17 import os
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
18 import shutil
8501
7b5f10581c35 Removed the support for the deprecated distutils package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8339
diff changeset
19 import sys
7b5f10581c35 Removed the support for the deprecated distutils package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8339
diff changeset
20 import sysconfig
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
21
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
22 # Define the globals.
5433
e1c50b88fc43 Little fix for the uninstall script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
23 currDir = os.getcwd()
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
24 pyModDir = None
9361
718bc86e1c3f Changed the handling of 'installed API files' a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9328
diff changeset
25 progLanguages = ["MicroPython", "Python3", "QSS"]
8314
e3642a6a1e71 Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8260
diff changeset
26 defaultMacAppBundleName = "eric7.app"
10264
f06151820839 Corrected the recent change to the install and uninstall scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10261
diff changeset
27 defaultMacAppBundlePath = "/Applications"
f06151820839 Corrected the recent change to the install and uninstall scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10261
diff changeset
28 defaultMacUserAppBundlePath = os.path.expanduser("~/Applications")
8339
75908476226e Prepared the install and uninstall scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8318
diff changeset
29 settingsNameOrganization = "Eric7"
8314
e3642a6a1e71 Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8260
diff changeset
30 settingsNameGlobal = "eric7"
3597
137370f7114b Added the '-y' switch to the install script to allow to install Python2 and Python3 variants of eric5 in parallel by giving the startup script a '_py2' or '_py3' postfix.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3515
diff changeset
31
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 908
diff changeset
32
2654
df2c3218cc5e Fixed an issue uninstalling eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2383
diff changeset
33 def exit(rcode=0):
df2c3218cc5e Fixed an issue uninstalling eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2383
diff changeset
34 """
df2c3218cc5e Fixed an issue uninstalling eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2383
diff changeset
35 Exit the uninstall script.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9108
diff changeset
36
10420
5ac83a87954d Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10417
diff changeset
37 @param rcode result code to report back
5ac83a87954d Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10417
diff changeset
38 @type int
2654
df2c3218cc5e Fixed an issue uninstalling eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2383
diff changeset
39 """
5055
7db1b9496e52 Some enhancements to the install and uninstall scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4806
diff changeset
40 global currDir
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9108
diff changeset
41
8314
e3642a6a1e71 Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8260
diff changeset
42 # restore the local eric7config.py
e3642a6a1e71 Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8260
diff changeset
43 if os.path.exists("eric7config.py.orig"):
e3642a6a1e71 Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8260
diff changeset
44 if os.path.exists("eric7config.py"):
e3642a6a1e71 Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8260
diff changeset
45 os.remove("eric7config.py")
e3642a6a1e71 Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8260
diff changeset
46 os.rename("eric7config.py.orig", "eric7config.py")
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9108
diff changeset
47
6509
884182bfd25c install, uninstall: started to add capability to generate Desktop and Start Menu entries on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6500
diff changeset
48 if sys.platform.startswith(("win", "cygwin")):
9328
49a0a9cb2505 Fixed some code style issues detected by the new checks.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9221
diff changeset
49 with contextlib.suppress(EOFError):
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9108
diff changeset
50 input("Press enter to continue...") # secok
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9108
diff changeset
51
5055
7db1b9496e52 Some enhancements to the install and uninstall scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4806
diff changeset
52 os.chdir(currDir)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9108
diff changeset
53
5055
7db1b9496e52 Some enhancements to the install and uninstall scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4806
diff changeset
54 sys.exit(rcode)
2654
df2c3218cc5e Fixed an issue uninstalling eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2383
diff changeset
55
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9108
diff changeset
56
8314
e3642a6a1e71 Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8260
diff changeset
57 # get a local eric7config.py out of the way
e3642a6a1e71 Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8260
diff changeset
58 if os.path.exists("eric7config.py"):
e3642a6a1e71 Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8260
diff changeset
59 os.rename("eric7config.py", "eric7config.py.orig")
7211
1c97f3142fa8 install/uninstall: implemented code to cope with the situation that the names contained in the eric6config.py file were generated with a non-utf8 encoding.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7203
diff changeset
60 try:
9448
ea215f7afab3 Fixed an issue importing the eric7config module.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9381
diff changeset
61 from eric7.Globals import getConfig
7211
1c97f3142fa8 install/uninstall: implemented code to cope with the situation that the names contained in the eric6config.py file were generated with a non-utf8 encoding.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7203
diff changeset
62 except ImportError:
7960
e8fc383322f7 Harmonized some user visible strings and changed the term 'eric6' to the more generic 'eric'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
63 print("The eric IDE doesn't seem to be installed. Aborting.")
7211
1c97f3142fa8 install/uninstall: implemented code to cope with the situation that the names contained in the eric6config.py file were generated with a non-utf8 encoding.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7203
diff changeset
64 exit(1)
1c97f3142fa8 install/uninstall: implemented code to cope with the situation that the names contained in the eric6config.py file were generated with a non-utf8 encoding.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7203
diff changeset
65 except SyntaxError:
1c97f3142fa8 install/uninstall: implemented code to cope with the situation that the names contained in the eric6config.py file were generated with a non-utf8 encoding.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7203
diff changeset
66 # an incomplete or old config file was found
7960
e8fc383322f7 Harmonized some user visible strings and changed the term 'eric6' to the more generic 'eric'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
67 print("The eric IDE seems to be installed incompletely. Aborting.")
7211
1c97f3142fa8 install/uninstall: implemented code to cope with the situation that the names contained in the eric6config.py file were generated with a non-utf8 encoding.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7203
diff changeset
68 exit(1)
1c97f3142fa8 install/uninstall: implemented code to cope with the situation that the names contained in the eric6config.py file were generated with a non-utf8 encoding.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7203
diff changeset
69
2654
df2c3218cc5e Fixed an issue uninstalling eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2383
diff changeset
70
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
71 def initGlobals():
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
72 """
2965
d133c7edd88a Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2736
diff changeset
73 Set the values of globals that need more than a simple assignment.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
74 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
75 global pyModDir
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
76
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9108
diff changeset
77 pyModDir = sysconfig.get_path("platlib")
10091
ac6edcfe7831 Corrected the install and uninstall scripts to cope use the user site-packages if a global install without admin rights is done.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10084
diff changeset
78 if not os.access(pyModDir, os.W_OK):
ac6edcfe7831 Corrected the install and uninstall scripts to cope use the user site-packages if a global install without admin rights is done.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10084
diff changeset
79 # can't write to the standard path, use the 'user' path instead
ac6edcfe7831 Corrected the install and uninstall scripts to cope use the user site-packages if a global install without admin rights is done.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10084
diff changeset
80 if sys.platform.startswith(("win", "cygwin")):
ac6edcfe7831 Corrected the install and uninstall scripts to cope use the user site-packages if a global install without admin rights is done.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10084
diff changeset
81 scheme = "nt_user"
ac6edcfe7831 Corrected the install and uninstall scripts to cope use the user site-packages if a global install without admin rights is done.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10084
diff changeset
82 elif sys.platform == "darwin":
ac6edcfe7831 Corrected the install and uninstall scripts to cope use the user site-packages if a global install without admin rights is done.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10084
diff changeset
83 scheme = "osx_framework_user"
ac6edcfe7831 Corrected the install and uninstall scripts to cope use the user site-packages if a global install without admin rights is done.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10084
diff changeset
84 else:
ac6edcfe7831 Corrected the install and uninstall scripts to cope use the user site-packages if a global install without admin rights is done.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10084
diff changeset
85 scheme = "posix_user"
ac6edcfe7831 Corrected the install and uninstall scripts to cope use the user site-packages if a global install without admin rights is done.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10084
diff changeset
86 pyModDir = sysconfig.get_path("platlib", scheme)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
87
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
88
6495
6e73d31af3af Changed the extension of the generated script files for Windows from '.bat' to '.cmd'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6365
diff changeset
89 def wrapperNames(dname, wfile):
2965
d133c7edd88a Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2736
diff changeset
90 """
6495
6e73d31af3af Changed the extension of the generated script files for Windows from '.bat' to '.cmd'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6365
diff changeset
91 Create the platform specific names for the wrapper script.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9108
diff changeset
92
3019
7912530a33e2 Fixed a few documentation strings that got broken while doing the line shortening job. That concludes the later.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2992
diff changeset
93 @param dname name of the directory to place the wrapper into
10420
5ac83a87954d Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10417
diff changeset
94 @type str
3019
7912530a33e2 Fixed a few documentation strings that got broken while doing the line shortening job. That concludes the later.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2992
diff changeset
95 @param wfile basename (without extension) of the wrapper script
10420
5ac83a87954d Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10417
diff changeset
96 @type str
5ac83a87954d Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10417
diff changeset
97 @return list of names of the wrapper scripts
5ac83a87954d Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10417
diff changeset
98 @rtype list of str
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
99 """
8260
2161475d9639 Applied some more code simplifications suggested by the new Simplify checker (Y108: use ternary operator).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8254
diff changeset
100 wnames = (
10420
5ac83a87954d Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10417
diff changeset
101 [dname + "\\" + wfile + ".cmd", dname + "\\" + wfile + ".bat"]
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9108
diff changeset
102 if sys.platform.startswith(("win", "cygwin"))
10420
5ac83a87954d Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10417
diff changeset
103 else [dname + "/" + wfile]
8260
2161475d9639 Applied some more code simplifications suggested by the new Simplify checker (Y108: use ternary operator).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8254
diff changeset
104 )
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
105
6495
6e73d31af3af Changed the extension of the generated script files for Windows from '.bat' to '.cmd'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6365
diff changeset
106 return wnames
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
107
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
108
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
109 def uninstallEric():
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
110 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
111 Uninstall the eric files.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
112 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
113 global pyModDir
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9108
diff changeset
114
146
afeb742e7148 Added installation of a .desktop file for Linux systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 107
diff changeset
115 # Remove the menu entry for Linux systems
10334
24300d16a154 General
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10331
diff changeset
116 if sys.platform.startswith(("linux", "freebsd")):
6500
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
117 uninstallLinuxSpecifics()
6509
884182bfd25c install, uninstall: started to add capability to generate Desktop and Start Menu entries on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6500
diff changeset
118 # Remove the Desktop and Start Menu entries for Windows systems
884182bfd25c install, uninstall: started to add capability to generate Desktop and Start Menu entries on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6500
diff changeset
119 elif sys.platform.startswith(("win", "cygwin")):
884182bfd25c install, uninstall: started to add capability to generate Desktop and Start Menu entries on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6500
diff changeset
120 uninstallWindowsLinks()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9108
diff changeset
121
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
122 # Remove the wrapper scripts
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
123 rem_wnames = [
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9108
diff changeset
124 "eric7_api",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9108
diff changeset
125 "eric7_browser",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9108
diff changeset
126 "eric7_compare",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9108
diff changeset
127 "eric7_configure",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9108
diff changeset
128 "eric7_diff",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9108
diff changeset
129 "eric7_doc",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9108
diff changeset
130 "eric7_editor",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9108
diff changeset
131 "eric7_hexeditor",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9108
diff changeset
132 "eric7_iconeditor",
9380
3d662dda80e8 Fixed some issues installing eric7 on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9361
diff changeset
133 "eric7_ide",
10518
1682f3203ae5 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10496
diff changeset
134 "eric7_mpy",
9697
cdaa3cc805f7 Started implementing a PDF viewer tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9653
diff changeset
135 "eric7_pdf",
10084
125166c6b66c pip Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9697
diff changeset
136 "eric7_pip",
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9108
diff changeset
137 "eric7_plugininstall",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9108
diff changeset
138 "eric7_pluginrepository",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9108
diff changeset
139 "eric7_pluginuninstall",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9108
diff changeset
140 "eric7_qregularexpression",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9108
diff changeset
141 "eric7_re",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9108
diff changeset
142 "eric7_shell",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9108
diff changeset
143 "eric7_snap",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9108
diff changeset
144 "eric7_sqlbrowser",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9108
diff changeset
145 "eric7_testing",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9108
diff changeset
146 "eric7_tray",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9108
diff changeset
147 "eric7_trpreviewer",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9108
diff changeset
148 "eric7_uipreviewer",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9108
diff changeset
149 "eric7_virtualenv",
9066
a219ade50f7c Performed some refactoring to avoid possible name clashes on case-insensitive systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8881
diff changeset
150 # obsolete scripts below
a219ade50f7c Performed some refactoring to avoid possible name clashes on case-insensitive systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8881
diff changeset
151 "eric7_unittest",
9380
3d662dda80e8 Fixed some issues installing eric7 on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9361
diff changeset
152 "eric7",
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
153 ]
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9108
diff changeset
154
3597
137370f7114b Added the '-y' switch to the install script to allow to install Python2 and Python3 variants of eric5 in parallel by giving the startup script a '_py2' or '_py3' postfix.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3515
diff changeset
155 try:
137370f7114b Added the '-y' switch to the install script to allow to install Python2 and Python3 variants of eric5 in parallel by giving the startup script a '_py2' or '_py3' postfix.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3515
diff changeset
156 for rem_wname in rem_wnames:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9108
diff changeset
157 for rwname in wrapperNames(getConfig("bindir"), rem_wname):
6495
6e73d31af3af Changed the extension of the generated script files for Windows from '.bat' to '.cmd'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6365
diff changeset
158 if os.path.exists(rwname):
6e73d31af3af Changed the extension of the generated script files for Windows from '.bat' to '.cmd'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6365
diff changeset
159 os.remove(rwname)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9108
diff changeset
160
3597
137370f7114b Added the '-y' switch to the install script to allow to install Python2 and Python3 variants of eric5 in parallel by giving the startup script a '_py2' or '_py3' postfix.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3515
diff changeset
161 # Cleanup our config file(s)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9108
diff changeset
162 for name in ["eric7config.py", "eric7config.pyc", "eric7.pth"]:
3597
137370f7114b Added the '-y' switch to the install script to allow to install Python2 and Python3 variants of eric5 in parallel by giving the startup script a '_py2' or '_py3' postfix.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3515
diff changeset
163 e5cfile = os.path.join(pyModDir, name)
137370f7114b Added the '-y' switch to the install script to allow to install Python2 and Python3 variants of eric5 in parallel by giving the startup script a '_py2' or '_py3' postfix.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3515
diff changeset
164 if os.path.exists(e5cfile):
137370f7114b Added the '-y' switch to the install script to allow to install Python2 and Python3 variants of eric5 in parallel by giving the startup script a '_py2' or '_py3' postfix.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3515
diff changeset
165 os.remove(e5cfile)
137370f7114b Added the '-y' switch to the install script to allow to install Python2 and Python3 variants of eric5 in parallel by giving the startup script a '_py2' or '_py3' postfix.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3515
diff changeset
166 e5cfile = os.path.join(pyModDir, "__pycache__", name)
137370f7114b Added the '-y' switch to the install script to allow to install Python2 and Python3 variants of eric5 in parallel by giving the startup script a '_py2' or '_py3' postfix.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3515
diff changeset
167 path, ext = os.path.splitext(e5cfile)
137370f7114b Added the '-y' switch to the install script to allow to install Python2 and Python3 variants of eric5 in parallel by giving the startup script a '_py2' or '_py3' postfix.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3515
diff changeset
168 for f in glob.glob("{0}.*{1}".format(path, ext)):
137370f7114b Added the '-y' switch to the install script to allow to install Python2 and Python3 variants of eric5 in parallel by giving the startup script a '_py2' or '_py3' postfix.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3515
diff changeset
169 os.remove(f)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9108
diff changeset
170
3597
137370f7114b Added the '-y' switch to the install script to allow to install Python2 and Python3 variants of eric5 in parallel by giving the startup script a '_py2' or '_py3' postfix.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3515
diff changeset
171 # Cleanup the install directories
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9108
diff changeset
172 for name in [
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9108
diff changeset
173 "ericExamplesDir",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9108
diff changeset
174 "ericDocDir",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9108
diff changeset
175 "ericDTDDir",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9108
diff changeset
176 "ericCSSDir",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9108
diff changeset
177 "ericIconDir",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9108
diff changeset
178 "ericPixDir",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9108
diff changeset
179 "ericTemplatesDir",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9108
diff changeset
180 "ericCodeTemplatesDir",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9108
diff changeset
181 "ericOthersDir",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9108
diff changeset
182 "ericStylesDir",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9108
diff changeset
183 "ericThemesDir",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9108
diff changeset
184 "ericDir",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9108
diff changeset
185 ]:
8821
0485c183b718 Ignore unknown configuration keys during cleanup of install.py and uninstall.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8820
diff changeset
186 with contextlib.suppress(AttributeError):
0485c183b718 Ignore unknown configuration keys during cleanup of install.py and uninstall.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8820
diff changeset
187 dirpath = getConfig(name)
0485c183b718 Ignore unknown configuration keys during cleanup of install.py and uninstall.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8820
diff changeset
188 if os.path.exists(dirpath):
10403
ea3320d5e8e9 Changed code using "shutil.rmtree()" more readable by adding "ignore_errors=" where this parameter is non-default.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10372
diff changeset
189 shutil.rmtree(dirpath, ignore_errors=True)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9108
diff changeset
190
3597
137370f7114b Added the '-y' switch to the install script to allow to install Python2 and Python3 variants of eric5 in parallel by giving the startup script a '_py2' or '_py3' postfix.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3515
diff changeset
191 # Cleanup translations
137370f7114b Added the '-y' switch to the install script to allow to install Python2 and Python3 variants of eric5 in parallel by giving the startup script a '_py2' or '_py3' postfix.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3515
diff changeset
192 for name in glob.glob(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9108
diff changeset
193 os.path.join(getConfig("ericTranslationsDir"), "eric7_*.qm")
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9108
diff changeset
194 ):
3597
137370f7114b Added the '-y' switch to the install script to allow to install Python2 and Python3 variants of eric5 in parallel by giving the startup script a '_py2' or '_py3' postfix.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3515
diff changeset
195 if os.path.exists(name):
137370f7114b Added the '-y' switch to the install script to allow to install Python2 and Python3 variants of eric5 in parallel by giving the startup script a '_py2' or '_py3' postfix.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3515
diff changeset
196 os.remove(name)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9108
diff changeset
197
3597
137370f7114b Added the '-y' switch to the install script to allow to install Python2 and Python3 variants of eric5 in parallel by giving the startup script a '_py2' or '_py3' postfix.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3515
diff changeset
198 # Cleanup API files
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9108
diff changeset
199 apidir = getConfig("apidir")
3948
6c3720179d6b Extended the install script to improve cooperation with packagers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3943
diff changeset
200 if apidir:
6c3720179d6b Extended the install script to improve cooperation with packagers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3943
diff changeset
201 for progLanguage in progLanguages:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9108
diff changeset
202 for name in getConfig("apis"):
9361
718bc86e1c3f Changed the handling of 'installed API files' a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9328
diff changeset
203 # step 1: programming language as given
718bc86e1c3f Changed the handling of 'installed API files' a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9328
diff changeset
204 apiname = os.path.join(apidir, progLanguage, name)
718bc86e1c3f Changed the handling of 'installed API files' a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9328
diff changeset
205 if os.path.exists(apiname):
718bc86e1c3f Changed the handling of 'installed API files' a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9328
diff changeset
206 os.remove(apiname)
718bc86e1c3f Changed the handling of 'installed API files' a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9328
diff changeset
207 # step 2: programming language as lowercase
3948
6c3720179d6b Extended the install script to improve cooperation with packagers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3943
diff changeset
208 apiname = os.path.join(apidir, progLanguage.lower(), name)
6c3720179d6b Extended the install script to improve cooperation with packagers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3943
diff changeset
209 if os.path.exists(apiname):
6c3720179d6b Extended the install script to improve cooperation with packagers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3943
diff changeset
210 os.remove(apiname)
6c3720179d6b Extended the install script to improve cooperation with packagers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3943
diff changeset
211 for apiname in glob.glob(
9361
718bc86e1c3f Changed the handling of 'installed API files' a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9328
diff changeset
212 os.path.join(apidir, progLanguage, "*.bas")
718bc86e1c3f Changed the handling of 'installed API files' a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9328
diff changeset
213 ) + glob.glob(os.path.join(apidir, progLanguage.lower(), "*.bas")):
9380
3d662dda80e8 Fixed some issues installing eric7 on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9361
diff changeset
214 if os.path.exists(apiname):
3d662dda80e8 Fixed some issues installing eric7 on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9361
diff changeset
215 os.remove(apiname)
9361
718bc86e1c3f Changed the handling of 'installed API files' a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9328
diff changeset
216
718bc86e1c3f Changed the handling of 'installed API files' a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9328
diff changeset
217 # remove empty directories
718bc86e1c3f Changed the handling of 'installed API files' a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9328
diff changeset
218 with contextlib.suppress(FileNotFoundError, OSError):
718bc86e1c3f Changed the handling of 'installed API files' a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9328
diff changeset
219 os.rmdir(os.path.join(apidir, progLanguage))
718bc86e1c3f Changed the handling of 'installed API files' a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9328
diff changeset
220 with contextlib.suppress(FileNotFoundError, OSError):
718bc86e1c3f Changed the handling of 'installed API files' a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9328
diff changeset
221 os.rmdir(os.path.join(apidir, progLanguage.lower()))
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9108
diff changeset
222
3597
137370f7114b Added the '-y' switch to the install script to allow to install Python2 and Python3 variants of eric5 in parallel by giving the startup script a '_py2' or '_py3' postfix.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3515
diff changeset
223 if sys.platform == "darwin":
137370f7114b Added the '-y' switch to the install script to allow to install Python2 and Python3 variants of eric5 in parallel by giving the startup script a '_py2' or '_py3' postfix.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3515
diff changeset
224 # delete the Mac app bundle
6500
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
225 uninstallMacAppBundle()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9108
diff changeset
226
4561
5bc6ed226471 Extended the uninstall script to remove the plug-ins directories, the data directory and the configuration directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4559
diff changeset
227 # remove plug-in directories
5bc6ed226471 Extended the uninstall script to remove the plug-ins directories, the data directory and the configuration directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4559
diff changeset
228 removePluginDirectories()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9108
diff changeset
229
4561
5bc6ed226471 Extended the uninstall script to remove the plug-ins directories, the data directory and the configuration directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4559
diff changeset
230 # remove the eric data directory
5bc6ed226471 Extended the uninstall script to remove the plug-ins directories, the data directory and the configuration directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4559
diff changeset
231 removeDataDirectory()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9108
diff changeset
232
4561
5bc6ed226471 Extended the uninstall script to remove the plug-ins directories, the data directory and the configuration directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4559
diff changeset
233 # remove the eric configuration directory
5bc6ed226471 Extended the uninstall script to remove the plug-ins directories, the data directory and the configuration directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4559
diff changeset
234 removeConfigurationData()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9108
diff changeset
235
4559
5af0cda900b3 Changed unistall.py to end with a message.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
236 print("\nUninstallation completed")
7836
2f0d208b8137 Changed code to not use the OSError aliases (IOError, EnvironmentError, socket.error and select.error) anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7628
diff changeset
237 except OSError as msg:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9108
diff changeset
238 sys.stderr.write("Error: {0}\nTry uninstall with admin rights.\n".format(msg))
3597
137370f7114b Added the '-y' switch to the install script to allow to install Python2 and Python3 variants of eric5 in parallel by giving the startup script a '_py2' or '_py3' postfix.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3515
diff changeset
239 exit(7)
2654
df2c3218cc5e Fixed an issue uninstalling eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2383
diff changeset
240
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 908
diff changeset
241
6509
884182bfd25c install, uninstall: started to add capability to generate Desktop and Start Menu entries on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6500
diff changeset
242 def uninstallWindowsLinks():
884182bfd25c install, uninstall: started to add capability to generate Desktop and Start Menu entries on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6500
diff changeset
243 """
884182bfd25c install, uninstall: started to add capability to generate Desktop and Start Menu entries on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6500
diff changeset
244 Clean up the Desktop and Start Menu entries for Windows.
884182bfd25c install, uninstall: started to add capability to generate Desktop and Start Menu entries on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6500
diff changeset
245 """
10331
c1a2ff7e3575 Modernized some code and corrected some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10300
diff changeset
246 if importlib.util.find_spec("pywintypes") is None:
6510
d8fd663f86ef install, uninstall: added code to create and remove Desktop and Start Menu entries on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6509
diff changeset
247 # links were not created by install.py
d8fd663f86ef install, uninstall: added code to create and remove Desktop and Start Menu entries on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6509
diff changeset
248 return
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9108
diff changeset
249
7257
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
250 regPath = (
10372
1444b4bee64b Fixed some code style issue related to implicitly and explicitly concatenated strings.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10334
diff changeset
251 "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders"
7257
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
252 )
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9108
diff changeset
253
6509
884182bfd25c install, uninstall: started to add capability to generate Desktop and Start Menu entries on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6500
diff changeset
254 # 1. cleanup desktop links
884182bfd25c install, uninstall: started to add capability to generate Desktop and Start Menu entries on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6500
diff changeset
255 regName = "Desktop"
6510
d8fd663f86ef install, uninstall: added code to create and remove Desktop and Start Menu entries on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6509
diff changeset
256 desktopEntry = getWinregEntry(regName, regPath)
d8fd663f86ef install, uninstall: added code to create and remove Desktop and Start Menu entries on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6509
diff changeset
257 if desktopEntry:
d8fd663f86ef install, uninstall: added code to create and remove Desktop and Start Menu entries on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6509
diff changeset
258 desktopFolder = os.path.normpath(os.path.expandvars(desktopEntry))
d8fd663f86ef install, uninstall: added code to create and remove Desktop and Start Menu entries on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6509
diff changeset
259 for linkName in windowsDesktopNames():
d8fd663f86ef install, uninstall: added code to create and remove Desktop and Start Menu entries on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6509
diff changeset
260 linkPath = os.path.join(desktopFolder, linkName)
d8fd663f86ef install, uninstall: added code to create and remove Desktop and Start Menu entries on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6509
diff changeset
261 if os.path.exists(linkPath):
d8fd663f86ef install, uninstall: added code to create and remove Desktop and Start Menu entries on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6509
diff changeset
262 try:
d8fd663f86ef install, uninstall: added code to create and remove Desktop and Start Menu entries on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6509
diff changeset
263 os.remove(linkPath)
7836
2f0d208b8137 Changed code to not use the OSError aliases (IOError, EnvironmentError, socket.error and select.error) anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7628
diff changeset
264 except OSError:
6510
d8fd663f86ef install, uninstall: added code to create and remove Desktop and Start Menu entries on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6509
diff changeset
265 # maybe restrictions prohibited link removal
d8fd663f86ef install, uninstall: added code to create and remove Desktop and Start Menu entries on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6509
diff changeset
266 print("Could not remove '{0}'.".format(linkPath))
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9108
diff changeset
267
6509
884182bfd25c install, uninstall: started to add capability to generate Desktop and Start Menu entries on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6500
diff changeset
268 # 2. cleanup start menu entry
884182bfd25c install, uninstall: started to add capability to generate Desktop and Start Menu entries on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6500
diff changeset
269 regName = "Programs"
6510
d8fd663f86ef install, uninstall: added code to create and remove Desktop and Start Menu entries on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6509
diff changeset
270 programsEntry = getWinregEntry(regName, regPath)
d8fd663f86ef install, uninstall: added code to create and remove Desktop and Start Menu entries on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6509
diff changeset
271 if programsEntry:
d8fd663f86ef install, uninstall: added code to create and remove Desktop and Start Menu entries on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6509
diff changeset
272 programsFolder = os.path.normpath(os.path.expandvars(programsEntry))
8314
e3642a6a1e71 Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8260
diff changeset
273 eric7EntryPath = os.path.join(programsFolder, windowsProgramsEntry())
e3642a6a1e71 Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8260
diff changeset
274 if os.path.exists(eric7EntryPath):
6510
d8fd663f86ef install, uninstall: added code to create and remove Desktop and Start Menu entries on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6509
diff changeset
275 try:
8314
e3642a6a1e71 Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8260
diff changeset
276 shutil.rmtree(eric7EntryPath)
7836
2f0d208b8137 Changed code to not use the OSError aliases (IOError, EnvironmentError, socket.error and select.error) anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7628
diff changeset
277 except OSError:
6510
d8fd663f86ef install, uninstall: added code to create and remove Desktop and Start Menu entries on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6509
diff changeset
278 # maybe restrictions prohibited link removal
8314
e3642a6a1e71 Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8260
diff changeset
279 print("Could not remove '{0}'.".format(eric7EntryPath))
6509
884182bfd25c install, uninstall: started to add capability to generate Desktop and Start Menu entries on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6500
diff changeset
280
884182bfd25c install, uninstall: started to add capability to generate Desktop and Start Menu entries on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6500
diff changeset
281
6500
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
282 def uninstallLinuxSpecifics():
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
283 """
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
284 Uninstall Linux specific files.
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
285 """
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
286 if os.getuid() == 0:
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
287 for name in [
8314
e3642a6a1e71 Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8260
diff changeset
288 "/usr/share/appdata/eric7.appdata.xml",
e3642a6a1e71 Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8260
diff changeset
289 "/usr/share/metainfo/eric7.appdata.xml",
e3642a6a1e71 Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8260
diff changeset
290 "/usr/share/applications/eric7_browser.desktop",
9381
3c9192161833 Adjusted the Linux specific meta files to the eric7_ide change.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9380
diff changeset
291 "/usr/share/applications/eric7_ide.desktop",
10518
1682f3203ae5 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10496
diff changeset
292 "/usr/share/applications/eric7_mpy.desktop",
9381
3c9192161833 Adjusted the Linux specific meta files to the eric7_ide change.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9380
diff changeset
293 "/usr/share/icons/eric.png",
10518
1682f3203ae5 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10496
diff changeset
294 "/usr/share/icons/ericMPy.png",
9381
3c9192161833 Adjusted the Linux specific meta files to the eric7_ide change.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9380
diff changeset
295 "/usr/share/icons/ericWeb.png",
7192
a22eee00b052 Started removing runtime support for Python2 and PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6942
diff changeset
296 "/usr/share/pixmaps/eric.png",
10518
1682f3203ae5 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10496
diff changeset
297 "/usr/share/pixmaps/ericMPy.png",
7192
a22eee00b052 Started removing runtime support for Python2 and PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6942
diff changeset
298 "/usr/share/pixmaps/ericWeb.png",
9381
3c9192161833 Adjusted the Linux specific meta files to the eric7_ide change.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9380
diff changeset
299 # obsolete entries below
3c9192161833 Adjusted the Linux specific meta files to the eric7_ide change.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9380
diff changeset
300 "/usr/share/applications/eric7.desktop",
6500
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
301 ]:
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
302 if os.path.exists(name):
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
303 os.remove(name)
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
304 elif os.getuid() >= 1000:
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
305 # it is assumed that user ids start at 1000
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
306 for name in [
8314
e3642a6a1e71 Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8260
diff changeset
307 "~/.local/share/appdata/eric7.appdata.xml",
e3642a6a1e71 Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8260
diff changeset
308 "~/.local/share/metainfo/eric7.appdata.xml",
e3642a6a1e71 Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8260
diff changeset
309 "~/.local/share/applications/eric7_browser.desktop",
9381
3c9192161833 Adjusted the Linux specific meta files to the eric7_ide change.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9380
diff changeset
310 "~/.local/share/applications/eric7_ide.desktop",
10518
1682f3203ae5 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10496
diff changeset
311 "~/.local/share/applications/eric7_mpy.desktop",
9381
3c9192161833 Adjusted the Linux specific meta files to the eric7_ide change.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9380
diff changeset
312 "~/.local/share/icons/eric.png",
10518
1682f3203ae5 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10496
diff changeset
313 "~/.local/share/icons/ericMPy.png",
9381
3c9192161833 Adjusted the Linux specific meta files to the eric7_ide change.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9380
diff changeset
314 "~/.local/share/icons/ericWeb.png",
7192
a22eee00b052 Started removing runtime support for Python2 and PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6942
diff changeset
315 "~/.local/share/pixmaps/eric.png",
10518
1682f3203ae5 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10496
diff changeset
316 "~/.local/share/pixmaps/ericMPy.png",
7192
a22eee00b052 Started removing runtime support for Python2 and PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6942
diff changeset
317 "~/.local/share/pixmaps/ericWeb.png",
9381
3c9192161833 Adjusted the Linux specific meta files to the eric7_ide change.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9380
diff changeset
318 # obsolete entries below
3c9192161833 Adjusted the Linux specific meta files to the eric7_ide change.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9380
diff changeset
319 "~/.local/share/applications/eric7.desktop",
6500
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
320 ]:
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
321 path = os.path.expanduser(name)
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
322 if os.path.exists(path):
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
323 os.remove(path)
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
324
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
325
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
326 def uninstallMacAppBundle():
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
327 """
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
328 Uninstall the macOS application bundle.
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
329 """
8339
75908476226e Prepared the install and uninstall scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8318
diff changeset
330 if os.path.exists("/Developer/Applications/Eric7"):
75908476226e Prepared the install and uninstall scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8318
diff changeset
331 shutil.rmtree("/Developer/Applications/Eric7")
6500
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
332 try:
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
333 macAppBundlePath = getConfig("macAppBundlePath")
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
334 macAppBundleName = getConfig("macAppBundleName")
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
335 except AttributeError:
10264
f06151820839 Corrected the recent change to the install and uninstall scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10261
diff changeset
336 macAppBundlePath = (
10300
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
337 defaultMacAppBundlePath if os.getpid() == 0 else defaultMacUserAppBundlePath
10264
f06151820839 Corrected the recent change to the install and uninstall scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10261
diff changeset
338 )
6500
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
339 macAppBundleName = defaultMacAppBundleName
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9108
diff changeset
340 for bundlePath in [
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9108
diff changeset
341 os.path.join(defaultMacAppBundlePath, macAppBundleName),
10264
f06151820839 Corrected the recent change to the install and uninstall scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10261
diff changeset
342 os.path.join(defaultMacUserAppBundlePath, macAppBundleName),
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9108
diff changeset
343 os.path.join(macAppBundlePath, macAppBundleName),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9108
diff changeset
344 ]:
6500
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
345 if os.path.exists(bundlePath):
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
346 shutil.rmtree(bundlePath)
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
347
0373580fc86c install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6495
diff changeset
348
4561
5bc6ed226471 Extended the uninstall script to remove the plug-ins directories, the data directory and the configuration directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4559
diff changeset
349 def removePluginDirectories():
5bc6ed226471 Extended the uninstall script to remove the plug-ins directories, the data directory and the configuration directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4559
diff changeset
350 """
5bc6ed226471 Extended the uninstall script to remove the plug-ins directories, the data directory and the configuration directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4559
diff changeset
351 Remove the plug-in directories.
5bc6ed226471 Extended the uninstall script to remove the plug-ins directories, the data directory and the configuration directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4559
diff changeset
352 """
5bc6ed226471 Extended the uninstall script to remove the plug-ins directories, the data directory and the configuration directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4559
diff changeset
353 pathsToRemove = []
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9108
diff changeset
354
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9108
diff changeset
355 globalPluginsDir = os.path.join(getConfig("mdir"), "eric7plugins")
4561
5bc6ed226471 Extended the uninstall script to remove the plug-ins directories, the data directory and the configuration directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4559
diff changeset
356 if os.path.exists(globalPluginsDir):
5bc6ed226471 Extended the uninstall script to remove the plug-ins directories, the data directory and the configuration directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4559
diff changeset
357 pathsToRemove.append(globalPluginsDir)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9108
diff changeset
358
8314
e3642a6a1e71 Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8260
diff changeset
359 localPluginsDir = os.path.join(getConfigDir(), "eric7plugins")
4561
5bc6ed226471 Extended the uninstall script to remove the plug-ins directories, the data directory and the configuration directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4559
diff changeset
360 if os.path.exists(localPluginsDir):
5bc6ed226471 Extended the uninstall script to remove the plug-ins directories, the data directory and the configuration directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4559
diff changeset
361 pathsToRemove.append(localPluginsDir)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9108
diff changeset
362
4561
5bc6ed226471 Extended the uninstall script to remove the plug-ins directories, the data directory and the configuration directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4559
diff changeset
363 if pathsToRemove:
5bc6ed226471 Extended the uninstall script to remove the plug-ins directories, the data directory and the configuration directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4559
diff changeset
364 print("Found these plug-in directories")
5bc6ed226471 Extended the uninstall script to remove the plug-ins directories, the data directory and the configuration directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4559
diff changeset
365 for path in pathsToRemove:
5bc6ed226471 Extended the uninstall script to remove the plug-ins directories, the data directory and the configuration directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4559
diff changeset
366 print(" - {0}".format(path))
5bc6ed226471 Extended the uninstall script to remove the plug-ins directories, the data directory and the configuration directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4559
diff changeset
367 answer = "c"
5bc6ed226471 Extended the uninstall script to remove the plug-ins directories, the data directory and the configuration directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4559
diff changeset
368 while answer not in ["y", "Y", "n", "N", ""]:
7192
a22eee00b052 Started removing runtime support for Python2 and PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6942
diff changeset
369 answer = input("Shall these directories be removed (y/N)? ")
7628
f904d0eef264 Checked the reported security related issue reports generated by the new security checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
370 # secok
4561
5bc6ed226471 Extended the uninstall script to remove the plug-ins directories, the data directory and the configuration directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4559
diff changeset
371 if answer in ["y", "Y"]:
5bc6ed226471 Extended the uninstall script to remove the plug-ins directories, the data directory and the configuration directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4559
diff changeset
372 for path in pathsToRemove:
5bc6ed226471 Extended the uninstall script to remove the plug-ins directories, the data directory and the configuration directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4559
diff changeset
373 shutil.rmtree(path)
5bc6ed226471 Extended the uninstall script to remove the plug-ins directories, the data directory and the configuration directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4559
diff changeset
374
5bc6ed226471 Extended the uninstall script to remove the plug-ins directories, the data directory and the configuration directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4559
diff changeset
375
5bc6ed226471 Extended the uninstall script to remove the plug-ins directories, the data directory and the configuration directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4559
diff changeset
376 def removeDataDirectory():
5bc6ed226471 Extended the uninstall script to remove the plug-ins directories, the data directory and the configuration directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4559
diff changeset
377 """
5bc6ed226471 Extended the uninstall script to remove the plug-ins directories, the data directory and the configuration directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4559
diff changeset
378 Remove the eric data directory.
5bc6ed226471 Extended the uninstall script to remove the plug-ins directories, the data directory and the configuration directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4559
diff changeset
379 """
5bc6ed226471 Extended the uninstall script to remove the plug-ins directories, the data directory and the configuration directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4559
diff changeset
380 cfg = getConfigDir()
5bc6ed226471 Extended the uninstall script to remove the plug-ins directories, the data directory and the configuration directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4559
diff changeset
381 if os.path.exists(cfg):
5bc6ed226471 Extended the uninstall script to remove the plug-ins directories, the data directory and the configuration directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4559
diff changeset
382 print("Found the eric data directory")
5bc6ed226471 Extended the uninstall script to remove the plug-ins directories, the data directory and the configuration directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4559
diff changeset
383 print(" - {0}".format(cfg))
5bc6ed226471 Extended the uninstall script to remove the plug-ins directories, the data directory and the configuration directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4559
diff changeset
384 answer = "c"
5bc6ed226471 Extended the uninstall script to remove the plug-ins directories, the data directory and the configuration directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4559
diff changeset
385 while answer not in ["y", "Y", "n", "N", ""]:
7192
a22eee00b052 Started removing runtime support for Python2 and PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6942
diff changeset
386 answer = input("Shall this directory be removed (y/N)? ")
7628
f904d0eef264 Checked the reported security related issue reports generated by the new security checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
387 # secok
4561
5bc6ed226471 Extended the uninstall script to remove the plug-ins directories, the data directory and the configuration directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4559
diff changeset
388 if answer in ["y", "Y"]:
5bc6ed226471 Extended the uninstall script to remove the plug-ins directories, the data directory and the configuration directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4559
diff changeset
389 shutil.rmtree(cfg)
5bc6ed226471 Extended the uninstall script to remove the plug-ins directories, the data directory and the configuration directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4559
diff changeset
390
5bc6ed226471 Extended the uninstall script to remove the plug-ins directories, the data directory and the configuration directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4559
diff changeset
391
5bc6ed226471 Extended the uninstall script to remove the plug-ins directories, the data directory and the configuration directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4559
diff changeset
392 def removeConfigurationData():
5bc6ed226471 Extended the uninstall script to remove the plug-ins directories, the data directory and the configuration directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4559
diff changeset
393 """
5bc6ed226471 Extended the uninstall script to remove the plug-ins directories, the data directory and the configuration directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4559
diff changeset
394 Remove the eric configuration directory.
5bc6ed226471 Extended the uninstall script to remove the plug-ins directories, the data directory and the configuration directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4559
diff changeset
395 """
5bc6ed226471 Extended the uninstall script to remove the plug-ins directories, the data directory and the configuration directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4559
diff changeset
396 try:
9482
a2bc06a54d9d Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9448
diff changeset
397 from PyQt6.QtCore import QSettings # __IGNORE_WARNING_I10__
4561
5bc6ed226471 Extended the uninstall script to remove the plug-ins directories, the data directory and the configuration directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4559
diff changeset
398 except ImportError:
7192
a22eee00b052 Started removing runtime support for Python2 and PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6942
diff changeset
399 print("No PyQt variant installed. The configuration directory")
a22eee00b052 Started removing runtime support for Python2 and PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6942
diff changeset
400 print("cannot be determined. You have to remove it manually.\n")
a22eee00b052 Started removing runtime support for Python2 and PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6942
diff changeset
401 return
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9108
diff changeset
402
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9108
diff changeset
403 settings = QSettings(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9108
diff changeset
404 QSettings.Format.IniFormat,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9108
diff changeset
405 QSettings.Scope.UserScope,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9108
diff changeset
406 settingsNameOrganization,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9108
diff changeset
407 settingsNameGlobal,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9108
diff changeset
408 )
4561
5bc6ed226471 Extended the uninstall script to remove the plug-ins directories, the data directory and the configuration directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4559
diff changeset
409 settingsDir = os.path.dirname(settings.fileName())
5bc6ed226471 Extended the uninstall script to remove the plug-ins directories, the data directory and the configuration directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4559
diff changeset
410 if os.path.exists(settingsDir):
5bc6ed226471 Extended the uninstall script to remove the plug-ins directories, the data directory and the configuration directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4559
diff changeset
411 print("Found the eric configuration directory")
5bc6ed226471 Extended the uninstall script to remove the plug-ins directories, the data directory and the configuration directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4559
diff changeset
412 print(" - {0}".format(settingsDir))
5bc6ed226471 Extended the uninstall script to remove the plug-ins directories, the data directory and the configuration directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4559
diff changeset
413 answer = "c"
5bc6ed226471 Extended the uninstall script to remove the plug-ins directories, the data directory and the configuration directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4559
diff changeset
414 while answer not in ["y", "Y", "n", "N", ""]:
7192
a22eee00b052 Started removing runtime support for Python2 and PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6942
diff changeset
415 answer = input("Shall this directory be removed (y/N)? ")
7628
f904d0eef264 Checked the reported security related issue reports generated by the new security checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
416 # secok
4561
5bc6ed226471 Extended the uninstall script to remove the plug-ins directories, the data directory and the configuration directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4559
diff changeset
417 if answer in ["y", "Y"]:
4746
bd60f10ff4ec Fixed an issue causing the uninstall script to crash.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4673
diff changeset
418 shutil.rmtree(settingsDir)
4561
5bc6ed226471 Extended the uninstall script to remove the plug-ins directories, the data directory and the configuration directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4559
diff changeset
419
5bc6ed226471 Extended the uninstall script to remove the plug-ins directories, the data directory and the configuration directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4559
diff changeset
420
5bc6ed226471 Extended the uninstall script to remove the plug-ins directories, the data directory and the configuration directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4559
diff changeset
421 def getConfigDir():
5bc6ed226471 Extended the uninstall script to remove the plug-ins directories, the data directory and the configuration directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4559
diff changeset
422 """
5bc6ed226471 Extended the uninstall script to remove the plug-ins directories, the data directory and the configuration directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4559
diff changeset
423 Module function to get the name of the directory storing the config data.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9108
diff changeset
424
10420
5ac83a87954d Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10417
diff changeset
425 @return directory name of the config dir
5ac83a87954d Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10417
diff changeset
426 @rtype str
4561
5bc6ed226471 Extended the uninstall script to remove the plug-ins directories, the data directory and the configuration directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4559
diff changeset
427 """
8314
e3642a6a1e71 Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8260
diff changeset
428 cdn = ".eric7"
5823
70dfe6a4aa03 Fixed an issue getting the home directory during uninstallation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5711
diff changeset
429 return os.path.join(os.path.expanduser("~"), cdn)
4561
5bc6ed226471 Extended the uninstall script to remove the plug-ins directories, the data directory and the configuration directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4559
diff changeset
430
5bc6ed226471 Extended the uninstall script to remove the plug-ins directories, the data directory and the configuration directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4559
diff changeset
431
6509
884182bfd25c install, uninstall: started to add capability to generate Desktop and Start Menu entries on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6500
diff changeset
432 def getWinregEntry(name, path):
884182bfd25c install, uninstall: started to add capability to generate Desktop and Start Menu entries on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6500
diff changeset
433 """
884182bfd25c install, uninstall: started to add capability to generate Desktop and Start Menu entries on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6500
diff changeset
434 Function to get an entry from the Windows Registry.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9108
diff changeset
435
6509
884182bfd25c install, uninstall: started to add capability to generate Desktop and Start Menu entries on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6500
diff changeset
436 @param name variable name
884182bfd25c install, uninstall: started to add capability to generate Desktop and Start Menu entries on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6500
diff changeset
437 @type str
884182bfd25c install, uninstall: started to add capability to generate Desktop and Start Menu entries on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6500
diff changeset
438 @param path registry path of the variable
884182bfd25c install, uninstall: started to add capability to generate Desktop and Start Menu entries on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6500
diff changeset
439 @type str
884182bfd25c install, uninstall: started to add capability to generate Desktop and Start Menu entries on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6500
diff changeset
440 @return value of requested registry variable
10417
c6011e501282 Modernized some code and converted Debug Client and Debugger source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10403
diff changeset
441 @rtype Any
6509
884182bfd25c install, uninstall: started to add capability to generate Desktop and Start Menu entries on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6500
diff changeset
442 """
884182bfd25c install, uninstall: started to add capability to generate Desktop and Start Menu entries on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6500
diff changeset
443 # From http://stackoverflow.com/a/35286642
9482
a2bc06a54d9d Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9448
diff changeset
444 import winreg # __IGNORE_WARNING_I103__
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9108
diff changeset
445
6509
884182bfd25c install, uninstall: started to add capability to generate Desktop and Start Menu entries on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6500
diff changeset
446 try:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9108
diff changeset
447 registryKey = winreg.OpenKey(winreg.HKEY_CURRENT_USER, path, 0, winreg.KEY_READ)
6509
884182bfd25c install, uninstall: started to add capability to generate Desktop and Start Menu entries on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6500
diff changeset
448 value, _ = winreg.QueryValueEx(registryKey, name)
884182bfd25c install, uninstall: started to add capability to generate Desktop and Start Menu entries on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6500
diff changeset
449 winreg.CloseKey(registryKey)
884182bfd25c install, uninstall: started to add capability to generate Desktop and Start Menu entries on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6500
diff changeset
450 return value
884182bfd25c install, uninstall: started to add capability to generate Desktop and Start Menu entries on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6500
diff changeset
451 except WindowsError:
884182bfd25c install, uninstall: started to add capability to generate Desktop and Start Menu entries on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6500
diff changeset
452 return None
884182bfd25c install, uninstall: started to add capability to generate Desktop and Start Menu entries on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6500
diff changeset
453
884182bfd25c install, uninstall: started to add capability to generate Desktop and Start Menu entries on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6500
diff changeset
454
884182bfd25c install, uninstall: started to add capability to generate Desktop and Start Menu entries on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6500
diff changeset
455 def windowsDesktopNames():
884182bfd25c install, uninstall: started to add capability to generate Desktop and Start Menu entries on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6500
diff changeset
456 """
884182bfd25c install, uninstall: started to add capability to generate Desktop and Start Menu entries on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6500
diff changeset
457 Function to generate the link names for the Windows Desktop.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9108
diff changeset
458
6509
884182bfd25c install, uninstall: started to add capability to generate Desktop and Start Menu entries on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6500
diff changeset
459 @return list of desktop link names
884182bfd25c install, uninstall: started to add capability to generate Desktop and Start Menu entries on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6500
diff changeset
460 @rtype list of str
884182bfd25c install, uninstall: started to add capability to generate Desktop and Start Menu entries on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6500
diff changeset
461 """
884182bfd25c install, uninstall: started to add capability to generate Desktop and Start Menu entries on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6500
diff changeset
462 majorVersion, minorVersion = sys.version_info[:2]
884182bfd25c install, uninstall: started to add capability to generate Desktop and Start Menu entries on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6500
diff changeset
463 linkTemplates = [
9380
3d662dda80e8 Fixed some issues installing eric7 on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9361
diff changeset
464 "eric7 IDE (Python {0}.{1}).lnk",
3d662dda80e8 Fixed some issues installing eric7 on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9361
diff changeset
465 "eric7 Browser (Python {0}.{1}).lnk",
10667
a82709c26b19 Corrected the uninstallation script for Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10518
diff changeset
466 "eric7 MicroPython (Python {0}.{1}).lnk",
9380
3d662dda80e8 Fixed some issues installing eric7 on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9361
diff changeset
467 # obsolete entries below
8314
e3642a6a1e71 Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8260
diff changeset
468 "eric7 (Python {0}.{1}).lnk",
6509
884182bfd25c install, uninstall: started to add capability to generate Desktop and Start Menu entries on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6500
diff changeset
469 ]
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9108
diff changeset
470
7628
f904d0eef264 Checked the reported security related issue reports generated by the new security checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
471 return [ll.format(majorVersion, minorVersion) for ll in linkTemplates]
6509
884182bfd25c install, uninstall: started to add capability to generate Desktop and Start Menu entries on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6500
diff changeset
472
884182bfd25c install, uninstall: started to add capability to generate Desktop and Start Menu entries on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6500
diff changeset
473
884182bfd25c install, uninstall: started to add capability to generate Desktop and Start Menu entries on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6500
diff changeset
474 def windowsProgramsEntry():
884182bfd25c install, uninstall: started to add capability to generate Desktop and Start Menu entries on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6500
diff changeset
475 """
884182bfd25c install, uninstall: started to add capability to generate Desktop and Start Menu entries on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6500
diff changeset
476 Function to generate the name of the Start Menu top entry.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9108
diff changeset
477
6509
884182bfd25c install, uninstall: started to add capability to generate Desktop and Start Menu entries on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6500
diff changeset
478 @return name of the Start Menu top entry
884182bfd25c install, uninstall: started to add capability to generate Desktop and Start Menu entries on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6500
diff changeset
479 @rtype str
884182bfd25c install, uninstall: started to add capability to generate Desktop and Start Menu entries on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6500
diff changeset
480 """
884182bfd25c install, uninstall: started to add capability to generate Desktop and Start Menu entries on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6500
diff changeset
481 majorVersion, minorVersion = sys.version_info[:2]
8314
e3642a6a1e71 Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8260
diff changeset
482 return "eric7 (Python {0}.{1})".format(majorVersion, minorVersion)
6509
884182bfd25c install, uninstall: started to add capability to generate Desktop and Start Menu entries on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6500
diff changeset
483
884182bfd25c install, uninstall: started to add capability to generate Desktop and Start Menu entries on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6500
diff changeset
484
10300
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
485 def createArgumentParser():
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
486 """
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
487 Function to create an argument parser.
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
488
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
489 @return created argument parser object
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
490 @rtype argparse.ArgumentParser
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
491 """
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
492 parser = argparse.ArgumentParser(description="Uninstall eric7.")
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
493 return parser
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
494
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
495
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
496 def main():
2965
d133c7edd88a Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2736
diff changeset
497 """
d133c7edd88a Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2736
diff changeset
498 The main function of the script.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
499 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
500 initGlobals()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
501
10300
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
502 parser = createArgumentParser()
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
503 parser.parse_args()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9108
diff changeset
504
7960
e8fc383322f7 Harmonized some user visible strings and changed the term 'eric6' to the more generic 'eric'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
505 print("\nUninstalling eric ...")
5055
7db1b9496e52 Some enhancements to the install and uninstall scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4806
diff changeset
506 uninstallEric()
7db1b9496e52 Some enhancements to the install and uninstall scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4806
diff changeset
507 print("\nUninstallation complete.")
7db1b9496e52 Some enhancements to the install and uninstall scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4806
diff changeset
508 print()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9108
diff changeset
509
2654
df2c3218cc5e Fixed an issue uninstalling eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2383
diff changeset
510 exit(0)
df2c3218cc5e Fixed an issue uninstalling eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2383
diff changeset
511
df2c3218cc5e Fixed an issue uninstalling eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2383
diff changeset
512
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
513 if __name__ == "__main__":
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
514 try:
10300
60e8f2175b3b Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10264
diff changeset
515 main()
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
516 except SystemExit:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
517 raise
4561
5bc6ed226471 Extended the uninstall script to remove the plug-ins directories, the data directory and the configuration directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4559
diff changeset
518 except Exception:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9108
diff changeset
519 print(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9108
diff changeset
520 """An internal error occured. Please report all the output of"""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9108
diff changeset
521 """ the program,\n"""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9108
diff changeset
522 """including the following traceback, to"""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9108
diff changeset
523 """ eric-bugs@eric-ide.python-projects.org.\n"""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9108
diff changeset
524 )
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
525 raise
4566
a2e8f3c420ec Dealt with the M801 code style checker messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4561
diff changeset
526
a2e8f3c420ec Dealt with the M801 code style checker messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4561
diff changeset
527 #
a2e8f3c420ec Dealt with the M801 code style checker messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4561
diff changeset
528 # eflag: noqa = M801

eric ide

mercurial