Changed the uninstall code for Mac platforms. 5_5_x

Sun, 20 Jul 2014 13:05:58 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sun, 20 Jul 2014 13:05:58 +0200
branch
5_5_x
changeset 3712
09b6f92a82ca
parent 3710
0060733678b0
child 3717
7e3c0ffa307d

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:39:38 2014 +0200
+++ b/install.py	Sun Jul 20 13:05:58 2014 +0200
@@ -47,6 +47,7 @@
 sourceDir = "eric"
 configName = 'eric5config.py'
 defaultMacAppBundleName = "eric5.app"
+defaultMacAppBundlePath = "/Applications"
 macAppBundleName = "eric5.app"
 macAppBundlePath = "/Applications"
 macPythonExe = "{0}/Resources/Python.app/Contents/MacOS/Python".format(
@@ -499,13 +500,15 @@
                 macAppBundlePath = getConfig("macAppBundlePath")
                 macAppBundleName = getConfig("macAppBundleName")
             except AttributeError:
-                macAppBundlePath = "/Applications"
-                macAppBundleName = "eric5.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:39:38 2014 +0200
+++ b/uninstall.py	Sun Jul 20 13:05:58 2014 +0200
@@ -27,6 +27,8 @@
 pyModDir = None
 progLanguages = ["Python", "Ruby", "QSS"]
 includePythonVariant = False
+defaultMacAppBundleName = "eric5.app"
+defaultMacAppBundlePath = "/Applications"
 
 # Define file name markers for Python variants
 PythonMarkers = {
@@ -188,13 +190,15 @@
                 macAppBundlePath = getConfig("macAppBundlePath")
                 macAppBundleName = getConfig("macAppBundleName")
             except AttributeError:
-                macAppBundlePath = "/Applications"
-                macAppBundleName = "eric5.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