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

import gettext
import locale
from logging import warn
try:
	locale.setlocale(locale.LC_ALL, '')
except locale.Error:
	warn('Error setting locale (eg. Invalid locale)')
gettext.install('zero-install', unicode=True, names=['ngettext'])

# 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.
_mydir = dirname(__file__)
sys.path.insert(0, _mydir)

# Make sure we're using our bundled copy of Zero Install, not the system version
# (if different)
sys.path.insert(0, dirname(dirname(_mydir)))

import pygtk; pygtk.require('2.0')

import main

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