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
= 'A highly caffeinated git GUI',
64 author
= 'The git-cola community',
65 author_email
= 'git-cola@googlegroups.com',
66 url
= 'http://cola.tuxfamily.org/',
67 long_description
= 'A highly caffeinated 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/git-cola/styles', '*.qss'),
78 _app_path('share/git-cola/styles/images', '*.png'),
79 _app_path('share/applications', '*.desktop'),
80 _app_path('share/doc/git-cola', '*.txt'),
82 _package('cola.classic'),
84 _package('cola.main'),
85 _package('cola.merge'),
86 _package('cola.models'),
87 _package('cola.controllers'),
88 _package('cola.prefs'),
89 _package('cola.stash'),
90 _package('cola.views'),
91 _package('cola.widgets'),
94 data
.extend([_app_path(localedir
, 'git-cola.mo')
95 for localedir
in glob('share/locale/*/LC_MESSAGES')])
98 data
.extend([_thirdparty_package('jsonpickle'),
99 _thirdparty_package('simplejson')])
101 if sys
.platform
== 'darwin':
102 data
.append(_app_path('share/git-cola/bin', 'ssh-askpass-darwin'))
104 data
.append(_app_path('share/git-cola/bin', 'ssh-askpass'))
108 def _package(package
, subdir
=None):
109 subdirs
= package
.split('.')
110 app_dir
= os
.path
.join('share', 'git-cola', 'lib', *subdirs
)
112 subdirs
.insert(0, subdir
)
113 src_dir
= os
.path
.join(*subdirs
)
114 return (app_dir
, glob(os
.path
.join(src_dir
, '*.py')))
117 def _thirdparty_package(package
):
118 return _package(package
, subdir
='thirdparty')
121 def _app_path(dirname
, entry
):
122 return (dirname
, glob(os
.path
.join(dirname
, entry
)))
125 def _check_python_version():
126 """Check the minimum Python version
128 pyver
= platform
.python_version()
129 if not version
.check('python', pyver
):
130 print >> sys
.stderr
, ('Python version %s or newer required. '
131 'Found %s' % (version
.get('python'), pyver
))
135 def _check_git_version():
136 """Check the minimum GIT version
138 if not version
.check('git', version
.git_version()):
139 print >> sys
.stderr
, ('GIT version %s or newer required. '
140 'Found %s' % (version
.get('git'),
141 version
.git_version()))
145 def _check_pyqt_version():
146 """Check the minimum PyQt version
151 from PyQt4
import QtCore
152 pyqtver
= QtCore
.PYQT_VERSION_STR
153 if version
.check('pyqt', pyqtver
):
157 print >> sys
.stderr
, ('PyQt4 version %s or newer required. '
158 'Found %s' % (version
.get('pyqt'), pyqtver
))
162 if __name__
== '__main__':