Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/sugar
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <mpg@redhat.com>2007-09-03 21:08:49 (GMT)
committer Marco Pesenti Gritti <mpg@redhat.com>2007-09-03 21:08:49 (GMT)
commit3617dd163525a9be18ed91c1b968b460aded7063 (patch)
tree0048f186d2ec2f240ee24b381fb3ffac257d9f9c /sugar
parent382910b0bac9216df4e3ffc79dce1e450fb88afd (diff)
Cleanup Bundle to not require SUGAR_PREFIX to
be set. Also start using properties rather than set/getters.
Diffstat (limited to 'sugar')
-rw-r--r--sugar/activity/activityfactoryservice.py2
-rw-r--r--sugar/activity/bundle.py27
2 files changed, 16 insertions, 13 deletions
diff --git a/sugar/activity/activityfactoryservice.py b/sugar/activity/activityfactoryservice.py
index 63265a1..682abaa 100644
--- a/sugar/activity/activityfactoryservice.py
+++ b/sugar/activity/activityfactoryservice.py
@@ -163,4 +163,4 @@ def run(bundle_path):
_sugarext.set_application_name(bundle.get_name())
factory = ActivityFactoryService(bundle.get_service_name(),
- bundle.get_class())
+ bundle.activity_class)
diff --git a/sugar/activity/bundle.py b/sugar/activity/bundle.py
index 8bf3386..cccff5a 100644
--- a/sugar/activity/bundle.py
+++ b/sugar/activity/bundle.py
@@ -59,6 +59,9 @@ class Bundle:
self._init_with_path(path)
def _init_with_path(self, path):
+ self.activity_class = None
+ self.bundle_exec = None
+
self._name = None
self._icon = None
self._service_name = None
@@ -116,18 +119,10 @@ class Bundle:
logging.error('%s must specify a name' % self._path)
if cp.has_option(section, 'class'):
- self._class = cp.get(section, 'class')
- self._exec = '%s --bundle-path="%s"' % (
- env.get_bin_path(_PYTHON_FACTORY), self._path)
+ self.activity_class = cp.get(section, 'class')
elif cp.has_option(section, 'exec'):
- self._class = None
- cmdline = cp.get(section, 'exec')
- cmdline = os.path.join(self._path, cmdline)
- cmdline = cmdline.replace('$SUGAR_BUNDLE_PATH', self._path)
- cmdline = os.path.expandvars(cmdline)
- self._exec = cmdline
+ self.bundle_exec = cp.get(section, 'exec')
else:
- self._exec = None
self._valid = False
logging.error('%s must specify exec or class' % self._path)
@@ -232,9 +227,17 @@ class Bundle:
"""Get the activity version"""
return self._activity_version
- def get_exec(self):
+ def get_command(self):
"""Get the command to execute to launch the activity factory"""
- return self._exec
+ if self.bundle_exec:
+ command = os.path.join(self._path, self.bundle_exec)
+ command = command.replace('$SUGAR_BUNDLE_PATH', self._path)
+ command = os.path.expandvars(command)
+ else:
+ command = '%s --bundle-path="%s"' % (
+ env.get_bin_path(_PYTHON_FACTORY), self._path)
+
+ return command
def get_class(self):
"""Get the main Activity class"""