uninstall.py

Sat, 01 Sep 2018 10:39:08 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 01 Sep 2018 10:39:08 +0200
branch
maintenance
changeset 6490
7bbc72701f0a
parent 6365
85f8745427a6
child 6495
6e73d31af3af
permissions
-rw-r--r--

Re-merged with "default" branch in order to include some last minute fixes in the next release.

12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
1 #!/usr/bin/env python3
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2 # -*- coding: utf-8 -*-
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
3
6048
82ad8ec9548c Updated copyright for 2018.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5823
diff changeset
4 # Copyright (c) 2002 - 2018 Detlev Offenbach <detlev@die-offenbachs.de>
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
5 #
3670
f0cb7579c0b4 Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3621
diff changeset
6 # This is the uninstall script for eric6.
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 """
3670
f0cb7579c0b4 Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3621
diff changeset
10 Uninstallation script for the eric6 IDE and all eric6 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
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
13 from __future__ import unicode_literals, print_function
2525
8b507a9a2d40 Script changes: Future import added, super calls modified and unicode behavior for str.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2383
diff changeset
14
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
15 import sys
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
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
18 import glob
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
19 import distutils.sysconfig
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
20
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
21 if sys.version_info[0] == 2:
6364
6a496f0886ad Prepared the "import sip" statements for PyQt 5.11.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6303
diff changeset
22 try:
6365
85f8745427a6 Redid the "import sip" statements for PyQt 5.11.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6364
diff changeset
23 from PyQt5 import sip
6364
6a496f0886ad Prepared the "import sip" statements for PyQt 5.11.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6303
diff changeset
24 except ImportError:
6365
85f8745427a6 Redid the "import sip" statements for PyQt 5.11.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6364
diff changeset
25 import sip
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
26 sip.setapi('QString', 2)
5068
3a5e58eeb64a Fixed a few issues found by the updated pyflakes checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5055
diff changeset
27 else:
3a5e58eeb64a Fixed a few issues found by the updated pyflakes checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5055
diff changeset
28 raw_input = input
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
29
3670
f0cb7579c0b4 Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3621
diff changeset
30 # get a local eric6config.py out of the way
f0cb7579c0b4 Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3621
diff changeset
31 if os.path.exists("eric6config.py"):
f0cb7579c0b4 Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3621
diff changeset
32 os.rename("eric6config.py", "eric6config.py.orig")
f0cb7579c0b4 Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3621
diff changeset
33 from eric6config import getConfig
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
34
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
35 # Define the globals.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
36 progName = None
5433
e1c50b88fc43 Little fix for the uninstall script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
37 currDir = os.getcwd()
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
38 pyModDir = None
3468
869d0b6e1e16 Added an API file for QSS and corrected an issue in the APIs manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
39 progLanguages = ["Python", "Ruby", "QSS"]
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
40 includePythonVariant = False
3714
4080395e3426 Changed the uninstall code for Mac platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3697
diff changeset
41 defaultMacAppBundleName = "eric6.app"
4080395e3426 Changed the uninstall code for Mac platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3697
diff changeset
42 defaultMacAppBundlePath = "/Applications"
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
43 settingsNameOrganization = "Eric6"
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
44 settingsNameGlobal = "eric6"
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
45
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
46 # Define file name markers for Python variants
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
47 PythonMarkers = {
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
48 2: "_py2",
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
49 3: "_py3",
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
50 }
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
51
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 908
diff changeset
52
2654
df2c3218cc5e Fixed an issue uninstalling eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2383
diff changeset
53 def exit(rcode=0):
df2c3218cc5e Fixed an issue uninstalling eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2383
diff changeset
54 """
df2c3218cc5e Fixed an issue uninstalling eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2383
diff changeset
55 Exit the uninstall script.
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
56
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
57 @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
58 """
5055
7db1b9496e52 Some enhancements to the install and uninstall scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4806
diff changeset
59 global currDir
7db1b9496e52 Some enhancements to the install and uninstall scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4806
diff changeset
60
3670
f0cb7579c0b4 Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3621
diff changeset
61 # restore the local eric6config.py
f0cb7579c0b4 Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3621
diff changeset
62 if os.path.exists("eric6config.py.orig"):
f0cb7579c0b4 Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3621
diff changeset
63 if os.path.exists("eric6config.py"):
f0cb7579c0b4 Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3621
diff changeset
64 os.remove("eric6config.py")
f0cb7579c0b4 Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3621
diff changeset
65 os.rename("eric6config.py.orig", "eric6config.py")
5055
7db1b9496e52 Some enhancements to the install and uninstall scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4806
diff changeset
66
7db1b9496e52 Some enhancements to the install and uninstall scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4806
diff changeset
67 if sys.platform.startswith("win"):
7db1b9496e52 Some enhancements to the install and uninstall scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4806
diff changeset
68 # different meaning of input between Py2 and Py3
7db1b9496e52 Some enhancements to the install and uninstall scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4806
diff changeset
69 try:
7db1b9496e52 Some enhancements to the install and uninstall scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4806
diff changeset
70 input("Press enter to continue...")
7db1b9496e52 Some enhancements to the install and uninstall scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4806
diff changeset
71 except (EOFError, SyntaxError):
7db1b9496e52 Some enhancements to the install and uninstall scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4806
diff changeset
72 pass
7db1b9496e52 Some enhancements to the install and uninstall scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4806
diff changeset
73
7db1b9496e52 Some enhancements to the install and uninstall scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4806
diff changeset
74 os.chdir(currDir)
7db1b9496e52 Some enhancements to the install and uninstall scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4806
diff changeset
75
7db1b9496e52 Some enhancements to the install and uninstall scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4806
diff changeset
76 sys.exit(rcode)
2654
df2c3218cc5e Fixed an issue uninstalling eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2383
diff changeset
77
df2c3218cc5e Fixed an issue uninstalling eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2383
diff changeset
78
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 908
diff changeset
79 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
80 """
d133c7edd88a Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2736
diff changeset
81 Display a usage message and exit.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
82
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
83 @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
84 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
85 global progName
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
86
12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
87 print("Usage:")
428
58405c24aa09 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 146
diff changeset
88 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
89 print("where:")
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
90 print(" -h display this help message")
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
91 print(" -y remove executables with Python variant in name")
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
92
2654
df2c3218cc5e Fixed an issue uninstalling eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2383
diff changeset
93 exit(rcode)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
94
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
95
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
96 def initGlobals():
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
97 """
2965
d133c7edd88a Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2736
diff changeset
98 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
99 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
100 global pyModDir
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
101
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
102 pyModDir = distutils.sysconfig.get_python_lib(True)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
103
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
104
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 908
diff changeset
105 def wrapperName(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
106 """
d133c7edd88a Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2736
diff changeset
107 Create the platform specific name for the wrapper script.
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
108
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
109 @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
110 @param wfile basename (without extension) of the wrapper script
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
111 @return the name of the wrapper script
0
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 if sys.platform.startswith("win"):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
114 wname = dname + "\\" + wfile + ".bat"
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
115 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
116 wname = dname + "/" + wfile
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
117
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
118 return wname
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
119
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
120
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
121 def uninstallEric():
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
122 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
123 Uninstall the eric files.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
124 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
125 global pyModDir
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
126
146
afeb742e7148 Added installation of a .desktop file for Linux systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 107
diff changeset
127 # 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
128 if sys.platform.startswith("linux"):
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
129 if os.getuid() == 0:
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
130 for name in ["/usr/share/pixmaps/eric.png",
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
131 "/usr/share/pixmaps/ericWeb.png"]:
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
132 if os.path.exists(name):
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
133 os.remove(name)
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
134 if includePythonVariant:
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
135 marker = PythonMarkers[sys.version_info.major]
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
136 else:
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
137 marker = ""
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
138 for name in [
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
139 "/usr/share/applications/eric6" + marker + ".desktop",
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
140 "/usr/share/appdata/eric6" + marker + ".appdata.xml",
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
141 "/usr/share/metainfo/eric6" + marker + ".appdata.xml",
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
142 "/usr/share/applications/eric6_webbrowser" + marker +
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
143 ".desktop",
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
144 "/usr/share/applications/eric6_browser" + marker +
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
145 ".desktop",
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
146 "/usr/share/pixmaps/eric" + marker + ".png",
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
147 "/usr/share/pixmaps/ericWeb" + marker + ".png",
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
148 ]:
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
149 if os.path.exists(name):
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
150 os.remove(name)
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
151 elif os.getuid() >= 1000:
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
152 # it is assumed that user ids start at 1000
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
153 for name in ["~/.local/share/pixmaps/eric.png",
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
154 "~/.local/share/pixmaps/ericWeb.png"]:
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
155 path = os.path.expanduser(name)
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
156 if os.path.exists(path):
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
157 os.remove(path)
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
158 if includePythonVariant:
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
159 marker = PythonMarkers[sys.version_info.major]
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
160 else:
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
161 marker = ""
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
162 for name in [
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
163 "~/.local/share/applications/eric6" + marker + ".desktop",
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
164 "~/.local/share/appdata/eric6" + marker + ".appdata.xml",
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
165 "~/.local/share/metainfo/eric6" + marker + ".appdata.xml",
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
166 "~/.local/share/applications/eric6_webbrowser" + marker +
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
167 ".desktop",
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
168 "~/.local/share/applications/eric6_browser" + marker +
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
169 ".desktop",
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
170 "~/.local/share/pixmaps/eric" + marker + ".png",
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
171 "~/.local/share/pixmaps/ericWeb" + marker + ".png",
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
172 ]:
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
173 path = os.path.expanduser(name)
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
174 if os.path.exists(path):
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
175 os.remove(path)
146
afeb742e7148 Added installation of a .desktop file for Linux systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 107
diff changeset
176
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
177 # Remove the wrapper scripts
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
178 rem_wnames = [
3670
f0cb7579c0b4 Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3621
diff changeset
179 "eric6_api", "eric6_compare",
f0cb7579c0b4 Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3621
diff changeset
180 "eric6_configure", "eric6_diff",
f0cb7579c0b4 Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3621
diff changeset
181 "eric6_doc", "eric6_qregularexpression",
f0cb7579c0b4 Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3621
diff changeset
182 "eric6_qregexp", "eric6_re",
f0cb7579c0b4 Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3621
diff changeset
183 "eric6_trpreviewer", "eric6_uipreviewer",
f0cb7579c0b4 Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3621
diff changeset
184 "eric6_unittest", "eric6",
f0cb7579c0b4 Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3621
diff changeset
185 "eric6_tray", "eric6_editor",
f0cb7579c0b4 Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3621
diff changeset
186 "eric6_plugininstall", "eric6_pluginuninstall",
f0cb7579c0b4 Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3621
diff changeset
187 "eric6_pluginrepository", "eric6_sqlbrowser",
f0cb7579c0b4 Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3621
diff changeset
188 "eric6_webbrowser", "eric6_iconeditor",
4806
5c0745cb26ea Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4746
diff changeset
189 "eric6_snap", "eric6_hexeditor", "eric6_browser",
5711
50b6867ffcd3 Finished implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5433
diff changeset
190 "eric6_shell",
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
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 if includePythonVariant:
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 marker = PythonMarkers[sys.version_info.major]
3678
2866383fd342 Adjusted the install and uninstall scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3670
diff changeset
194 rem_wnames = [n + marker for n in rem_wnames]
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
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 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
197 for rem_wname in rem_wnames:
137370f7114b Added the '-y' switch to the install script to allow to install Python2 and Python3 variants of eric5 in parallel by giving the startup script a '_py2' or '_py3' postfix.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3515
diff changeset
198 rwname = wrapperName(getConfig('bindir'), rem_wname)
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 if os.path.exists(rwname):
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
200 os.remove(rwname)
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
201
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
202 # Cleanup our config file(s)
3670
f0cb7579c0b4 Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3621
diff changeset
203 for name in ['eric6config.py', 'eric6config.pyc', 'eric6.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
204 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
205 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
206 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
207 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
208 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
209 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
210 os.remove(f)
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
211
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
212 # Cleanup the install directories
3621
15f23ed3f216 Fixed a few source code style issues found by the updated pe8 checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3597
diff changeset
213 for name in ['ericExamplesDir', 'ericDocDir', 'ericDTDDir',
15f23ed3f216 Fixed a few source code style issues found by the updated pe8 checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3597
diff changeset
214 'ericCSSDir', 'ericIconDir', 'ericPixDir',
15f23ed3f216 Fixed a few source code style issues found by the updated pe8 checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3597
diff changeset
215 'ericTemplatesDir', 'ericCodeTemplatesDir',
15f23ed3f216 Fixed a few source code style issues found by the updated pe8 checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3597
diff changeset
216 'ericOthersDir', 'ericStylesDir', 'ericDir']:
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
217 dirpath = getConfig(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
218 if os.path.exists(dirpath):
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
219 shutil.rmtree(dirpath, True)
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
220
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
221 # 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
222 for name in glob.glob(
3670
f0cb7579c0b4 Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3621
diff changeset
223 os.path.join(getConfig('ericTranslationsDir'), 'eric6_*.qm')):
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 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
225 os.remove(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
226
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
227 # Cleanup API files
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
228 apidir = getConfig('apidir')
3948
6c3720179d6b Extended the install script to improve cooperation with packagers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3943
diff changeset
229 if apidir:
6c3720179d6b Extended the install script to improve cooperation with packagers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3943
diff changeset
230 for progLanguage in progLanguages:
6c3720179d6b Extended the install script to improve cooperation with packagers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3943
diff changeset
231 for name in getConfig('apis'):
6c3720179d6b Extended the install script to improve cooperation with packagers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3943
diff changeset
232 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
233 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
234 os.remove(apiname)
6c3720179d6b Extended the install script to improve cooperation with packagers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3943
diff changeset
235 for apiname in glob.glob(
6c3720179d6b Extended the install script to improve cooperation with packagers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3943
diff changeset
236 os.path.join(apidir, progLanguage.lower(), "*.bas")):
6c3720179d6b Extended the install script to improve cooperation with packagers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3943
diff changeset
237 if os.path.basename(apiname) != "eric6.bas":
6c3720179d6b Extended the install script to improve cooperation with packagers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3943
diff changeset
238 os.remove(apiname)
3597
137370f7114b Added the '-y' switch to the install script to allow to install Python2 and Python3 variants of eric5 in parallel by giving the startup script a '_py2' or '_py3' postfix.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3515
diff changeset
239
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 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
241 # delete the Mac app bundle
3670
f0cb7579c0b4 Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3621
diff changeset
242 if os.path.exists("/Developer/Applications/Eric6"):
f0cb7579c0b4 Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3621
diff changeset
243 shutil.rmtree("/Developer/Applications/Eric6")
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
244 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
245 macAppBundlePath = getConfig("macAppBundlePath")
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
246 macAppBundleName = getConfig("macAppBundleName")
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
247 except AttributeError:
3714
4080395e3426 Changed the uninstall code for Mac platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3697
diff changeset
248 macAppBundlePath = defaultMacAppBundlePath
4080395e3426 Changed the uninstall code for Mac platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3697
diff changeset
249 macAppBundleName = defaultMacAppBundleName
3955
9c3e54d351e2 Changed some code in the install script to improve virtualenv support for Mac.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3948
diff changeset
250 for bundlePath in [os.path.join(defaultMacAppBundlePath,
3714
4080395e3426 Changed the uninstall code for Mac platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3697
diff changeset
251 macAppBundleName),
4080395e3426 Changed the uninstall code for Mac platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3697
diff changeset
252 os.path.join(macAppBundlePath,
4080395e3426 Changed the uninstall code for Mac platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3697
diff changeset
253 macAppBundleName),
4080395e3426 Changed the uninstall code for Mac platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3697
diff changeset
254 ]:
4080395e3426 Changed the uninstall code for Mac platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3697
diff changeset
255 if os.path.exists(bundlePath):
4080395e3426 Changed the uninstall code for Mac platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3697
diff changeset
256 shutil.rmtree(bundlePath)
4559
5af0cda900b3 Changed unistall.py to end with a message.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
257
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
258 # 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
259 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
260
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
261 # 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
262 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
263
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
264 # 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
265 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
266
4559
5af0cda900b3 Changed unistall.py to end with a message.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
267 print("\nUninstallation completed")
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
268 except (IOError, OSError) as msg:
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
269 sys.stderr.write(
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
270 'Error: {0}\nTry uninstall with admin rights.\n'.format(msg))
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
271 exit(7)
2654
df2c3218cc5e Fixed an issue uninstalling eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2383
diff changeset
272
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 908
diff changeset
273
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
274 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
275 """
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
276 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
277 """
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
278 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
279
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
280 globalPluginsDir = os.path.join(getConfig('mdir'), "eric6plugins")
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
281 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
282 pathsToRemove.append(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
283
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
284 localPluginsDir = os.path.join(getConfigDir(), "eric6plugins")
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
285 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
286 pathsToRemove.append(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
287
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
288 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
289 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
290 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
291 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
292 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
293 while answer not in ["y", "Y", "n", "N", ""]:
5068
3a5e58eeb64a Fixed a few issues found by the updated pyflakes checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5055
diff changeset
294 answer = raw_input(
3a5e58eeb64a Fixed a few issues found by the updated pyflakes checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5055
diff changeset
295 "Shall these directories be removed (y/N)? ")
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
296 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
297 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
298 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
299
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
300
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
301 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
302 """
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
303 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
304 """
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
305 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
306 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
307 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
308 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
309 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
310 while answer not in ["y", "Y", "n", "N", ""]:
5068
3a5e58eeb64a Fixed a few issues found by the updated pyflakes checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5055
diff changeset
311 answer = raw_input(
3a5e58eeb64a Fixed a few issues found by the updated pyflakes checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5055
diff changeset
312 "Shall this directory be removed (y/N)? ")
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
313 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
314 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
315
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
316
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
317 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
318 """
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
319 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
320 """
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
321 try:
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
322 from PyQt5.QtCore import QSettings
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
323 except ImportError:
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
324 try:
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
325 from PyQt4.QtCore import QSettings
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
326 except ImportError:
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
327 print("No PyQt variant installed. The 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
328 print("cannot be determined. You have to remove it manually.\n")
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
329 return
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
330
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
331 settings = QSettings(QSettings.IniFormat, QSettings.UserScope,
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
332 settingsNameOrganization, settingsNameGlobal)
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
333 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
334 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
335 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
336 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
337 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
338 while answer not in ["y", "Y", "n", "N", ""]:
5068
3a5e58eeb64a Fixed a few issues found by the updated pyflakes checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5055
diff changeset
339 answer = raw_input(
3a5e58eeb64a Fixed a few issues found by the updated pyflakes checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5055
diff changeset
340 "Shall this directory be removed (y/N)? ")
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
341 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
342 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
343
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
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 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
346 """
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 Module function to get the name of the directory storing the config data.
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
5bc6ed226471 Extended the uninstall script to remove the plug-ins directories, the data directory and the configuration directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4559
diff changeset
349 @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
350 """
6303
ec9ebaf206fb Got rid of the Windows "DotNet"-Hack (i.e. using _ instead of . as first character of special directories).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6214
diff changeset
351 cdn = ".eric6"
5823
70dfe6a4aa03 Fixed an issue getting the home directory during uninstallation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5711
diff changeset
352 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
353
5bc6ed226471 Extended the uninstall script to remove the plug-ins directories, the data directory and the configuration directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4559
diff changeset
354
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
355 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
356 """
d133c7edd88a Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2736
diff changeset
357 The main function of the script.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
358
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
359 @param argv list of command line arguments
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
360 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
361 import getopt
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
362
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
363 global includePythonVariant
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
364
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
365 initGlobals()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
366
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
367 # Parse the command line.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
368 global progName
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
369 progName = os.path.basename(argv[0])
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
370
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
371 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
372 optlist, args = getopt.getopt(argv[1:], "hy")
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
373 except getopt.GetoptError:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
374 usage()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
375
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
376 global platBinDir
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
377
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
378 for opt, _arg in optlist:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
379 if opt == "-h":
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
380 usage(0)
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
381 if opt == "-y":
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
382 includePythonVariant = True
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
383
5055
7db1b9496e52 Some enhancements to the install and uninstall scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4806
diff changeset
384 print("\nUninstalling eric6 ...")
7db1b9496e52 Some enhancements to the install and uninstall scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4806
diff changeset
385 uninstallEric()
7db1b9496e52 Some enhancements to the install and uninstall scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4806
diff changeset
386 print("\nUninstallation complete.")
7db1b9496e52 Some enhancements to the install and uninstall scripts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4806
diff changeset
387 print()
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
388
2654
df2c3218cc5e Fixed an issue uninstalling eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2383
diff changeset
389 exit(0)
df2c3218cc5e Fixed an issue uninstalling eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2383
diff changeset
390
df2c3218cc5e Fixed an issue uninstalling eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2383
diff changeset
391
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
392 if __name__ == "__main__":
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
393 try:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
394 main(sys.argv)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
395 except SystemExit:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
396 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
397 except Exception:
3039
8dd0165d805d Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3019
diff changeset
398 print("""An internal error occured. Please report all the output of"""
8dd0165d805d Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3019
diff changeset
399 """ the program,\n"""
8dd0165d805d Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3019
diff changeset
400 """including the following traceback, to"""
3670
f0cb7579c0b4 Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3621
diff changeset
401 """ eric-bugs@eric-ide.python-projects.org.\n""")
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
402 raise
4566
a2e8f3c420ec Dealt with the M801 code style checker messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4561
diff changeset
403
a2e8f3c420ec Dealt with the M801 code style checker messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4561
diff changeset
404 #
a2e8f3c420ec Dealt with the M801 code style checker messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4561
diff changeset
405 # eflag: noqa = M801

eric ide

mercurial