qtutils: Do not re-translate strings
[git-cola.git] / bin / git-cola
blob49f94ad0c875938264d7f93d52d062a44744cb5c
1 #!/usr/bin/env python
2 # -*- python-mode -*-
3 """Takes care of starting the main function
4 """
6 __copyright__ = """
7 Copyright (C) 2007, 2008, 2009 David Aguilar <davvid@gmail.com> and contributors
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License version 2 as
11 published by the Free Software Foundation.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 """
23 import os
24 import sys
26 def cola_init():
27 """Provides access to the cola modules"""
28 # Try to detect where it is run from and set prefix and the search path.
29 # It is assumed that the user installed Cola using the --prefix= option
30 prefix = os.path.dirname(os.path.abspath(__file__))
31 if 'Contents/Resources' not in __file__:
32 prefix = os.path.dirname(prefix)
34 # Look for modules in the source and install trees
35 paths_to_try = [prefix, os.path.join(prefix, 'share', 'git-cola', 'lib')]
36 actual_paths = [p for p in paths_to_try if os.path.exists(p)]
37 sys.path = actual_paths + sys.path
39 import cola.resources
41 # Setup the path so that git finds us when we run 'git cola'
42 path_entries = os.environ.get('PATH').split(os.pathsep)
43 bindir = os.path.dirname(os.path.abspath(__file__))
44 path_entries.insert(0, bindir)
45 path = os.pathsep.join(path_entries)
46 os.environ['PATH'] = path
47 os.putenv('PATH', path)
50 if __name__ == '__main__':
51 # lights, cameras, action
52 cola_init()
53 import cola.main
54 cola.main.main()