3 """Takes care of starting the main function
7 Copyright (C) 2007, 2008, 2009, 2010,
8 David Aguilar <davvid@gmail.com> and contributors
10 This program is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License version 2 as
12 published by the Free Software Foundation.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
25 """Provides access to the cola modules"""
26 # Try to detect where it is run from and set prefix and the search path.
27 # It is assumed that the user installed Cola using the --prefix= option
28 prefix
= os
.path
.dirname(os
.path
.abspath(__file__
))
29 if 'Contents/Resources' not in __file__
:
30 prefix
= os
.path
.dirname(prefix
)
32 # Look for modules in the source or install trees
33 thirdparty
= os
.path
.join(prefix
, 'thirdparty')
34 if os
.path
.exists(thirdparty
):
35 # Source tree: prefer cola's modules but allow system versions of thirdparty
36 sys
.path
.insert(0, prefix
)
37 sys
.path
.append(thirdparty
)
39 # Install tree: prefer cola
40 paths_to_try
= [os
.path
.join(prefix
, 'share', 'git-cola', 'lib')]
41 sys
.path
= paths_to_try
+ sys
.path
43 # Setup the path so that git finds us when we run 'git cola'
44 path_entries
= os
.environ
.get('PATH').split(os
.pathsep
)
45 bindir
= os
.path
.dirname(os
.path
.abspath(__file__
))
46 path_entries
.insert(0, bindir
)
47 path
= os
.pathsep
.join(path_entries
)
48 os
.environ
['PATH'] = path
49 os
.putenv('PATH', path
)
52 if __name__
== '__main__':
53 # lights, cameras, action