2006-05-12 08:34:20 +02:00
|
|
|
#!/usr/bin/python
|
|
|
|
|
|
|
|
import sys
|
|
|
|
import os
|
|
|
|
|
2006-05-16 22:52:54 +02:00
|
|
|
curdir = os.path.dirname(__file__)
|
|
|
|
|
|
|
|
if curdir == '.':
|
|
|
|
basedir = os.path.dirname(os.getcwd())
|
|
|
|
else:
|
|
|
|
basedir = os.path.dirname(curdir)
|
2006-05-17 06:12:01 +02:00
|
|
|
|
|
|
|
console = False
|
|
|
|
|
2006-05-16 22:52:54 +02:00
|
|
|
if os.path.isfile(os.path.join(curdir, '__uninstalled__.py')):
|
2006-05-16 22:32:08 +02:00
|
|
|
if basedir == '':
|
2006-05-17 06:12:01 +02:00
|
|
|
print 'Running sugar from current directory...'
|
2006-05-16 22:32:08 +02:00
|
|
|
else:
|
2006-05-17 06:12:01 +02:00
|
|
|
print 'Running sugar from ' + basedir + ' ...'
|
|
|
|
sys.path.insert(0, basedir)
|
2006-05-16 22:32:08 +02:00
|
|
|
os.environ['PYTHONPATH'] = basedir
|
2006-05-17 06:12:01 +02:00
|
|
|
console = True
|
2006-05-12 08:34:20 +02:00
|
|
|
else:
|
2006-05-17 06:12:01 +02:00
|
|
|
print 'Running the installed sugar...'
|
|
|
|
|
|
|
|
if console:
|
|
|
|
print 'Redirecting output to the console, press ctrl+d to open it.'
|
2006-05-16 22:32:08 +02:00
|
|
|
|
|
|
|
from sugar.session import session
|
|
|
|
|
2006-05-17 06:12:01 +02:00
|
|
|
session.start(console)
|
2006-05-16 22:32:08 +02:00
|
|
|
|