#!/usr/bin/env python
# Copyright (C) 2009, Thomas Leonard
# See the README file for details, or visit http://0install.net.
import os, sys

# This is for pycentral on Debian-type systems. 0launch-gui is a symlink to the
# copy in the pycentral source directory. Python does a realpath() on this
# before adding the containing directory to sys.path, which means we don't see
# the .pyc files. If run as root, this also causes .pyc files to be created in
# the source directory, leaving a mess when the package is removed.
sys.path.insert(0, os.path.dirname(__file__))

import pygtk; pygtk.require('2.0')

try:
	# set up the gettext system and locales
	from gtk import glade
	import gettext
	import locale

	locale.setlocale(locale.LC_ALL, '')
	for module in glade, gettext:
		localedir = os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))),
                                 'locale')
		if os.path.isdir(localedir):
			module.bindtextdomain('zero-install', localedir)
		module.textdomain('zero-install')

	__builtins__._ = gettext.gettext
except ImportError:
	__builtins__._ = lambda x: x

import main

main.run_gui(sys.argv[1:])
