Skip to content
Fetching contributors…
Cannot retrieve contributors at this time
executable file 141 lines (112 sloc) 3.76 KB
#!/usr/bin/env python
import os
import sys
import platform
from glob import glob
from distutils.core import setup
# Look for modules in the root
srcdir = os.path.dirname(os.path.abspath(__file__))
from extras import cmdclass
from cola import version
def main():
def _check_python_version():
"""Check the minimum Python version
pyver = platform.python_version()
if not version.check('python', pyver):
print >> sys.stderr, ('Python version %s or newer required. '
'Found %s' % (version.get('python'), pyver))
def _setup_environment():
"""Adds win32/ to our path for windows only"""
if sys.platform != 'win32':
path = os.environ['PATH']
win32 = os.path.join(srcdir, 'win32')
os.environ['PATH'] = win32 + os.pathsep + path
def _check_git_version():
"""Check the minimum GIT version
git_version = version.git_version()
if not version.check('git', git_version):
print >> sys.stderr, ('GIT version %s or newer required. '
'Found %s' % (version.get('git'), git_version))
def _check_pyqt_version():
"""Check the minimum PyQt version
pyqtver = 'None'
from PyQt4 import QtCore
pyqtver = QtCore.PYQT_VERSION_STR
if version.check('pyqt', pyqtver):
except ImportError:
print >> sys.stderr, ('PyQt4 version %s or newer required. '
'Found %s' % (version.get('pyqt'), pyqtver))
def _run_setup():
"""Runs distutils.setup()"""
scripts = [
if sys.platform == 'win32':
setup(name = 'git-cola',
version = version.version(),
description = 'The highly caffeinated git GUI',
license = 'GPLv2',
author = 'The git-cola community',
author_email = '',
url = '',
long_description = 'A sleek and powerful git GUI',
scripts = scripts,
cmdclass = cmdclass,
data_files = cola_data_files())
def cola_data_files():
data = [
_app_path('share/git-cola/icons', '*.png'),
_app_path('share/git-cola/icons', '*.svg'),
_app_path('share/applications', '*.desktop'),
_app_path('share/doc/git-cola', '*.txt'),
_app_path('share/doc/git-cola', '*.html'),
data.extend([_app_path(localedir, '')
for localedir in glob('share/locale/*/LC_MESSAGES')])
if sys.platform == 'darwin':
data.append(_app_path('share/git-cola/bin', 'ssh-askpass-darwin'))
data.append(_app_path('share/git-cola/bin', 'ssh-askpass'))
return data
def _package(package, subdir=None):
subdirs = package.split('.')
app_dir = os.path.join('share', 'git-cola', 'lib', *subdirs)
if subdir:
subdirs.insert(0, subdir)
src_dir = os.path.join(*subdirs)
return (app_dir, glob(os.path.join(src_dir, '*.py')))
def _app_path(dirname, entry):
return (dirname, glob(os.path.join(dirname, entry)))
if __name__ == '__main__':
Jump to Line
Something went wrong with that request. Please try again.