7 from distutils
.core
import setup
9 # Look for modules in the root
10 srcdir
= os
.path
.dirname(os
.path
.abspath(__file__
))
12 from extras
import cmdclass
13 from cola
import version
17 # ensure readable files
18 old_mask
= os
.umask(0022)
20 _check_python_version()
25 version
.write_builtin_version()
28 # restore the old mask
31 def _setup_environment():
32 """Adds win32/ to our path for windows only"""
33 if sys
.platform
!= 'win32':
35 path
= os
.environ
['PATH']
36 win32
= os
.path
.join(srcdir
, 'win32')
37 os
.environ
['PATH'] = win32
+ os
.pathsep
+ path
40 """Runs distutils.setup()"""
47 if sys
.platform
== 'win32':
51 'win32/py2exe-setup.py',
52 'win32/py2exe-setup.cmd',
56 requires
= ['simplejson']
58 setup(name
= 'git-cola',
59 version
= version
.version(),
60 description
= 'The highly caffeinated git GUI',
62 author
= 'The git-cola community',
63 author_email
= 'git-cola@googlegroups.com',
64 url
= 'http://git-cola.github.com/',
65 long_description
= 'A sleek and powerful git GUI',
69 data_files
= cola_data_files())
72 def cola_data_files():
74 _app_path('share/git-cola/icons', '*.png'),
75 _app_path('share/git-cola/icons', '*.svg'),
76 _app_path('share/applications', '*.desktop'),
77 _app_path('share/doc/git-cola', '*.txt'),
79 _package('cola.classic'),
81 _package('cola.main'),
82 _package('cola.merge'),
83 _package('cola.models'),
84 _package('cola.controllers'),
85 _package('cola.prefs'),
86 _package('cola.stash'),
87 _package('cola.views'),
88 _package('cola.widgets'),
91 data
.extend([_app_path(localedir
, 'git-cola.mo')
92 for localedir
in glob('share/locale/*/LC_MESSAGES')])
94 if sys
.platform
== 'darwin':
95 data
.append(_app_path('share/git-cola/bin', 'ssh-askpass-darwin'))
97 data
.append(_app_path('share/git-cola/bin', 'ssh-askpass'))
101 def _package(package
, subdir
=None):
102 subdirs
= package
.split('.')
103 app_dir
= os
.path
.join('share', 'git-cola', 'lib', *subdirs
)
105 subdirs
.insert(0, subdir
)
106 src_dir
= os
.path
.join(*subdirs
)
107 return (app_dir
, glob(os
.path
.join(src_dir
, '*.py')))
110 def _app_path(dirname
, entry
):
111 return (dirname
, glob(os
.path
.join(dirname
, entry
)))
114 def _check_python_version():
115 """Check the minimum Python version
117 pyver
= platform
.python_version()
118 if not version
.check('python', pyver
):
119 print >> sys
.stderr
, ('Python version %s or newer required. '
120 'Found %s' % (version
.get('python'), pyver
))
124 def _check_git_version():
125 """Check the minimum GIT version
127 git_version
= version
.git_version()
128 if not version
.check('git', git_version
):
129 print >> sys
.stderr
, ('GIT version %s or newer required. '
130 'Found %s' % (version
.get('git'), git_version
))
134 def _check_pyqt_version():
135 """Check the minimum PyQt version
139 from PyQt4
import QtCore
140 pyqtver
= QtCore
.PYQT_VERSION_STR
141 if version
.check('pyqt', pyqtver
):
145 print >> sys
.stderr
, ('PyQt4 version %s or newer required. '
146 'Found %s' % (version
.get('pyqt'), pyqtver
))
150 if __name__
== '__main__':