Sun, 09 Feb 2025 15:47:27 +0100
Merged with branch 'eric7' in order to prepare a new release.
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 | |
11090
f5f5f5803935
Updated copyright for 2025.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10887
diff
changeset
|
4 | # Copyright (c) 2002 - 2025 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 | 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", |
10864
8917b1a45546
Added the eric7_fido2.py script to the install and uninstall scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10667
diff
changeset
|
131 | "eric7_fido2", |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
132 | "eric7_hexeditor", |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
133 | "eric7_iconeditor", |
9380
3d662dda80e8
Fixed some issues installing eric7 on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9361
diff
changeset
|
134 | "eric7_ide", |
10518 | 135 | "eric7_mpy", |
9697
cdaa3cc805f7
Started implementing a PDF viewer tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9653
diff
changeset
|
136 | "eric7_pdf", |
10084 | 137 | "eric7_pip", |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
138 | "eric7_plugininstall", |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
139 | "eric7_pluginrepository", |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
140 | "eric7_pluginuninstall", |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
141 | "eric7_qregularexpression", |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
142 | "eric7_re", |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
143 | "eric7_shell", |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
144 | "eric7_snap", |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
145 | "eric7_sqlbrowser", |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
146 | "eric7_testing", |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
147 | "eric7_tray", |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
148 | "eric7_trpreviewer", |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
149 | "eric7_uipreviewer", |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
150 | "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
|
151 | # 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
|
152 | "eric7_unittest", |
9380
3d662dda80e8
Fixed some issues installing eric7 on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9361
diff
changeset
|
153 | "eric7", |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
154 | ] |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
155 | |
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
|
156 | 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
|
157 | 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
|
158 | 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
|
159 | 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
|
160 | os.remove(rwname) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
161 | |
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
|
162 | # 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
|
163 | 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
|
164 | 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
|
165 | 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
|
166 | 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
|
167 | 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
|
168 | 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
|
169 | 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
|
170 | os.remove(f) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
171 | |
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
|
172 | # Cleanup the install directories |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
173 | for name in [ |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
174 | "ericExamplesDir", |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
175 | "ericDocDir", |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
176 | "ericDTDDir", |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
177 | "ericCSSDir", |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
178 | "ericIconDir", |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
179 | "ericPixDir", |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
180 | "ericTemplatesDir", |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
181 | "ericCodeTemplatesDir", |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
182 | "ericOthersDir", |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
183 | "ericStylesDir", |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
184 | "ericThemesDir", |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
185 | "ericDir", |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
186 | ]: |
8821
0485c183b718
Ignore unknown configuration keys during cleanup of install.py and uninstall.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8820
diff
changeset
|
187 | 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
|
188 | 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
|
189 | 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
|
190 | 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
|
191 | |
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
|
192 | # 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
|
193 | 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
|
194 | 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
|
195 | ): |
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
|
196 | 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
|
197 | os.remove(name) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
198 | |
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
|
199 | # Cleanup API files |
10887
305885e65bd1
Fixed an issue in the uninstall script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10864
diff
changeset
|
200 | with contextlib.suppress(AttributeError): |
305885e65bd1
Fixed an issue in the uninstall script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10864
diff
changeset
|
201 | apidir = getConfig("apidir") |
305885e65bd1
Fixed an issue in the uninstall script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10864
diff
changeset
|
202 | if apidir: |
305885e65bd1
Fixed an issue in the uninstall script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10864
diff
changeset
|
203 | for progLanguage in progLanguages: |
305885e65bd1
Fixed an issue in the uninstall script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10864
diff
changeset
|
204 | for name in getConfig("apis"): |
305885e65bd1
Fixed an issue in the uninstall script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10864
diff
changeset
|
205 | # step 1: programming language as given |
305885e65bd1
Fixed an issue in the uninstall script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10864
diff
changeset
|
206 | apiname = os.path.join(apidir, progLanguage, name) |
305885e65bd1
Fixed an issue in the uninstall script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10864
diff
changeset
|
207 | if os.path.exists(apiname): |
305885e65bd1
Fixed an issue in the uninstall script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10864
diff
changeset
|
208 | os.remove(apiname) |
305885e65bd1
Fixed an issue in the uninstall script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10864
diff
changeset
|
209 | # step 2: programming language as lowercase |
305885e65bd1
Fixed an issue in the uninstall script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10864
diff
changeset
|
210 | apiname = os.path.join(apidir, progLanguage.lower(), name) |
305885e65bd1
Fixed an issue in the uninstall script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10864
diff
changeset
|
211 | if os.path.exists(apiname): |
305885e65bd1
Fixed an issue in the uninstall script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10864
diff
changeset
|
212 | os.remove(apiname) |
305885e65bd1
Fixed an issue in the uninstall script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10864
diff
changeset
|
213 | for apiname in glob.glob( |
305885e65bd1
Fixed an issue in the uninstall script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10864
diff
changeset
|
214 | os.path.join(apidir, progLanguage, "*.bas") |
305885e65bd1
Fixed an issue in the uninstall script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10864
diff
changeset
|
215 | ) + glob.glob(os.path.join(apidir, progLanguage.lower(), "*.bas")): |
305885e65bd1
Fixed an issue in the uninstall script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10864
diff
changeset
|
216 | if os.path.exists(apiname): |
305885e65bd1
Fixed an issue in the uninstall script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10864
diff
changeset
|
217 | 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
|
218 | |
10887
305885e65bd1
Fixed an issue in the uninstall script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10864
diff
changeset
|
219 | # remove empty directories |
305885e65bd1
Fixed an issue in the uninstall script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10864
diff
changeset
|
220 | with contextlib.suppress(FileNotFoundError, OSError): |
305885e65bd1
Fixed an issue in the uninstall script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10864
diff
changeset
|
221 | os.rmdir(os.path.join(apidir, progLanguage)) |
305885e65bd1
Fixed an issue in the uninstall script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10864
diff
changeset
|
222 | with contextlib.suppress(FileNotFoundError, OSError): |
305885e65bd1
Fixed an issue in the uninstall script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10864
diff
changeset
|
223 | 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
|
224 | |
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
|
225 | 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
|
226 | # 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
|
227 | uninstallMacAppBundle() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
228 | |
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
|
229 | # 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
|
230 | removePluginDirectories() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
231 | |
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
|
232 | # 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
|
233 | removeDataDirectory() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
234 | |
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
|
235 | # 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
|
236 | removeConfigurationData() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
237 | |
4559
5af0cda900b3
Changed unistall.py to end with a message.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4021
diff
changeset
|
238 | 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
|
239 | except OSError as msg: |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
240 | 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
|
241 | exit(7) |
2654
df2c3218cc5e
Fixed an issue uninstalling eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2383
diff
changeset
|
242 | |
945
8cd4d08fa9f6
Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
908
diff
changeset
|
243 | |
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
|
244 | 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
|
245 | """ |
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
|
246 | 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
|
247 | """ |
10331
c1a2ff7e3575
Modernized some code and corrected some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10300
diff
changeset
|
248 | 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
|
249 | # 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
|
250 | return |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
251 | |
7257
c4d0cac9b5c9
Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7229
diff
changeset
|
252 | 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
|
253 | "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
|
254 | ) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
255 | |
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
|
256 | # 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
|
257 | 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
|
258 | 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
|
259 | 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
|
260 | 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
|
261 | 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
|
262 | 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
|
263 | 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
|
264 | 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
|
265 | 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
|
266 | 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
|
267 | # 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
|
268 | 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
|
269 | |
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
|
270 | # 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
|
271 | 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
|
272 | 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
|
273 | 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
|
274 | 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
|
275 | eric7EntryPath = os.path.join(programsFolder, windowsProgramsEntry()) |
e3642a6a1e71
Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8260
diff
changeset
|
276 | 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
|
277 | try: |
8314
e3642a6a1e71
Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8260
diff
changeset
|
278 | 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
|
279 | 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
|
280 | # maybe restrictions prohibited link removal |
8314
e3642a6a1e71
Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8260
diff
changeset
|
281 | 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
|
282 | |
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
|
283 | |
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
|
284 | 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
|
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 | 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
|
287 | """ |
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
|
288 | 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
|
289 | for name in [ |
8314
e3642a6a1e71
Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8260
diff
changeset
|
290 | "/usr/share/appdata/eric7.appdata.xml", |
e3642a6a1e71
Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8260
diff
changeset
|
291 | "/usr/share/metainfo/eric7.appdata.xml", |
e3642a6a1e71
Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8260
diff
changeset
|
292 | "/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
|
293 | "/usr/share/applications/eric7_ide.desktop", |
10518 | 294 | "/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
|
295 | "/usr/share/icons/eric.png", |
10518 | 296 | "/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
|
297 | "/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
|
298 | "/usr/share/pixmaps/eric.png", |
10518 | 299 | "/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
|
300 | "/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
|
301 | # 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
|
302 | "/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
|
303 | ]: |
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 | 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
|
305 | 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
|
306 | 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
|
307 | # 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
|
308 | for name in [ |
8314
e3642a6a1e71
Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8260
diff
changeset
|
309 | "~/.local/share/appdata/eric7.appdata.xml", |
e3642a6a1e71
Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8260
diff
changeset
|
310 | "~/.local/share/metainfo/eric7.appdata.xml", |
e3642a6a1e71
Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8260
diff
changeset
|
311 | "~/.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
|
312 | "~/.local/share/applications/eric7_ide.desktop", |
10518 | 313 | "~/.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
|
314 | "~/.local/share/icons/eric.png", |
10518 | 315 | "~/.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
|
316 | "~/.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
|
317 | "~/.local/share/pixmaps/eric.png", |
10518 | 318 | "~/.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
|
319 | "~/.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
|
320 | # 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
|
321 | "~/.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
|
322 | ]: |
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 | 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
|
324 | 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
|
325 | 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
|
326 | |
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 | 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
|
329 | """ |
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
|
330 | 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
|
331 | """ |
8339
75908476226e
Prepared the install and uninstall scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8318
diff
changeset
|
332 | if os.path.exists("/Developer/Applications/Eric7"): |
75908476226e
Prepared the install and uninstall scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8318
diff
changeset
|
333 | 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
|
334 | 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
|
335 | 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
|
336 | 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
|
337 | except AttributeError: |
10264
f06151820839
Corrected the recent change to the install and uninstall scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10261
diff
changeset
|
338 | 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
|
339 | 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
|
340 | ) |
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
|
341 | macAppBundleName = defaultMacAppBundleName |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
342 | for bundlePath in [ |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
343 | 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
|
344 | 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
|
345 | os.path.join(macAppBundlePath, macAppBundleName), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
346 | ]: |
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
|
347 | 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
|
348 | 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
|
349 | |
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
|
350 | |
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
|
351 | 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
|
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 | 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
|
354 | """ |
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
|
355 | pathsToRemove = [] |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
356 | |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
357 | 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
|
358 | 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
|
359 | pathsToRemove.append(globalPluginsDir) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
360 | |
8314
e3642a6a1e71
Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8260
diff
changeset
|
361 | 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
|
362 | 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
|
363 | pathsToRemove.append(localPluginsDir) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
364 | |
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
|
365 | 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
|
366 | 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
|
367 | 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
|
368 | 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
|
369 | 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
|
370 | 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
|
371 | 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
|
372 | # 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
|
373 | 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
|
374 | 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
|
375 | 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
|
376 | |
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 | 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
|
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 | 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
|
381 | """ |
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 | 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
|
383 | 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
|
384 | 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
|
385 | 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
|
386 | 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
|
387 | 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
|
388 | 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
|
389 | # 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
|
390 | 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
|
391 | 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
|
392 | |
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 | 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
|
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 | 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
|
397 | """ |
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 | try: |
9482
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9448
diff
changeset
|
399 | 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
|
400 | except ImportError: |
7192
a22eee00b052
Started removing runtime support for Python2 and PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
401 | 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
|
402 | 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
|
403 | return |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
404 | |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
405 | settings = QSettings( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
406 | QSettings.Format.IniFormat, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
407 | QSettings.Scope.UserScope, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
408 | settingsNameOrganization, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
409 | settingsNameGlobal, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
410 | ) |
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
|
411 | 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
|
412 | 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
|
413 | 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
|
414 | 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
|
415 | 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
|
416 | 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
|
417 | 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
|
418 | # 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
|
419 | 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
|
420 | 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
|
421 | |
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 | 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
|
424 | """ |
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
|
425 | 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
|
426 | |
10420
5ac83a87954d
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10417
diff
changeset
|
427 | @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
|
428 | @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
|
429 | """ |
8314
e3642a6a1e71
Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8260
diff
changeset
|
430 | cdn = ".eric7" |
5823
70dfe6a4aa03
Fixed an issue getting the home directory during uninstallation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5711
diff
changeset
|
431 | 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
|
432 | |
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
|
433 | |
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
|
434 | 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
|
435 | """ |
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 | 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
|
437 | |
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
|
438 | @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
|
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 | @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
|
441 | @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
|
442 | @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
|
443 | @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
|
444 | """ |
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
|
445 | # 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
|
446 | 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
|
447 | |
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 | try: |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
449 | 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
|
450 | 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
|
451 | 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
|
452 | 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
|
453 | 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
|
454 | 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
|
455 | |
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 | 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
|
458 | """ |
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 | 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
|
460 | |
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
|
461 | @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
|
462 | @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
|
463 | """ |
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
|
464 | 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
|
465 | linkTemplates = [ |
9380
3d662dda80e8
Fixed some issues installing eric7 on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9361
diff
changeset
|
466 | "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
|
467 | "eric7 Browser (Python {0}.{1}).lnk", |
10667
a82709c26b19
Corrected the uninstallation script for Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10518
diff
changeset
|
468 | "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
|
469 | # obsolete entries below |
8314
e3642a6a1e71
Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8260
diff
changeset
|
470 | "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
|
471 | ] |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
472 | |
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
|
473 | 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
|
474 | |
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 | 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
|
477 | """ |
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 | 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
|
479 | |
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
|
480 | @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
|
481 | @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
|
482 | """ |
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 | majorVersion, minorVersion = sys.version_info[:2] |
8314
e3642a6a1e71
Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8260
diff
changeset
|
484 | 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
|
485 | |
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
|
486 | |
10300
60e8f2175b3b
Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10264
diff
changeset
|
487 | 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
|
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 | 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
|
490 | |
60e8f2175b3b
Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10264
diff
changeset
|
491 | @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
|
492 | @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
|
493 | """ |
60e8f2175b3b
Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10264
diff
changeset
|
494 | 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
|
495 | 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
|
496 | |
60e8f2175b3b
Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10264
diff
changeset
|
497 | |
60e8f2175b3b
Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10264
diff
changeset
|
498 | 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
|
499 | """ |
d133c7edd88a
Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2736
diff
changeset
|
500 | The main function of the script. |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
501 | """ |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
502 | initGlobals() |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
503 | |
10300
60e8f2175b3b
Changed the install and uninstall scripts to use 'argparse' instead of 'getopt'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10264
diff
changeset
|
504 | 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
|
505 | parser.parse_args() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
506 | |
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
|
507 | print("\nUninstalling eric ...") |
5055
7db1b9496e52
Some enhancements to the install and uninstall scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4806
diff
changeset
|
508 | uninstallEric() |
7db1b9496e52
Some enhancements to the install and uninstall scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4806
diff
changeset
|
509 | print("\nUninstallation complete.") |
7db1b9496e52
Some enhancements to the install and uninstall scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4806
diff
changeset
|
510 | print() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
511 | |
2654
df2c3218cc5e
Fixed an issue uninstalling eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2383
diff
changeset
|
512 | exit(0) |
df2c3218cc5e
Fixed an issue uninstalling eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2383
diff
changeset
|
513 | |
df2c3218cc5e
Fixed an issue uninstalling eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2383
diff
changeset
|
514 | |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
515 | if __name__ == "__main__": |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
516 | 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
|
517 | main() |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
518 | except SystemExit: |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
519 | 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
|
520 | except Exception: |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
521 | print( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
522 | """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
|
523 | """ the program,\n""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
524 | """including the following traceback, to""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
525 | """ 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
|
526 | ) |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
527 | raise |
4566
a2e8f3c420ec
Dealt with the M801 code style checker messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4561
diff
changeset
|
528 | |
a2e8f3c420ec
Dealt with the M801 code style checker messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4561
diff
changeset
|
529 | # |
a2e8f3c420ec
Dealt with the M801 code style checker messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4561
diff
changeset
|
530 | # eflag: noqa = M801 |