2
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
4
# Copyright (C) 2012 Sam Hewitt <hewittsamuel@gmail.com>
5
# This program is free software: you can redistribute it and/or modify it
6
# under the terms of the GNU General Public License version 3, as published
7
# by the Free Software Foundation.
9
# This program is distributed in the hope that it will be useful, but
10
# WITHOUT ANY WARRANTY; without even the implied warranties of
11
# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
12
# PURPOSE. See the GNU General Public License for more details.
14
# You should have received a copy of the GNU General Public License along
15
# with this program. If not, see <http://www.gnu.org/licenses/>.
18
import sys, os, locale
21
LOCALEDIR = '/opt/extras.ubuntu.com/aplomb/share/locale'
22
#LOCALEDIR = '/usr/aplomb/share/locale'
23
from locale import gettext as _
24
locale.bindtextdomain(TEXTDOMAIN, LOCALEDIR)
25
locale.textdomain(TEXTDOMAIN)
27
# Add project root directory (enable symlink and trunk execution)
28
PROJECT_ROOT_DIRECTORY = os.path.abspath(
29
os.path.dirname(os.path.dirname(os.path.realpath(sys.argv[0]))))
32
if os.path.abspath(__file__).startswith('/opt'):
33
syspath = sys.path[:] # copy to avoid infinite loop in pending objects
35
opt_path = path.replace('/usr', '/opt/extras.ubuntu.com/aplomb')
36
python_path.insert(0, opt_path)
37
sys.path.insert(0, opt_path)
38
if (os.path.exists(os.path.join(PROJECT_ROOT_DIRECTORY, 'aplomb'))
39
and PROJECT_ROOT_DIRECTORY not in sys.path):
40
python_path.insert(0, PROJECT_ROOT_DIRECTORY)
41
sys.path.insert(0, PROJECT_ROOT_DIRECTORY)
43
os.putenv('PYTHONPATH', "%s:%s" % (os.getenv('PYTHONPATH', ''),
44
':'.join(python_path))) # for subprocesses