Simplified system paths for running sugar from the source dir.

This commit is contained in:
Tomeu Vizoso 2007-02-03 19:41:00 +01:00
parent 9b6d7c6292
commit 4bde802bbd
2 changed files with 10 additions and 40 deletions

View File

@ -19,6 +19,9 @@
import sys
import os
if len(sys.argv) == 2:
sys.path.insert(0, sys.argv[1])
import pygtk
pygtk.require('2.0')
import gtk
@ -32,6 +35,7 @@ from sugar import TracebackUtils
logger.cleanup()
logger.start('shell')
if len(sys.argv) == 1:
sys.path.insert(0, os.path.join(env.get_data_dir(), 'shell'))
from view.FirstTimeDialog import FirstTimeDialog

View File

@ -35,44 +35,6 @@ from sugar import env
from sugar import util
from sugar.emulator import Emulator
if sourcedir:
if os.environ.has_key('PYTHONPATH'):
old_path = os.environ['PYTHONPATH']
os.environ['PYTHONPATH'] = sourcedir + ':' + old_path
else:
os.environ['PYTHONPATH'] = sourcedir
bin_path = sourcedir
bin_path += ':' + os.path.join(sourcedir, 'shell')
bin_path += ':' + os.path.join(sourcedir, 'services/presence')
bin_path += ':' + os.path.join(sourcedir, 'services/clipboard')
if os.environ.has_key('PATH'):
old_path = os.environ['PATH']
os.environ['PATH'] = bin_path + ':' + old_path
else:
os.environ['PATH'] = bin_path
bin = os.path.join(sourcedir,
'services/presence/sugar-presence-service')
util.write_service('org.laptop.Presence', bin,
env.get_user_service_dir())
bin = os.path.join(sourcedir,
'services/clipboard/sugar-clipboard')
util.write_service('org.laptop.Clipboard', bin,
env.get_user_service_dir())
bin = os.path.join(sourcedir,
'services/datastore/sugar-data-store')
util.write_service('org.laptop.sugar.DataStore', bin,
env.get_user_service_dir())
bin = os.path.join(sourcedir,
'services/console/sugar-console')
util.write_service('org.laptop.sugar.Console', bin,
env.get_user_service_dir())
if len(sys.argv) == 1:
program = 'sugar-shell'
else:
@ -90,4 +52,8 @@ else:
emulator = Emulator(width, height, fullscreen)
emulator.start()
if sourcedir:
program = os.path.join(os.path.join(sourcedir, 'shell'), program)
os.execlp('dbus-launch', 'dbus-launch', '--exit-with-session', program, sourcedir)
else:
os.execlp('dbus-launch', 'dbus-launch', '--exit-with-session', program)