#!/usr/bin/python

# $Id: fugu.py.in,v 1.20 2001/07/25 05:47:39 tlau Exp $

# Version string
FUGU_VERSION = '1.1.8'
import sys
if sys.platform == 'win32':
	FUGU_VERSION_LONG = 'WinFugu/' + FUGU_VERSION
else:
	FUGU_VERSION_LONG = 'Fugu/' + FUGU_VERSION

def get_start_dir():
	start_dir = os.path.dirname(sys.argv[0])
	orig_dir = os.getcwd()
	if start_dir:
		os.chdir(start_dir)
	start_dir = os.getcwd()
	os.chdir(orig_dir)
	return start_dir

# Add Fugu lib directories to sys.path before importing our modules
import os
if sys.platform == 'win32':
	start_dir = get_start_dir()
	log_file = open(os.path.join(start_dir, 'fugu.log'), 'w')
	sys.stderr = log_file
	sys.stdout = log_file
	sys.path.insert(1, os.path.join(start_dir, 'lib'))
else:
	sys.path.insert(1, '/afs/sipb/project/gale/lib/fugu-%s' % FUGU_VERSION)
	sys.path.insert(1, '/afs/sipb/project/gale/lib/fugu-%s' % FUGU_VERSION)

import pygalesetup
pygalesetup.check()

# The main part of the Fugu code
import ui

def main():
	ui.FUGU_VERSION = FUGU_VERSION
	ui.FUGU_VERSION_LONG = FUGU_VERSION_LONG
	ui.main()

if __name__ == '__main__':
	main()
