Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/shell/sugar
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <marco@localhost.localdomain>2006-06-21 20:35:57 (GMT)
committer Marco Pesenti Gritti <marco@localhost.localdomain>2006-06-21 20:35:57 (GMT)
commit43b5e7e1a1c2e9e152d52cecf1d378c16a9d0d6b (patch)
treee6cde5219f48bf3efad7a2dbb0a5f6bc75b57593 /shell/sugar
parent26684a091c9de69e5eb39c0c2e42eb4297d5f933 (diff)
Fix bug in path initialization
Diffstat (limited to 'shell/sugar')
-rwxr-xr-xshell/sugar16
1 files changed, 11 insertions, 5 deletions
diff --git a/shell/sugar b/shell/sugar
index ad1905b..60391be 100755
--- a/shell/sugar
+++ b/shell/sugar
@@ -9,6 +9,13 @@ import pygtk
pygtk.require('2.0')
import gobject
+def add_to_python_path(path):
+ sys.path.insert(0, path)
+ if os.environ.has_key('PYTHONPATH'):
+ os.environ['PYTHONPATH'] += ':' + path
+ else:
+ os.environ['PYTHONPATH'] = path
+
def start_dbus():
curdir = os.path.dirname(__file__)
args = "/bin/dbus-daemon --session --print-address".split()
@@ -53,14 +60,13 @@ if not os.environ.has_key("SUGAR_NICK_NAME"):
curdir = os.path.abspath(os.path.dirname(__file__))
basedir = os.path.dirname(curdir)
-import sugar.env
-
if os.path.isfile(os.path.join(basedir, 'sugar/__uninstalled__.py')):
print 'Running sugar from ' + basedir + ' ...'
- sugar.env.add_to_python_path(basedir)
- sugar.env.add_to_python_path(os.path.join(basedir, 'shell'))
+ add_to_python_path(basedir)
+ add_to_python_path(os.path.join(basedir, 'shell'))
else:
- sugar.env.add_to_python_path(os.path.join(sugar.env.get_data_dir(), 'shell'))
+ import sugar.env
+ add_to_python_path(os.path.join(sugar.env.get_data_dir(), 'shell'))
print 'Running the installed sugar...'
print 'Redirecting output to the console, press ctrl+d to open it.'