doc: update v2.9 release notes draft
[git-cola.git] / setup.py
blob9500e2eae89bb10cf6930f71419c1d4685403da7
1 #!/usr/bin/env python
2 from __future__ import absolute_import, division, unicode_literals
4 # Hacktastic hack to fix python's stupid ascii default encoding, which
5 # breaks inside distutils when installing from utf-8 paths.
6 import sys
7 try:
8 # pylint: disable=reload-builtin
9 reload(sys)
10 sys.setdefaultencoding('utf-8')
11 except NameError: # Python3
12 pass
15 import os
16 from glob import glob
17 from distutils.core import setup
19 # Look for modules in the root
20 srcdir = os.path.dirname(os.path.abspath(__file__))
22 from extras import cmdclass
24 here = os.path.dirname(__file__)
25 version = os.path.join(here, 'cola', '_version.py')
26 scope = {}
27 exec(open(version).read(), scope)
28 version = scope['VERSION']
31 def main():
32 """Runs distutils.setup()"""
33 vendor_libs = should_vendor_libs()
35 scripts = [
36 'bin/git-cola',
37 'bin/git-dag',
40 if sys.platform == 'win32':
41 scripts.append('contrib/win32/cola')
43 setup(name='git-cola',
44 version=version,
45 description='The highly caffeinated git GUI',
46 long_description='A sleek and powerful git GUI',
47 license='GPLv2',
48 author='David Aguilar',
49 author_email='davvid@gmail.com',
50 url='https://git-cola.github.io/',
51 scripts=scripts,
52 cmdclass=cmdclass,
53 platforms='any',
54 data_files=cola_data_files(vendor_libs))
57 def should_vendor_libs():
58 vendor_libs = not os.getenv('GIT_COLA_NO_VENDOR_LIBS', '')
59 if '--no-vendor-libs' in sys.argv:
60 sys.argv.remove('--no-vendor-libs')
61 vendor_libs = False
62 return vendor_libs
65 def cola_data_files(vendor_libs):
66 data = [
67 _app_path('share/git-cola/bin', '*'),
68 _app_path('share/git-cola/icons', '*.png'),
69 _app_path('share/git-cola/icons', '*.svg'),
70 _app_path('share/applications', '*.desktop'),
71 _app_path('share/doc/git-cola', '*.rst'),
72 _app_path('share/doc/git-cola', '*.html'),
73 _package('cola'),
74 _package('cola.models'),
75 _package('cola.widgets'),
78 if vendor_libs:
79 data.extend([
80 _package('qtpy', subdirs=('extras', 'qtpy')),
81 _package('qtpy._patch', subdirs=('extras', 'qtpy')),
84 data.extend([_app_path(localedir, 'git-cola.mo')
85 for localedir in glob('share/locale/*/LC_MESSAGES')])
86 return data
89 def _package(package, subdirs=None):
90 dirs = package.split('.')
91 app_dir = os.path.join('share', 'git-cola', 'lib', *dirs)
92 if subdirs:
93 dirs = list(subdirs) + dirs
94 src_dir = os.path.join(*dirs)
95 return (app_dir, glob(os.path.join(src_dir, '*.py')))
98 def _app_path(dirname, entry):
99 return (dirname, glob(os.path.join(dirname, entry)))
102 if __name__ == '__main__':
103 main()