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.
8 # pylint: disable=reload-builtin
10 sys
.setdefaultencoding('utf-8')
11 except NameError: # Python3
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')
27 exec(open(version
).read(), scope
)
28 version
= scope
['VERSION']
32 """Runs distutils.setup()"""
33 vendor_libs
= should_vendor_libs()
40 if sys
.platform
== 'win32':
41 scripts
.append('contrib/win32/cola')
43 setup(name
='git-cola',
45 description
='The highly caffeinated git GUI',
46 long_description
='A sleek and powerful git GUI',
48 author
='David Aguilar',
49 author_email
='davvid@gmail.com',
50 url
='https://git-cola.github.io/',
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')
65 def cola_data_files(vendor_libs
):
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'),
74 _package('cola.models'),
75 _package('cola.widgets'),
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')])
89 def _package(package
, subdirs
=None):
90 dirs
= package
.split('.')
91 app_dir
= os
.path
.join('share', 'git-cola', 'lib', *dirs
)
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__':