3 """git-cola: The highly caffeinated Git GUI
6 from __future__
import division
, absolute_import
, unicode_literals
12 Copyright (C) 2007-2016 David Aguilar and contributors
14 This program is free software; you can redistribute it and/or modify
15 it under the terms of the GNU General Public License version 2 as
16 published by the Free Software Foundation.
18 This program is distributed in the hope that it will be useful,
19 but WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 GNU General Public License for more details.
26 def setup_environment():
27 """Provides access to the cola modules"""
28 abspath
= os
.path
.abspath
29 dirname
= os
.path
.dirname
31 realpath
= os
.path
.realpath
33 # Try to detect where it is run from and set prefix and the search path.
34 # It is assumed that the user installed Cola using the --prefix= option
35 python2
= sys
.version_info
[0] == 2
36 prefix
= dirname(dirname(realpath(abspath(__file__
))))
38 cola_mod
= join(prefix
, str('cola'), str('__init__.py'))
39 install_lib
= join(prefix
, str('share'), str('git-cola'), str('lib'))
41 # Look for modules in the source or install trees
42 cola_mod
= join(prefix
, 'cola', '__init__.py')
43 install_lib
= join(prefix
, 'share', 'git-cola', 'lib')
45 if os
.path
.exists(cola_mod
):
47 sys
.path
.insert(1, prefix
)
50 sys
.path
.insert(1, install_lib
)
53 from cola
.main
import main
# pylint: disable=wrong-import-position
55 if __name__
== '__main__':