2
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
4
# Copyright (C) 2012 Lucas R. Martins <lukasrms@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/>.
22
from gettext import gettext as _
23
gettext.textdomain('webbar')
25
# Add project root directory (enable symlink and trunk execution)
26
PROJECT_ROOT_DIRECTORY = os.path.abspath(
27
os.path.dirname(os.path.dirname(os.path.realpath(sys.argv[0]))))
30
if os.path.abspath(__file__).startswith('/opt'):
31
syspath = sys.path[:] # copy to avoid infinite loop in pending objects
33
opt_path = path.replace('/usr', '/opt/extras.ubuntu.com/webbar')
34
python_path.insert(0, opt_path)
35
sys.path.insert(0, opt_path)
36
if (os.path.exists(os.path.join(PROJECT_ROOT_DIRECTORY, 'webbar'))
37
and PROJECT_ROOT_DIRECTORY not in sys.path):
38
python_path.insert(0, PROJECT_ROOT_DIRECTORY)
39
sys.path.insert(0, PROJECT_ROOT_DIRECTORY)
41
os.putenv('PYTHONPATH', "%s:%s" % (os.getenv('PYTHONPATH', ''), ':'.join(python_path))) # for subprocesses