[Sugar-devel] [PATCH] Delete activities profile data when uninstall

Martin Abente mabente at paraguayeduca.org
Mon Jul 5 15:49:10 EDT 2010


When activities are uninstalled, profile data persists. Profile
data can consume a lot of disk space. Therefore it is necessary
to delete it.

More info http://bugs.sugarlabs.org/ticket/2074
---
 src/sugar/bundle/activitybundle.py |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/src/sugar/bundle/activitybundle.py b/src/sugar/bundle/activitybundle.py
index c83257f..51ad312 100644
--- a/src/sugar/bundle/activitybundle.py
+++ b/src/sugar/bundle/activitybundle.py
@@ -25,6 +25,7 @@ import locale
 import os
 import tempfile
 import logging
+import shutil
 
 from sugar import env
 from sugar import util
@@ -417,6 +418,10 @@ class ActivityBundle(Bundle):
                        os.readlink(path).startswith(install_path):
                         os.remove(path)
 
+        profile_path = env.get_profile_path(self._bundle_id)
+        if os.path.exists(profile_path):
+            shutil.rmtree(profile_path)
+
         self._uninstall(install_path)
 
     def is_user_activity(self):
-- 
1.6.0.4



More information about the Sugar-devel mailing list