Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/src/sugar/bundle
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <mpgritti@gmail.com>2008-10-06 13:54:46 (GMT)
committer Marco Pesenti Gritti <mpgritti@gmail.com>2008-10-06 13:54:46 (GMT)
commit5c6c7ab1d173d24ea0c72ff4337a08c313bd9761 (patch)
tree245394127a09685ad78a64870f7ef0ea5b86e1bc /src/sugar/bundle
parent0f33a634c0fc58ef61e6820dbf2cee382ab4d281 (diff)
The activity registry is now private to the shell.
Changed the activityfactory to take a bundle instead of a bundle_id so that it doesn't depend on the registry.
Diffstat (limited to 'src/sugar/bundle')
-rw-r--r--src/sugar/bundle/activitybundle.py68
1 files changed, 2 insertions, 66 deletions
diff --git a/src/sugar/bundle/activitybundle.py b/src/sugar/bundle/activitybundle.py
index 7097794..206eeb0 100644
--- a/src/sugar/bundle/activitybundle.py
+++ b/src/sugar/bundle/activitybundle.py
@@ -259,7 +259,6 @@ class ActivityBundle(Bundle):
return command
-
def get_mime_types(self):
"""Get the MIME types supported by the activity"""
return self._mime_types
@@ -268,22 +267,7 @@ class ActivityBundle(Bundle):
"""Get whether there should be a visible launcher for the activity"""
return self._show_launcher
- def is_installed(self):
- if activity.get_registry().get_activity(self._bundle_id):
- return True
- else:
- return False
-
- def need_upgrade(self):
- """Returns True if installing this activity bundle is meaningful -
- that is, if an identical version of this activity is not
- already installed.
-
- Until we have cryptographic hashes to check identity, returns
- True always. See http://dev.laptop.org/ticket/7534."""
- return True
-
- def unpack(self, install_dir, strict_manifest=False):
+ def install(self, install_dir, strict_manifest=False):
self._unzip(install_dir)
install_path = os.path.join(install_dir, self._zip_root_dir)
@@ -352,35 +336,7 @@ class ActivityBundle(Bundle):
os.path.basename(info_file)))
return install_path
- def install(self):
- activities_path = env.get_user_activities_path()
- act = activity.get_registry().get_activity(self._bundle_id)
- if act is not None and act.path.startswith(activities_path):
- raise AlreadyInstalledException
-
- install_dir = env.get_user_activities_path()
- install_path = self.unpack(install_dir)
-
- if not activity.get_registry().add_bundle(install_path):
- raise RegistrationException
-
- def uninstall(self, force=False):
- if self._zip_file is None:
- install_path = self._path
- else:
- if not self.is_installed():
- raise NotInstalledException
-
- act = activity.get_registry().get_activity(self._bundle_id)
- if not force and act.version != self._activity_version:
- logging.warning('Not uninstalling, different bundle present')
- return
- elif not act.path.startswith(env.get_user_activities_path()):
- logging.warning('Not uninstalling system activity')
- return
-
- install_path = act.path
-
+ def uninstall(self, install_path, force=False):
xdg_data_home = os.getenv('XDG_DATA_HOME',
os.path.expanduser('~/.local/share'))
@@ -404,23 +360,3 @@ class ActivityBundle(Bundle):
os.remove(path)
self._uninstall(install_path)
-
- if not activity.get_registry().remove_bundle(install_path):
- raise RegistrationException
-
- def upgrade(self):
- act = activity.get_registry().get_activity(self._bundle_id)
- if act is None:
- logging.warning('Activity not installed')
- elif act.path.startswith(env.get_user_activities_path()):
- try:
- self.uninstall(force=True)
- except Exception, e:
- logging.warning('Uninstall failed (%s), still trying ' \
- 'to install newer bundle', e)
- else:
- logging.warning('Unable to uninstall system activity, ' \
- 'installing upgraded version in user activities')
-
- self.install()
-