2010-02-17 22:22:43 -05:00
|
|
|
#! /usr/bin/python
|
|
|
|
|
|
|
|
# To change this template, choose Tools | Templates
|
|
|
|
# and open the template in the editor.
|
|
|
|
|
|
|
|
__author__="bjschuma"
|
|
|
|
__date__ ="$Feb 17, 2010 9:18:50 PM$"
|
2010-02-21 22:44:28 -05:00
|
|
|
import sys
|
|
|
|
import getopt
|
2010-02-17 22:22:43 -05:00
|
|
|
|
|
|
|
from bt.settings import Settings
|
2010-02-20 15:37:09 -05:00
|
|
|
from bt.alias import Alias
|
2010-02-19 00:19:39 -05:00
|
|
|
from bt.file import *
|
2010-02-20 00:52:06 -05:00
|
|
|
from bt.message import write
|
|
|
|
from bt import signal
|
|
|
|
from manager import Manager
|
2010-02-21 21:50:02 -05:00
|
|
|
from bt import proc
|
2010-02-20 00:52:06 -05:00
|
|
|
|
2010-02-21 21:50:02 -05:00
|
|
|
global alias
|
2010-02-19 00:19:39 -05:00
|
|
|
global settings
|
2010-02-20 00:52:06 -05:00
|
|
|
global manager
|
2010-02-17 22:22:43 -05:00
|
|
|
|
|
|
|
|
2010-02-21 21:50:02 -05:00
|
|
|
def setSession():
|
|
|
|
write("Finding session...",2)
|
2010-02-20 00:52:06 -05:00
|
|
|
path = settings["appdir"]
|
|
|
|
mkdir(path)
|
2010-02-19 00:19:39 -05:00
|
|
|
path = join(path,"session")
|
|
|
|
mkdir(path)
|
2010-02-21 21:50:02 -05:00
|
|
|
settings["session"] = path
|
|
|
|
write("Using session: " + path,2)
|
2010-02-21 22:44:28 -05:00
|
|
|
|
|
|
|
|
|
|
|
def parseInput():
|
|
|
|
from bt import scripting
|
|
|
|
write("Parsing user input",1)
|
|
|
|
input = sys.argv[1:]
|
|
|
|
write(input,True)
|
|
|
|
optc = "vp:s:"
|
|
|
|
long = ["verbose", "path=", "script="]
|
|
|
|
|
|
|
|
# Attempt to parse user input
|
|
|
|
try:
|
|
|
|
opts, args = getopt.getopt(input, optc, long)
|
|
|
|
for opt in opts:
|
|
|
|
if opt[0] == "-p":
|
|
|
|
settings["plugpath"] += [opt[1]]
|
|
|
|
elif opt[0] == "-s":
|
|
|
|
scripting.add(opt[1])
|
|
|
|
settings["args"] = args
|
|
|
|
except getopt.GetoptError, e:
|
|
|
|
write(e.msg)
|
2010-02-20 15:37:09 -05:00
|
|
|
|
2010-02-20 00:52:06 -05:00
|
|
|
|
2010-02-17 22:22:43 -05:00
|
|
|
|
2010-02-19 00:19:39 -05:00
|
|
|
settings = Settings()
|
2010-02-21 21:50:02 -05:00
|
|
|
# We want to configure settings as early as possible
|
|
|
|
settings.setdefaults()
|
|
|
|
|
2010-02-20 00:52:06 -05:00
|
|
|
manager = Manager()
|
2010-02-20 15:37:09 -05:00
|
|
|
alias = Alias()
|
2010-02-20 00:52:06 -05:00
|
|
|
|
2010-02-21 22:44:28 -05:00
|
|
|
parseInput()
|
|
|
|
|
2010-02-21 21:50:02 -05:00
|
|
|
# Register functions to call when all plugins have been loaded
|
|
|
|
signal.register("scion-plugins-loaded",proc.setup,0)
|
2010-02-21 22:44:28 -05:00
|
|
|
signal.register("scion-plugins-loaded",setSession,1)
|