Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/sugar/activity
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <mpg@redhat.com>2007-03-09 13:57:54 (GMT)
committer Marco Pesenti Gritti <mpg@redhat.com>2007-03-09 13:57:54 (GMT)
commit57c928916ca7cdacd728834a9b59ecc33b55339e (patch)
tree2cc618248d665cde0790853d0d169754271fd21c /sugar/activity
parenta380b7f915ca32293315176027f835fb739bb86b (diff)
Refactor sugar.env and paths
Diffstat (limited to 'sugar/activity')
-rw-r--r--sugar/activity/bundle.py3
-rw-r--r--sugar/activity/bundlebuilder.py4
-rw-r--r--sugar/activity/bundleregistry.py18
3 files changed, 18 insertions, 7 deletions
diff --git a/sugar/activity/bundle.py b/sugar/activity/bundle.py
index 283204f..8980a11 100644
--- a/sugar/activity/bundle.py
+++ b/sugar/activity/bundle.py
@@ -44,8 +44,7 @@ class Bundle:
if cp.has_option(section, 'class'):
self._class = cp.get(section, 'class')
self._exec = '%s %s --bundle-path="%s"' % (
- os.path.join(env.get_shell_bin_dir(), _PYTHON_FACTORY),
- self._class, self.get_path())
+ env.get_bin_path(_PYTHON_FACTORY), self._class, self.get_path())
elif cp.has_option(section, 'exec'):
self._class = None
self._exec = cp.get(section, 'exec')
diff --git a/sugar/activity/bundlebuilder.py b/sugar/activity/bundlebuilder.py
index c223bfa..120e7b8 100644
--- a/sugar/activity/bundlebuilder.py
+++ b/sugar/activity/bundlebuilder.py
@@ -93,7 +93,7 @@ def _get_install_dir(prefix):
return os.path.join(prefix, 'share/activities')
def _get_bundle_path():
- return os.path.join(env.get_user_activities_dir(), _get_bundle_dir())
+ return os.path.join(env.get_user_activities_path(), _get_bundle_dir())
def _get_package_name():
bundle = Bundle(_get_source_path())
@@ -120,7 +120,7 @@ setup.py help - print this message \n\
'
def cmd_dev():
- bundle_path = os.path.join(env.get_user_activities_dir(), _get_bundle_dir())
+ bundle_path = os.path.join(env.get_user_activities_path(), _get_bundle_dir())
try:
os.symlink(_get_source_path(), bundle_path)
except OSError:
diff --git a/sugar/activity/bundleregistry.py b/sugar/activity/bundleregistry.py
index 08f543f..2ad68ed 100644
--- a/sugar/activity/bundleregistry.py
+++ b/sugar/activity/bundleregistry.py
@@ -1,14 +1,26 @@
import os
from ConfigParser import ConfigParser
+
import gobject
from sugar.activity.bundle import Bundle
from sugar import env
from sugar import util
+# http://standards.freedesktop.org/basedir-spec/basedir-spec-0.6.html
+def _get_data_dirs():
+ if os.environ.has_key('XDG_DATA_DIRS'):
+ return os.environ['XDG_DATA_DIRS'].split(':')
+ else:
+ return [ '/usr/local/share/', '/usr/share/' ]
+
class _ServiceManager(object):
def __init__(self):
- self._path = env.get_user_service_dir()
+ service_dir = os.path.expanduser('~/.local/share/dbus-1/services')
+ if not os.path.isdir(service_dir):
+ os.makedirs(service_dir)
+
+ self._path = service_dir
def add(self, bundle):
util.write_service(bundle.get_service_name(),
@@ -74,8 +86,8 @@ def get_registry():
_bundle_registry = BundleRegistry()
-for path in env.get_data_dirs():
+for path in _get_data_dirs():
bundles_path = os.path.join(path, 'activities')
_bundle_registry.add_search_path(bundles_path)
-_bundle_registry.add_search_path(env.get_user_activities_dir())
+_bundle_registry.add_search_path(env.get_user_activities_path())