9 from distutils
.core
import setup
12 from extras
import cmdclass
16 # Look for modules in the root and thirdparty directories
17 srcdir
= os
.path
.dirname(os
.path
.abspath(__file__
))
18 sys
.path
.insert(0, os
.path
.join(srcdir
, 'thirdparty'))
19 sys
.path
.insert(0, srcdir
)
21 from cola
import version
23 # --standalone prevents installing thirdparty libraries
24 if '--standalone' in sys
.argv
:
25 sys
.argv
.remove('--standalone')
32 # ensure readable files
33 old_mask
= os
.umask(0022)
35 _check_python_version()
40 # First see if there is a version file (included in release tarballs),
41 # then try git-describe, then default.
42 builtin_version
= os
.path
.join('cola', 'builtin_version.py')
43 if os
.path
.exists('version') and not os
.path
.exists(builtin_version
):
44 shutil
.copy('version', builtin_version
)
46 elif os
.path
.exists('.git'):
47 version
.write_builtin_version()
50 # restore the old mask
53 def _setup_environment():
54 """Adds win32/ to our path for windows only"""
55 if sys
.platform
!= 'win32':
57 path
= os
.environ
['PATH']
58 win32
= os
.path
.join(srcdir
, 'win32')
59 os
.environ
['PATH'] = win32
+ os
.pathsep
+ path
62 """Runs distutils.setup()"""
64 scripts
= ['bin/git-cola']
66 # git-difftool first moved out of git.git's contrib area in git 1.6.3
67 if (os
.environ
.get('INSTALL_GIT_DIFFTOOL', '') or
68 not version
.check('difftool-builtin', version
.git_version())):
69 scripts
.append('bin/difftool/git-difftool')
70 scripts
.append('bin/difftool/git-difftool--helper')
72 if sys
.platform
== 'win32':
73 scripts
.append('win32/cola')
74 scripts
.append('win32/dirname')
75 scripts
.append('win32/py2exe-setup.py')
76 scripts
.append('win32/py2exe-setup.cmd')
78 setup(name
= 'git-cola',
79 version
= version
.version(),
80 description
= 'A highly caffeinated git GUI',
82 author
= 'The git-cola community',
83 author_email
= 'git-cola@googlegroups.com',
84 url
= 'http://cola.tuxfamily.org/',
85 long_description
= 'A highly caffeinated git GUI',
88 data_files
= cola_data_files())
91 def cola_data_files(standalone
=_standalone
):
92 data
= [_app_path('share/git-cola/icons', '*.png'),
93 _app_path('share/git-cola/icons', '*.svg'),
94 _app_path('share/git-cola/styles', '*.qss'),
95 _app_path('share/git-cola/styles/images', '*.png'),
96 _app_path('share/applications', '*.desktop'),
97 _app_path('share/doc/git-cola', '*.txt'),
99 _package('cola.models'),
100 _package('cola.controllers'),
101 _package('cola.views')]
103 data
.extend([_app_path(localedir
, 'git-cola.mo')
104 for localedir
in glob('share/locale/*/LC_MESSAGES')])
107 data
.extend([_thirdparty_package('jsonpickle'),
108 _thirdparty_package('simplejson')])
110 if sys
.platform
== 'darwin':
111 data
.append(_app_path('share/git-cola/bin', 'ssh-askpass-darwin'))
113 data
.append(_app_path('share/git-cola/bin', 'ssh-askpass'))
117 def _package(package
, subdir
=None):
118 subdirs
= package
.split('.')
119 app_dir
= os
.path
.join('share', 'git-cola', 'lib', *subdirs
)
121 subdirs
.insert(0, subdir
)
122 src_dir
= os
.path
.join(*subdirs
)
123 return (app_dir
, glob(os
.path
.join(src_dir
, '*.py')))
126 def _thirdparty_package(package
):
127 return _package(package
, subdir
='thirdparty')
130 def _app_path(dirname
, entry
):
131 return (dirname
, glob(os
.path
.join(dirname
, entry
)))
134 def _check_python_version():
135 """Check the minimum Python version
137 pyver
= platform
.python_version()
138 if not version
.check('python', pyver
):
139 print >> sys
.stderr
, ('Python version %s or newer required. '
140 'Found %s' % (version
.get('python'), pyver
))
144 def _check_git_version():
145 """Check the minimum GIT version
147 if not version
.check('git', version
.git_version()):
148 print >> sys
.stderr
, ('GIT version %s or newer required. '
149 'Found %s' % (version
.get('git'),
150 version
.git_version()))
154 def _check_pyqt_version():
155 """Check the minimum PyQt version
160 from PyQt4
import QtCore
161 pyqtver
= QtCore
.PYQT_VERSION_STR
162 if version
.check('pyqt', pyqtver
):
166 print >> sys
.stderr
, ('PyQt4 version %s or newer required. '
167 'Found %s' % (version
.get('pyqt'), pyqtver
))
171 if __name__
== '__main__':