diff options
author | Dan Winship <dwinship@redhat.com> | 2007-10-04 18:58:43 (GMT) |
---|---|---|
committer | Dan Winship <dwinship@redhat.com> | 2007-10-04 18:58:43 (GMT) |
commit | b82c9c2c2f872eecd95f802b28b0bdadbb5472ed (patch) | |
tree | 037370aad0116d196e73bb36eb8ccb92c58e9ee0 /sugar/bundle/contentbundle.py | |
parent | 380f3a2275002cfeea905c2478dcf19cc674f1ba (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/contentbundle.py')
-rw-r--r-- | sugar/bundle/contentbundle.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/sugar/bundle/contentbundle.py b/sugar/bundle/contentbundle.py index 7f9fddb..517ee9a 100644 --- a/sugar/bundle/contentbundle.py +++ b/sugar/bundle/contentbundle.py @@ -21,7 +21,7 @@ from ConfigParser import ConfigParser import os from sugar import env -from sugar.bundle.bundle import Bundle +from sugar.bundle.bundle import Bundle, NotInstalledException class ContentBundle(Bundle): """A Sugar content bundle @@ -178,5 +178,12 @@ class ContentBundle(Bundle): self._run_indexer() def uninstall(self): - self._uninstall() + if self._unpacked: + if not self.is_installed(): + raise NotInstalledException + install_dir = self._path + else: + install_dir = os.path.join(env.get_user_library_path(), + self._zip_root_dir) + self._uninstall(install_dir) self._run_indexer() |