Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Narvaez <dwnarvaez@gmail.com>2012-12-07 14:01:34 (GMT)
committer Daniel Narvaez <dwnarvaez@gmail.com>2012-12-14 10:27:48 (GMT)
commit8855445f81641aeb10504594fb88854de3324999 (patch)
tree40629255f647359e75618f3d4cb138b202db3982
parent7d6c4c93b099b0c99dc27de409a9defe2cf63643 (diff)
Env variables for mime and activities defaults
These are necessary for unit tests because we cannot assume they are installed in the system. Also config.py is not generated inside the jarabe package directory when building out-of-source, so trying to import it fails They might be used for customization too.
-rw-r--r--bin/sugar.in10
-rw-r--r--src/jarabe/model/bundleregistry.py5
2 files changed, 12 insertions, 3 deletions
diff --git a/bin/sugar.in b/bin/sugar.in
index 2df0ab8..e7cb068 100644
--- a/bin/sugar.in
+++ b/bin/sugar.in
@@ -1,5 +1,7 @@
#!/bin/sh
+sugardatadir=@prefix@/share/sugar/data
+
if [ "$(id -u)" -eq 0 -o "$(id -ru)" -eq 0 ] ; then
echo Refusing to run as root.
exit 3
@@ -45,6 +47,14 @@ if test -z "$SUGAR_SCALING"; then
export SUGAR_SCALING=72
fi
+if test -z "$SUGAR_MIME_DEFAULTS"; then
+ export SUGAR_MIME_DEFAULTS="$sugardatadir/mime.defaults"
+fi
+
+if test -z "$SUGAR_ACTIVITIES_DEFAULTS"; then
+ export SUGAR_ACTIVITIES_DEFAULTS="$sugardatadir/activities.defaults"
+fi
+
export GTK2_RC_FILES="@prefix@/share/sugar/data/sugar-$SUGAR_SCALING.gtkrc"
# Needed for executing wpa_passphrase
diff --git a/src/jarabe/model/bundleregistry.py b/src/jarabe/model/bundleregistry.py
index 8a1fa37..0c20b9f 100644
--- a/src/jarabe/model/bundleregistry.py
+++ b/src/jarabe/model/bundleregistry.py
@@ -32,7 +32,6 @@ from sugar3.bundle.bundle import MalformedBundleException, \
AlreadyInstalledException, RegistrationException
from sugar3 import env
-from jarabe import config
from jarabe.model import mimeregistry
@@ -109,7 +108,7 @@ class BundleRegistry(GObject.GObject):
def _load_mime_defaults(self):
defaults = {}
- f = open(os.path.join(config.data_path, 'mime.defaults'), 'r')
+ f = open(os.environ["SUGAR_MIME_DEFAULTS"], 'r')
for line in f.readlines():
line = line.strip()
if line and not line.startswith('#'):
@@ -152,7 +151,7 @@ class BundleRegistry(GObject.GObject):
def _merge_default_favorites(self):
default_activities = []
- defaults_path = os.path.join(config.data_path, 'activities.defaults')
+ defaults_path = os.environ["SUGAR_ACTIVITIES_DEFAULTS"]
if os.path.exists(defaults_path):
file_mtime = os.stat(defaults_path).st_mtime
if file_mtime > self._last_defaults_mtime: