Mon, 29 May 2023 16:18:38 +0200
pip Interface
- Added a standalone application for Python package management with `pip`.
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 | |
9653
e67609152c5e
Updated copyright for 2023.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9482
diff
changeset
|
4 | # Copyright (c) 2002 - 2023 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 | |
8501
7b5f10581c35
Removed the support for the deprecated distutils package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8339
diff
changeset
|
13 | import contextlib |
9482
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9448
diff
changeset
|
14 | import getopt |
8501
7b5f10581c35
Removed the support for the deprecated distutils package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8339
diff
changeset
|
15 | import glob |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
16 | import os |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
17 | import shutil |
8501
7b5f10581c35
Removed the support for the deprecated distutils package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8339
diff
changeset
|
18 | import sys |
7b5f10581c35
Removed the support for the deprecated distutils package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8339
diff
changeset
|
19 | import sysconfig |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
20 | |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
21 | # Define the globals. |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
22 | progName = None |
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" |
3714
4080395e3426
Changed the uninstall code for Mac platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3697
diff
changeset
|
27 | defaultMacAppBundlePath = "/Applications" |
8339
75908476226e
Prepared the install and uninstall scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8318
diff
changeset
|
28 | settingsNameOrganization = "Eric7" |
8314
e3642a6a1e71
Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8260
diff
changeset
|
29 | 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
|
30 | |
945
8cd4d08fa9f6
Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
908
diff
changeset
|
31 | |
2654
df2c3218cc5e
Fixed an issue uninstalling eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2383
diff
changeset
|
32 | def exit(rcode=0): |
df2c3218cc5e
Fixed an issue uninstalling eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2383
diff
changeset
|
33 | """ |
df2c3218cc5e
Fixed an issue uninstalling eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2383
diff
changeset
|
34 | Exit the uninstall script. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
35 | |
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
|
36 | @param rcode result code to report back (integer) |
2654
df2c3218cc5e
Fixed an issue uninstalling eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2383
diff
changeset
|
37 | """ |
5055
7db1b9496e52
Some enhancements to the install and uninstall scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4806
diff
changeset
|
38 | global currDir |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
39 | |
8314
e3642a6a1e71
Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8260
diff
changeset
|
40 | # restore the local eric7config.py |
e3642a6a1e71
Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8260
diff
changeset
|
41 | if os.path.exists("eric7config.py.orig"): |
e3642a6a1e71
Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8260
diff
changeset
|
42 | if os.path.exists("eric7config.py"): |
e3642a6a1e71
Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8260
diff
changeset
|
43 | os.remove("eric7config.py") |
e3642a6a1e71
Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8260
diff
changeset
|
44 | 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
|
45 | |
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
|
46 | 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
|
47 | with contextlib.suppress(EOFError): |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
48 | 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
|
49 | |
5055
7db1b9496e52
Some enhancements to the install and uninstall scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4806
diff
changeset
|
50 | os.chdir(currDir) |
9221
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 | sys.exit(rcode) |
2654
df2c3218cc5e
Fixed an issue uninstalling eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2383
diff
changeset
|
53 | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
54 | |
8314
e3642a6a1e71
Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8260
diff
changeset
|
55 | # 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
|
56 | if os.path.exists("eric7config.py"): |
e3642a6a1e71
Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8260
diff
changeset
|
57 | 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
|
58 | try: |
9448
ea215f7afab3
Fixed an issue importing the eric7config module.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9381
diff
changeset
|
59 | 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
|
60 | 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
|
61 | 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
|
62 | 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
|
63 | 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
|
64 | # 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
|
65 | 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
|
66 | 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
|
67 | |
2654
df2c3218cc5e
Fixed an issue uninstalling eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2383
diff
changeset
|
68 | |
945
8cd4d08fa9f6
Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
908
diff
changeset
|
69 | def usage(rcode=2): |
2965
d133c7edd88a
Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2736
diff
changeset
|
70 | """ |
d133c7edd88a
Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2736
diff
changeset
|
71 | Display a usage message and exit. |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
72 | |
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
|
73 | @param rcode return code passed back to the calling process (integer) |
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 progName |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
76 | |
12
1d8dd9706f46
First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
77 | print("Usage:") |
428
58405c24aa09
Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
146
diff
changeset
|
78 | print(" {0} [-h]".format(progName)) |
12
1d8dd9706f46
First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
79 | print("where:") |
1d8dd9706f46
First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
80 | print(" -h display this help message") |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
81 | |
2654
df2c3218cc5e
Fixed an issue uninstalling eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2383
diff
changeset
|
82 | exit(rcode) |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
83 | |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
84 | |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
85 | def initGlobals(): |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
86 | """ |
2965
d133c7edd88a
Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2736
diff
changeset
|
87 | 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
|
88 | """ |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
89 | global pyModDir |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
90 | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
91 | pyModDir = sysconfig.get_path("platlib") |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
92 | |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
93 | |
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
|
94 | 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
|
95 | """ |
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
|
96 | 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
|
97 | |
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
|
98 | @param dname name of the directory to place the wrapper into |
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
|
99 | @param wfile basename (without extension) of the wrapper script |
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
|
100 | @return the names of the wrapper scripts |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
101 | """ |
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
|
102 | wnames = ( |
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
|
103 | (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
|
104 | if sys.platform.startswith(("win", "cygwin")) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
105 | 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
|
106 | ) |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
107 | |
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
|
108 | return wnames |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
109 | |
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 | def uninstallEric(): |
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 | Uninstall the eric files. |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
114 | """ |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
115 | global pyModDir |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
116 | |
146
afeb742e7148
Added installation of a .desktop file for Linux systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
107
diff
changeset
|
117 | # Remove the menu entry for Linux systems |
6214
89a53d80e729
install, uninstall: Modified the install and uninstall scripts such, that they can be used without being administrator (i.e. if installing into a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6188
diff
changeset
|
118 | if sys.platform.startswith("linux"): |
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
|
119 | 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
|
120 | # 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
|
121 | 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
|
122 | uninstallWindowsLinks() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
123 | |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
124 | # Remove the wrapper scripts |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
125 | rem_wnames = [ |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
126 | "eric7_api", |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
127 | "eric7_browser", |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
128 | "eric7_compare", |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
129 | "eric7_configure", |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
130 | "eric7_diff", |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
131 | "eric7_doc", |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
132 | "eric7_editor", |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
133 | "eric7_hexeditor", |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
134 | "eric7_iconeditor", |
9380
3d662dda80e8
Fixed some issues installing eric7 on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9361
diff
changeset
|
135 | "eric7_ide", |
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): |
0485c183b718
Ignore unknown configuration keys during cleanup of install.py and uninstall.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8820
diff
changeset
|
190 | shutil.rmtree(dirpath, 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 |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
200 | apidir = getConfig("apidir") |
3948
6c3720179d6b
Extended the install script to improve cooperation with packagers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3943
diff
changeset
|
201 | if apidir: |
6c3720179d6b
Extended the install script to improve cooperation with packagers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3943
diff
changeset
|
202 | for progLanguage in progLanguages: |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
203 | for name in getConfig("apis"): |
9361
718bc86e1c3f
Changed the handling of 'installed API files' a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9328
diff
changeset
|
204 | # step 1: programming language as given |
718bc86e1c3f
Changed the handling of 'installed API files' a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9328
diff
changeset
|
205 | apiname = os.path.join(apidir, progLanguage, name) |
718bc86e1c3f
Changed the handling of 'installed API files' a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9328
diff
changeset
|
206 | if os.path.exists(apiname): |
718bc86e1c3f
Changed the handling of 'installed API files' a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9328
diff
changeset
|
207 | os.remove(apiname) |
718bc86e1c3f
Changed the handling of 'installed API files' a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9328
diff
changeset
|
208 | # step 2: programming language as lowercase |
3948
6c3720179d6b
Extended the install script to improve cooperation with packagers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3943
diff
changeset
|
209 | apiname = os.path.join(apidir, progLanguage.lower(), name) |
6c3720179d6b
Extended the install script to improve cooperation with packagers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3943
diff
changeset
|
210 | if os.path.exists(apiname): |
6c3720179d6b
Extended the install script to improve cooperation with packagers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3943
diff
changeset
|
211 | os.remove(apiname) |
6c3720179d6b
Extended the install script to improve cooperation with packagers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3943
diff
changeset
|
212 | for apiname in glob.glob( |
9361
718bc86e1c3f
Changed the handling of 'installed API files' a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9328
diff
changeset
|
213 | os.path.join(apidir, progLanguage, "*.bas") |
718bc86e1c3f
Changed the handling of 'installed API files' a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9328
diff
changeset
|
214 | ) + glob.glob(os.path.join(apidir, progLanguage.lower(), "*.bas")): |
9380
3d662dda80e8
Fixed some issues installing eric7 on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9361
diff
changeset
|
215 | if os.path.exists(apiname): |
3d662dda80e8
Fixed some issues installing eric7 on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9361
diff
changeset
|
216 | 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
|
217 | |
718bc86e1c3f
Changed the handling of 'installed API files' a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9328
diff
changeset
|
218 | # remove empty directories |
718bc86e1c3f
Changed the handling of 'installed API files' a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9328
diff
changeset
|
219 | with contextlib.suppress(FileNotFoundError, OSError): |
718bc86e1c3f
Changed the handling of 'installed API files' a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9328
diff
changeset
|
220 | os.rmdir(os.path.join(apidir, progLanguage)) |
718bc86e1c3f
Changed the handling of 'installed API files' a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9328
diff
changeset
|
221 | with contextlib.suppress(FileNotFoundError, OSError): |
718bc86e1c3f
Changed the handling of 'installed API files' a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9328
diff
changeset
|
222 | 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
|
223 | |
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
|
224 | 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
|
225 | # 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
|
226 | uninstallMacAppBundle() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
227 | |
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
|
228 | # 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
|
229 | removePluginDirectories() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
230 | |
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
|
231 | # 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
|
232 | removeDataDirectory() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
233 | |
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
|
234 | # 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
|
235 | removeConfigurationData() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
236 | |
4559
5af0cda900b3
Changed unistall.py to end with a message.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4021
diff
changeset
|
237 | 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
|
238 | except OSError as msg: |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
239 | 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
|
240 | exit(7) |
2654
df2c3218cc5e
Fixed an issue uninstalling eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2383
diff
changeset
|
241 | |
945
8cd4d08fa9f6
Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
908
diff
changeset
|
242 | |
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
|
243 | 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
|
244 | """ |
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 | 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
|
246 | """ |
6510
d8fd663f86ef
install, uninstall: added code to create and remove Desktop and Start Menu entries on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6509
diff
changeset
|
247 | try: |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
248 | from pywintypes import com_error # __IGNORE_WARNING__ |
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 | except ImportError: |
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 | # 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
|
251 | return |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
252 | |
7257
c4d0cac9b5c9
Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7229
diff
changeset
|
253 | regPath = ( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
254 | "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
255 | + "\\User Shell Folders" |
7257
c4d0cac9b5c9
Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7229
diff
changeset
|
256 | ) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
257 | |
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
|
258 | # 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
|
259 | 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
|
260 | 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
|
261 | 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
|
262 | 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
|
263 | 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
|
264 | 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
|
265 | 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
|
266 | 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
|
267 | 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
|
268 | 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
|
269 | # 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
|
270 | 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
|
271 | |
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
|
272 | # 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
|
273 | 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
|
274 | 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
|
275 | 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
|
276 | 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
|
277 | eric7EntryPath = os.path.join(programsFolder, windowsProgramsEntry()) |
e3642a6a1e71
Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8260
diff
changeset
|
278 | 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
|
279 | try: |
8314
e3642a6a1e71
Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8260
diff
changeset
|
280 | 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
|
281 | 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
|
282 | # maybe restrictions prohibited link removal |
8314
e3642a6a1e71
Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8260
diff
changeset
|
283 | 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
|
284 | |
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
|
285 | |
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
|
286 | 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
|
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 | 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
|
289 | """ |
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
|
290 | 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
|
291 | for name in [ |
8314
e3642a6a1e71
Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8260
diff
changeset
|
292 | "/usr/share/appdata/eric7.appdata.xml", |
e3642a6a1e71
Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8260
diff
changeset
|
293 | "/usr/share/metainfo/eric7.appdata.xml", |
e3642a6a1e71
Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8260
diff
changeset
|
294 | "/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
|
295 | "/usr/share/applications/eric7_ide.desktop", |
3c9192161833
Adjusted the Linux specific meta files to the eric7_ide change.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9380
diff
changeset
|
296 | "/usr/share/icons/eric.png", |
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", |
a22eee00b052
Started removing runtime support for Python2 and PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
299 | "/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
|
300 | # 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
|
301 | "/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
|
302 | ]: |
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 | 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
|
304 | 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
|
305 | 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
|
306 | # 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
|
307 | for name in [ |
8314
e3642a6a1e71
Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8260
diff
changeset
|
308 | "~/.local/share/appdata/eric7.appdata.xml", |
e3642a6a1e71
Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8260
diff
changeset
|
309 | "~/.local/share/metainfo/eric7.appdata.xml", |
e3642a6a1e71
Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8260
diff
changeset
|
310 | "~/.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
|
311 | "~/.local/share/applications/eric7_ide.desktop", |
3c9192161833
Adjusted the Linux specific meta files to the eric7_ide change.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9380
diff
changeset
|
312 | "~/.local/share/icons/eric.png", |
3c9192161833
Adjusted the Linux specific meta files to the eric7_ide change.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9380
diff
changeset
|
313 | "~/.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
|
314 | "~/.local/share/pixmaps/eric.png", |
a22eee00b052
Started removing runtime support for Python2 and PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
315 | "~/.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
|
316 | # 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
|
317 | "~/.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
|
318 | ]: |
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
|
319 | 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
|
320 | 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
|
321 | 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
|
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 | |
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 | 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
|
325 | """ |
0373580fc86c
install.py, uninstall.py: performed some refactorings and prepared to create links on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6495
diff
changeset
|
326 | 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
|
327 | """ |
8339
75908476226e
Prepared the install and uninstall scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8318
diff
changeset
|
328 | if os.path.exists("/Developer/Applications/Eric7"): |
75908476226e
Prepared the install and uninstall scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8318
diff
changeset
|
329 | 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
|
330 | 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
|
331 | 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
|
332 | 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
|
333 | except AttributeError: |
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 | macAppBundlePath = defaultMacAppBundlePath |
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 | macAppBundleName = defaultMacAppBundleName |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
336 | for bundlePath in [ |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
337 | os.path.join(defaultMacAppBundlePath, macAppBundleName), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
338 | os.path.join(macAppBundlePath, macAppBundleName), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
339 | ]: |
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
|
340 | 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
|
341 | 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
|
342 | |
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
|
343 | |
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
|
344 | 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
|
345 | """ |
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
|
346 | 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
|
347 | """ |
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
|
348 | pathsToRemove = [] |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
349 | |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
350 | 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
|
351 | 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
|
352 | pathsToRemove.append(globalPluginsDir) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
353 | |
8314
e3642a6a1e71
Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8260
diff
changeset
|
354 | 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
|
355 | 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
|
356 | pathsToRemove.append(localPluginsDir) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
357 | |
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 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
|
359 | 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
|
360 | 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
|
361 | 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
|
362 | 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
|
363 | 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
|
364 | 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
|
365 | # 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
|
366 | 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
|
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 | 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
|
369 | |
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 | |
5bc6ed226471
Extended the uninstall script to remove the plug-ins directories, the data directory and the configuration directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4559
diff
changeset
|
371 | 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
|
372 | """ |
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 | 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
|
374 | """ |
5bc6ed226471
Extended the uninstall script to remove the plug-ins directories, the data directory and the configuration directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4559
diff
changeset
|
375 | 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
|
376 | 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
|
377 | 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
|
378 | 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
|
379 | 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
|
380 | 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
|
381 | 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
|
382 | # 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
|
383 | 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
|
384 | 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
|
385 | |
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 | |
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 | 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
|
388 | """ |
5bc6ed226471
Extended the uninstall script to remove the plug-ins directories, the data directory and the configuration directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4559
diff
changeset
|
389 | 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
|
390 | """ |
5bc6ed226471
Extended the uninstall script to remove the plug-ins directories, the data directory and the configuration directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4559
diff
changeset
|
391 | try: |
9482
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9448
diff
changeset
|
392 | 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
|
393 | except ImportError: |
7192
a22eee00b052
Started removing runtime support for Python2 and PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
394 | 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
|
395 | 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
|
396 | return |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
397 | |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
398 | settings = QSettings( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
399 | QSettings.Format.IniFormat, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
400 | QSettings.Scope.UserScope, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
401 | settingsNameOrganization, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
402 | settingsNameGlobal, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
403 | ) |
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
|
404 | 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
|
405 | 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
|
406 | 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
|
407 | 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
|
408 | 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
|
409 | 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
|
410 | 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
|
411 | # 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
|
412 | 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
|
413 | 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
|
414 | |
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 | |
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 | 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
|
417 | """ |
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
|
418 | 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
|
419 | |
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
|
420 | @return directory name of the config dir (string) |
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 | """ |
8314
e3642a6a1e71
Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8260
diff
changeset
|
422 | cdn = ".eric7" |
5823
70dfe6a4aa03
Fixed an issue getting the home directory during uninstallation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5711
diff
changeset
|
423 | 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
|
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 | |
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
|
426 | 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
|
427 | """ |
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
|
428 | 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
|
429 | |
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
|
430 | @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
|
431 | @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
|
432 | @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
|
433 | @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
|
434 | @return value of requested registry 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
|
435 | @rtype any |
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 | """ |
884182bfd25c
install, uninstall: started to add capability to generate Desktop and Start Menu entries on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6500
diff
changeset
|
437 | # 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
|
438 | 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
|
439 | |
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
|
440 | try: |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
441 | 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
|
442 | 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
|
443 | 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
|
444 | 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
|
445 | 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
|
446 | 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
|
447 | |
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 | |
884182bfd25c
install, uninstall: started to add capability to generate Desktop and Start Menu entries on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6500
diff
changeset
|
449 | 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
|
450 | """ |
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 | 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
|
452 | |
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
|
453 | @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
|
454 | @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
|
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 | 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
|
457 | linkTemplates = [ |
9380
3d662dda80e8
Fixed some issues installing eric7 on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9361
diff
changeset
|
458 | "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
|
459 | "eric7 Browser (Python {0}.{1}).lnk", |
3d662dda80e8
Fixed some issues installing eric7 on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9361
diff
changeset
|
460 | # obsolete entries below |
8314
e3642a6a1e71
Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8260
diff
changeset
|
461 | "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
|
462 | ] |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
463 | |
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
|
464 | 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
|
465 | |
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
|
466 | |
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
|
467 | 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
|
468 | """ |
884182bfd25c
install, uninstall: started to add capability to generate Desktop and Start Menu entries on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6500
diff
changeset
|
469 | 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
|
470 | |
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 | @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
|
472 | @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
|
473 | """ |
884182bfd25c
install, uninstall: started to add capability to generate Desktop and Start Menu entries on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6500
diff
changeset
|
474 | majorVersion, minorVersion = sys.version_info[:2] |
8314
e3642a6a1e71
Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8260
diff
changeset
|
475 | 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
|
476 | |
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 | |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
478 | def main(argv): |
2965
d133c7edd88a
Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2736
diff
changeset
|
479 | """ |
d133c7edd88a
Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2736
diff
changeset
|
480 | The main function of the script. |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
481 | |
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
|
482 | @param argv list of command line arguments |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
483 | """ |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
484 | initGlobals() |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
485 | |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
486 | # Parse the command line. |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
487 | global progName |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
488 | progName = os.path.basename(argv[0]) |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
489 | |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
490 | try: |
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
|
491 | optlist, args = getopt.getopt(argv[1:], "hy") |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
492 | except getopt.GetoptError: |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
493 | usage() |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
494 | |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
495 | global platBinDir |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
496 | |
6188
5a6ae3be31e6
Fixed some loop related coding issues detected by the extended code style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
497 | for opt, _arg in optlist: |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
498 | if opt == "-h": |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
499 | usage(0) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
500 | |
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
|
501 | print("\nUninstalling eric ...") |
5055
7db1b9496e52
Some enhancements to the install and uninstall scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4806
diff
changeset
|
502 | uninstallEric() |
7db1b9496e52
Some enhancements to the install and uninstall scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4806
diff
changeset
|
503 | print("\nUninstallation complete.") |
7db1b9496e52
Some enhancements to the install and uninstall scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4806
diff
changeset
|
504 | print() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
505 | |
2654
df2c3218cc5e
Fixed an issue uninstalling eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2383
diff
changeset
|
506 | exit(0) |
df2c3218cc5e
Fixed an issue uninstalling eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2383
diff
changeset
|
507 | |
df2c3218cc5e
Fixed an issue uninstalling eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2383
diff
changeset
|
508 | |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
509 | if __name__ == "__main__": |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
510 | try: |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
511 | main(sys.argv) |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
512 | except SystemExit: |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
513 | 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
|
514 | except Exception: |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
515 | print( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
516 | """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
|
517 | """ the program,\n""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
518 | """including the following traceback, to""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9108
diff
changeset
|
519 | """ 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
|
520 | ) |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
521 | raise |
4566
a2e8f3c420ec
Dealt with the M801 code style checker messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4561
diff
changeset
|
522 | |
a2e8f3c420ec
Dealt with the M801 code style checker messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4561
diff
changeset
|
523 | # |
a2e8f3c420ec
Dealt with the M801 code style checker messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4561
diff
changeset
|
524 | # eflag: noqa = M801 |