Changed the uninstall code for Mac platforms.

Sun, 20 Jul 2014 13:08:49 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sun, 20 Jul 2014 13:08:49 +0200
changeset 3714
4080395e3426
parent 3709
191ccdf78966
child 3715
eabefe4e41a4

Changed the uninstall code for Mac platforms.

install.py file | annotate | diff | comparison | revisions
uninstall.py file | annotate | diff | comparison | revisions
--- a/install.py	Sat Jul 19 15:38:53 2014 +0200
+++ b/install.py	Sun Jul 20 13:08:49 2014 +0200
@@ -43,6 +43,7 @@
 sourceDir = "eric"
 configName = 'eric6config.py'
 defaultMacAppBundleName = "eric6.app"
+defaultMacAppBundlePath = "/Applications"
 macAppBundleName = "eric6.app"
 macAppBundlePath = "/Applications"
 macPythonExe = "{0}/Resources/Python.app/Contents/MacOS/Python".format(
@@ -475,19 +476,19 @@
         
         if sys.platform == "darwin":
             # delete the Mac app bundle
-            if os.path.exists("/Developer/Applications/Eric6"):
-                shutil.rmtree("/Developer/Applications/Eric6")
             try:
                 macAppBundlePath = getConfig("macAppBundlePath")
                 macAppBundleName = getConfig("macAppBundleName")
             except AttributeError:
-                macAppBundlePath = "/Applications"
-                macAppBundleName = "eric6.app"
-            if os.path.exists("/Applications/" + macAppBundleName):
-                shutil.rmtree("/Applications/" + macAppBundleName)
-            bundlePath = os.path.join(macAppBundlePath, macAppBundleName)
-            if os.path.exists(bundlePath):
-                shutil.rmtree(bundlePath)
+                macAppBundlePath = defaultMacAppBundlePath
+                macAppBundleName = defaultMacAppBundleName
+            for bundlePath in [os.path.join(defaultMacAppBundleName,
+                                            macAppBundleName),
+                               os.path.join(macAppBundlePath,
+                                            macAppBundleName),
+                               ]:
+                if os.path.exists(bundlePath):
+                    shutil.rmtree(bundlePath)
     except (IOError, OSError) as msg:
         sys.stderr.write(
             'Error: {0}\nTry install with admin rights.\n'.format(msg))
--- a/uninstall.py	Sat Jul 19 15:38:53 2014 +0200
+++ b/uninstall.py	Sun Jul 20 13:08:49 2014 +0200
@@ -27,6 +27,8 @@
 pyModDir = None
 progLanguages = ["Python", "Ruby", "QSS"]
 includePythonVariant = False
+defaultMacAppBundleName = "eric6.app"
+defaultMacAppBundlePath = "/Applications"
 
 # Define file name markers for Python variants
 PythonMarkers = {
@@ -174,13 +176,15 @@
                 macAppBundlePath = getConfig("macAppBundlePath")
                 macAppBundleName = getConfig("macAppBundleName")
             except AttributeError:
-                macAppBundlePath = "/Applications"
-                macAppBundleName = "eric6.app"
-            if os.path.exists("/Applications/" + macAppBundleName):
-                shutil.rmtree("/Applications/" + macAppBundleName)
-            bundlePath = os.path.join(macAppBundlePath, macAppBundleName)
-            if os.path.exists(bundlePath):
-                shutil.rmtree(bundlePath)
+                macAppBundlePath = defaultMacAppBundlePath
+                macAppBundleName = defaultMacAppBundleName
+            for bundlePath in [os.path.join(defaultMacAppBundleName,
+                                            macAppBundleName),
+                               os.path.join(macAppBundlePath,
+                                            macAppBundleName),
+                               ]:
+                if os.path.exists(bundlePath):
+                    shutil.rmtree(bundlePath)
     except (IOError, OSError) as msg:
         sys.stderr.write(
             'Error: {0}\nTry uninstall with admin rights.\n'.format(msg))

eric ide

mercurial