diff --git a/NEWS b/NEWS index 21cd9e7c..1da917ce 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,5 @@ +* #3025: Make bundlebuilder work even if SUGAR_PREFIX is not set. (marco) + Snapshot 0b3f687749 * #3088: Fix style of zoom buttons palettes. (marco) diff --git a/services/shell/bundleregistry.py b/services/shell/bundleregistry.py index 19d00328..fbcef878 100644 --- a/services/shell/bundleregistry.py +++ b/services/shell/bundleregistry.py @@ -56,7 +56,7 @@ class _ServiceManager(object): def add(self, bundle): util.write_service(bundle.get_service_name(), - bundle.get_exec(), self._path) + bundle.get_command(), self._path) class BundleRegistry(gobject.GObject): """Service that tracks the available activity bundles""" diff --git a/sugar/activity/activityfactoryservice.py b/sugar/activity/activityfactoryservice.py index 63265a13..682abaa0 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 8bf33866..cccff5ae 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"""