13 import os |
13 import os |
14 import shutil |
14 import shutil |
15 import glob |
15 import glob |
16 import distutils.sysconfig |
16 import distutils.sysconfig |
17 |
17 |
|
18 # get a local eric5config.py out of the way |
|
19 if os.path.exists("eric5config.py"): |
|
20 os.rename("eric5config.py", "eric5config.py.orig") |
18 from eric5config import getConfig |
21 from eric5config import getConfig |
19 |
22 |
20 # Define the globals. |
23 # Define the globals. |
21 progName = None |
24 progName = None |
22 pyModDir = None |
25 pyModDir = None |
23 progLanguages = ["Python", "Ruby"] |
26 progLanguages = ["Python", "Ruby"] |
24 |
27 |
25 |
28 |
|
29 def exit(rcode=0): |
|
30 """ |
|
31 Exit the uninstall script. |
|
32 """ |
|
33 # restore the local eric5config.py |
|
34 if os.path.exists("eric5config.py.orig"): |
|
35 if os.path.exists("eric5config.py"): |
|
36 os.remove("eric5config.py") |
|
37 os.rename("eric5config.py.orig", "eric5config.py") |
|
38 |
|
39 |
26 def usage(rcode=2): |
40 def usage(rcode=2): |
27 """Display a usage message and exit. |
41 """Display a usage message and exit. |
28 |
42 |
29 rcode is the return code passed back to the calling process. |
43 rcode is the return code passed back to the calling process. |
30 """ |
44 """ |
139 # delete the Mac app bundle |
153 # delete the Mac app bundle |
140 if os.path.exists("/Developer/Applications/Eric5"): |
154 if os.path.exists("/Developer/Applications/Eric5"): |
141 shutil.rmtree("/Developer/Applications/Eric5") |
155 shutil.rmtree("/Developer/Applications/Eric5") |
142 if os.path.exists("/Applications/eric5.app"): |
156 if os.path.exists("/Applications/eric5.app"): |
143 shutil.rmtree("/Applications/eric5.app") |
157 shutil.rmtree("/Applications/eric5.app") |
144 |
158 |
145 |
159 |
146 def main(argv): |
160 def main(argv): |
147 """The main function of the script. |
161 """The main function of the script. |
148 |
162 |
149 argv is the list of command line arguments. |
163 argv is the list of command line arguments. |
172 except IOError as msg: |
186 except IOError as msg: |
173 sys.stderr.write('IOError: {0}\nTry uninstall with admin rights.\n'.format(msg)) |
187 sys.stderr.write('IOError: {0}\nTry uninstall with admin rights.\n'.format(msg)) |
174 except OSError as msg: |
188 except OSError as msg: |
175 sys.stderr.write('OSError: {0}\nTry uninstall with admin rights.\n'.format(msg)) |
189 sys.stderr.write('OSError: {0}\nTry uninstall with admin rights.\n'.format(msg)) |
176 |
190 |
177 |
191 exit(0) |
|
192 |
|
193 |
178 if __name__ == "__main__": |
194 if __name__ == "__main__": |
179 try: |
195 try: |
180 main(sys.argv) |
196 main(sys.argv) |
181 except SystemExit: |
197 except SystemExit: |
182 raise |
198 raise |