~thomas-deruyter-3/qreator/qreator

« back to all changes in this revision

Viewing changes to bin/qreator

  • Committer: David Planella
  • Date: 2012-01-15 07:02:18 UTC
  • Revision ID: david.planella@ubuntu.com-20120115070218-ce81y8a9icgsom54
Initial project creation with Quickly!

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/python
 
2
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
 
3
### BEGIN LICENSE
 
4
# This file is in the public domain
 
5
### END LICENSE
 
6
 
 
7
import sys
 
8
import os
 
9
 
 
10
import gettext
 
11
from gettext import gettext as _
 
12
gettext.textdomain('qreator')
 
13
 
 
14
# Add project root directory (enable symlink and trunk execution)
 
15
PROJECT_ROOT_DIRECTORY = os.path.abspath(
 
16
    os.path.dirname(os.path.dirname(os.path.realpath(sys.argv[0]))))
 
17
 
 
18
python_path = []
 
19
if os.path.abspath(__file__).startswith('/opt'):
 
20
    syspath = sys.path[:] # copy to avoid infinite loop in pending objects
 
21
    for path in syspath:
 
22
        opt_path = path.replace('/usr', '/opt/extras.ubuntu.com/qreator')
 
23
        python_path.insert(0, opt_path)
 
24
        sys.path.insert(0, opt_path)
 
25
if (os.path.exists(os.path.join(PROJECT_ROOT_DIRECTORY, 'qreator'))
 
26
    and PROJECT_ROOT_DIRECTORY not in sys.path):
 
27
    python_path.insert(0, PROJECT_ROOT_DIRECTORY)
 
28
    sys.path.insert(0, PROJECT_ROOT_DIRECTORY)
 
29
if python_path:
 
30
    os.putenv('PYTHONPATH', "%s:%s" % (os.getenv('PYTHONPATH', ''), ':'.join(python_path))) # for subprocesses
 
31
 
 
32
import qreator
 
33
qreator.main()