git-cola 1.7.7
[git-cola.git] / bin / git-cola
blobab645006b02f65ee44edc5f16972ed7a6359cc9a
1 #!/usr/bin/env python
2 # -*- python-mode -*-
3 """Takes care of starting the main function
4 """
6 __copyright__ = """
7 Copyright (C) 2007-2012 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 """
20 import os
21 import sys
23 def cola_init():
24 """Provides access to the cola modules"""
25 # Try to detect where it is run from and set prefix and the search path.
26 # It is assumed that the user installed Cola using the --prefix= option
27 prefix = os.path.dirname(os.path.dirname(
28 os.path.realpath(os.path.abspath(__file__))))
30 # Look for modules in the source or install trees
31 cola_mod = os.path.join(prefix, 'cola', '__init__.py')
32 if os.path.exists(cola_mod):
33 # Source tree
34 sys.path.insert(1, prefix)
35 else:
36 # Install tree
37 install_lib = os.path.join(prefix, 'share', 'git-cola', 'lib')
38 sys.path.insert(1, install_lib)
41 if __name__ == '__main__':
42 # lights, cameras, action
43 cola_init()
44 from cola.app import main
45 main('git-cola')