7 from distutils
.core
import setup
9 from extras
import cmdclass
11 # Look for modules in the root and thirdparty directories
12 srcdir
= os
.path
.dirname(os
.path
.abspath(__file__
))
13 sys
.path
.insert(1, os
.path
.join(srcdir
, 'thirdparty'))
14 sys
.path
.insert(1, srcdir
)
16 from cola
import version
18 # --standalone prevents installing thirdparty libraries
19 if '--standalone' in sys
.argv
:
20 sys
.argv
.remove('--standalone')
27 # ensure readable files
28 old_mask
= os
.umask(0022)
30 _check_python_version()
35 version
.write_builtin_version()
38 # restore the old mask
41 def _setup_environment():
42 """Adds win32/ to our path for windows only"""
43 if sys
.platform
!= 'win32':
45 path
= os
.environ
['PATH']
46 win32
= os
.path
.join(srcdir
, 'win32')
47 os
.environ
['PATH'] = win32
+ os
.pathsep
+ path
50 """Runs distutils.setup()"""
52 scripts
= ['bin/git-cola']
54 if sys
.platform
== 'win32':
55 scripts
.append('win32/cola')
56 scripts
.append('win32/dirname')
57 scripts
.append('win32/py2exe-setup.py')
58 scripts
.append('win32/py2exe-setup.cmd')
60 setup(name
= 'git-cola',
61 version
= version
.version(),
62 description
= 'The highly caffeinated git GUI',
64 author
= 'The git-cola community',
65 author_email
= 'git-cola@googlegroups.com',
66 url
= 'http://git-cola.github.com/',
67 long_description
= 'A sleek and powerful git GUI',
70 data_files
= cola_data_files())
73 def cola_data_files(standalone
=_standalone
):
75 _app_path('share/git-cola/icons', '*.png'),
76 _app_path('share/git-cola/icons', '*.svg'),
77 _app_path('share/applications', '*.desktop'),
78 _app_path('share/doc/git-cola', '*.txt'),
80 _package('cola.classic'),
82 _package('cola.main'),
83 _package('cola.merge'),
84 _package('cola.models'),
85 _package('cola.controllers'),
86 _package('cola.prefs'),
87 _package('cola.stash'),
88 _package('cola.views'),
89 _package('cola.widgets'),
92 data
.extend([_app_path(localedir
, 'git-cola.mo')
93 for localedir
in glob('share/locale/*/LC_MESSAGES')])
96 data
.extend([_thirdparty_package('jsonpickle'),
97 _thirdparty_package('simplejson')])
99 if sys
.platform
== 'darwin':
100 data
.append(_app_path('share/git-cola/bin', 'ssh-askpass-darwin'))
102 data
.append(_app_path('share/git-cola/bin', 'ssh-askpass'))
106 def _package(package
, subdir
=None):
107 subdirs
= package
.split('.')
108 app_dir
= os
.path
.join('share', 'git-cola', 'lib', *subdirs
)
110 subdirs
.insert(0, subdir
)
111 src_dir
= os
.path
.join(*subdirs
)
112 return (app_dir
, glob(os
.path
.join(src_dir
, '*.py')))
115 def _thirdparty_package(package
):
116 return _package(package
, subdir
='thirdparty')
119 def _app_path(dirname
, entry
):
120 return (dirname
, glob(os
.path
.join(dirname
, entry
)))
123 def _check_python_version():
124 """Check the minimum Python version
126 pyver
= platform
.python_version()
127 if not version
.check('python', pyver
):
128 print >> sys
.stderr
, ('Python version %s or newer required. '
129 'Found %s' % (version
.get('python'), pyver
))
133 def _check_git_version():
134 """Check the minimum GIT version
136 if not version
.check('git', version
.git_version()):
137 print >> sys
.stderr
, ('GIT version %s or newer required. '
138 'Found %s' % (version
.get('git'),
139 version
.git_version()))
143 def _check_pyqt_version():
144 """Check the minimum PyQt version
149 from PyQt4
import QtCore
150 pyqtver
= QtCore
.PYQT_VERSION_STR
151 if version
.check('pyqt', pyqtver
):
155 print >> sys
.stderr
, ('PyQt4 version %s or newer required. '
156 'Found %s' % (version
.get('pyqt'), pyqtver
))
160 if __name__
== '__main__':