Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMartin Abente <mabente@paraguayeduca.org>2010-08-18 14:22:49 (GMT)
committer Martin Abente <mabente@paraguayeduca.org>2010-08-23 18:09:33 (GMT)
commitf0a570b5ae7f74680bd34226fc0b03cbce3e6ba6 (patch)
treec4dca15123dfd0074648c8397cc29e53bb1556cb /src
parentd156ff56a8f63dba184fe0984986bd4f39c206dd (diff)
Delete activities profile data when uninstall #2074
When activities are uninstalled, profile data persists. Profile data can consume a lot of storage space. Therefore it is necessary to delete it when required. Signed-off-by: Martin Abente <mabente@paraguayeduca.org>
Diffstat (limited to 'src')
-rw-r--r--src/sugar/bundle/activitybundle.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/sugar/bundle/activitybundle.py b/src/sugar/bundle/activitybundle.py
index aeec8be..3bbc250 100644
--- a/src/sugar/bundle/activitybundle.py
+++ b/src/sugar/bundle/activitybundle.py
@@ -23,6 +23,7 @@ UNSTABLE.
from ConfigParser import ConfigParser
import locale
import os
+import shutil
import tempfile
import logging
import warnings
@@ -393,7 +394,7 @@ class ActivityBundle(Bundle):
os.unlink(dst)
os.symlink(src, dst)
- def uninstall(self, install_path, force=False):
+ def uninstall(self, install_path, force=False, delete_profile=False):
if os.path.islink(install_path):
# Don't remove the actual activity dir if it's a symbolic link
# because we may be removing user data.
@@ -422,6 +423,12 @@ class ActivityBundle(Bundle):
os.readlink(path).startswith(install_path):
os.remove(path)
+ if delete_profile:
+ bundle_profile_path = env.get_profile_path(self._bundle_id)
+ if os.path.exists(bundle_profile_path):
+ os.chmod(bundle_profile_path, 0775)
+ shutil.rmtree(bundle_profile_path, ignore_errors=True)
+
self._uninstall(install_path)
def is_user_activity(self):