2008-06-12 05:56:30 +02:00
|
|
|
import sys
|
|
|
|
import os.path
|
2008-08-27 09:55:06 +02:00
|
|
|
import getopt
|
|
|
|
|
|
|
|
use_x = True
|
2008-08-27 20:55:18 +02:00
|
|
|
shortargs = 'hnv:'
|
|
|
|
longargs = 'help no-x verbose='
|
|
|
|
opts, args = getopt.getopt(sys.argv[1:], shortargs, longargs.split())
|
2008-08-27 09:55:06 +02:00
|
|
|
for o, a in opts:
|
|
|
|
if o in ('-n', '--no-x'):
|
|
|
|
use_x = False
|
2008-06-12 05:56:30 +02:00
|
|
|
|
2008-08-09 02:24:08 +02:00
|
|
|
gajim_root = os.path.join(os.path.abspath(os.path.dirname(__file__)), '../..')
|
2008-06-12 05:56:30 +02:00
|
|
|
|
2008-08-09 02:24:08 +02:00
|
|
|
# look for modules in the CWD, then gajim/test/lib, then gajim/src, then everywhere else
|
2008-08-09 01:53:44 +02:00
|
|
|
sys.path.insert(1, gajim_root + '/src')
|
2008-08-09 02:24:08 +02:00
|
|
|
sys.path.insert(1, gajim_root + '/test/lib')
|
2008-06-12 05:56:30 +02:00
|
|
|
|
|
|
|
# a temporary version of ~/.gajim for testing
|
|
|
|
configdir = gajim_root + '/test/tmp'
|
|
|
|
|
|
|
|
# define _ for i18n
|
|
|
|
import __builtin__
|
|
|
|
__builtin__._ = lambda x: x
|
|
|
|
|
|
|
|
import os
|
|
|
|
|
|
|
|
def setup_env():
|
|
|
|
# wipe config directory
|
|
|
|
if os.path.isdir(configdir):
|
|
|
|
import shutil
|
|
|
|
shutil.rmtree(configdir)
|
|
|
|
|
2008-06-30 00:31:17 +02:00
|
|
|
os.mkdir(configdir)
|
2008-06-12 05:56:30 +02:00
|
|
|
|
2008-06-30 00:31:17 +02:00
|
|
|
import common.configpaths
|
|
|
|
common.configpaths.gajimpaths.init(configdir)
|
|
|
|
common.configpaths.gajimpaths.init_profile()
|
2008-06-12 05:56:30 +02:00
|
|
|
|
2008-06-30 00:31:17 +02:00
|
|
|
# for some reason common.gajim needs to be imported before xmpppy?
|
|
|
|
from common import gajim
|
2008-06-12 05:56:30 +02:00
|
|
|
|
2008-06-30 00:31:17 +02:00
|
|
|
gajim.DATA_DIR = gajim_root + '/data'
|
2008-08-27 09:55:06 +02:00
|
|
|
gajim.use_x = use_x
|
2008-06-29 07:25:59 +02:00
|
|
|
|
2008-08-27 09:55:06 +02:00
|
|
|
if use_x:
|
|
|
|
import gtkgui_helpers
|
|
|
|
gtkgui_helpers.GLADE_DIR = gajim_root + '/data/glade'
|
2008-07-29 21:49:31 +02:00
|
|
|
|
2008-08-09 01:53:44 +02:00
|
|
|
# vim: se ts=3:
|