Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/sugar/bundle/bundle.py
diff options
context:
space:
mode:
authorDan Winship <dwinship@redhat.com>2007-10-04 18:58:43 (GMT)
committer Dan Winship <dwinship@redhat.com>2007-10-04 18:58:43 (GMT)
commitb82c9c2c2f872eecd95f802b28b0bdadbb5472ed (patch)
tree037370aad0116d196e73bb36eb8ccb92c58e9ee0 /sugar/bundle/bundle.py
parent380f3a2275002cfeea905c2478dcf19cc674f1ba (diff)
Reorganize the uninstall code for #3151
(Make it so you can build a Bundle object from the zip file but still use its uninstall() method to uninstall the unzipped version.)
Diffstat (limited to 'sugar/bundle/bundle.py')
-rw-r--r--sugar/bundle/bundle.py28
1 files changed, 13 insertions, 15 deletions
diff --git a/sugar/bundle/bundle.py b/sugar/bundle/bundle.py
index 2657846..8ce3dda 100644
--- a/sugar/bundle/bundle.py
+++ b/sugar/bundle/bundle.py
@@ -130,19 +130,17 @@ class Bundle:
zip.write(filename, os.path.join(base_dir, filename))
zip.close()
- def _uninstall(self):
- ext = os.path.splitext(self._path)[1]
- if self._unpacked:
- if not os.path.isdir(self._path) or ext != self._unzipped_extension:
- raise InvalidPathException
- for root, dirs, files in os.walk(self._path, topdown=False):
- for name in files:
- os.remove(os.path.join(root, name))
- for name in dirs:
- os.rmdir(os.path.join(root, name))
- os.rmdir(self._path)
- else:
- if not os.path.isfile(self._path) or ext != self._zipped_extension:
+ def _uninstall(self, install_path):
+ if not os.path.isdir(install_path):
+ raise InvalidPathException
+ if self._unzipped_extension is not None:
+ ext = os.path.splitext(install_path)[1]
+ if ext != self._unzipped_extension:
raise InvalidPathException
- os.remove(self._path)
-
+
+ for root, dirs, files in os.walk(install_path, topdown=False):
+ for name in files:
+ os.remove(os.path.join(root, name))
+ for name in dirs:
+ os.rmdir(os.path.join(root, name))
+ os.rmdir(install_path)