1#!/usr/bin/env python
2
3from glob import glob as _glob
4from distutils.core import setup
5
6autostart_path = '/etc/xdg/autostart'
7
8import sys
9__version__ = '0.9.2'
10NAME = 'Solaar'
11
12if 'install' in sys.argv:
13	# naively guess where the autostart .desktop file should be installed
14	if '--prefix' in sys.argv or any(x.startswith('--prefix=') for x in sys.argv) or '--home' in sys.argv:
15		autostart_path = 'etc/xdg/autostart'
16	elif '--user' in sys.argv:
17		from os import environ
18		from os import path
19		xdg_config_home = environ.get('XDG_CONFIG_HOME', path.expanduser(path.join('~', '.config')))
20		autostart_path = path.join(xdg_config_home, 'autostart')
21		del environ, path, xdg_config_home
22
23del sys
24
25
26def _data_files():
27	from os.path import dirname as _dirname
28
29	yield 'share/solaar/icons', _glob('share/solaar/icons/solaar*.svg')
30	yield 'share/solaar/icons', _glob('share/solaar/icons/light_*.png')
31	yield 'share/icons/hicolor/scalable/apps', ['share/solaar/icons/solaar.svg']
32
33	for mo in _glob('share/locale/*/LC_MESSAGES/solaar.mo'):
34		yield _dirname(mo), [mo]
35
36	yield 'share/applications', ['share/applications/solaar.desktop']
37
38	del _dirname
39
40
41setup(name=NAME.lower(),
42		version=__version__,
43		description='Linux devices manager for the Logitech Unifying Receiver.',
44		long_description='''
45Solaar is a Linux device manager for Logitech's Unifying Receiver peripherals.
46It is able to pair/unpair devices to the receiver, and for some devices read
47battery status.
48'''.strip(),
49		author='Daniel Pavel',
50		author_email='daniel.pavel@gmail.com',
51		license='GPLv2',
52		url='http://pwr-solaar.github.io/Solaar/',
53		classifiers=[
54			'Development Status :: 4 - Beta',
55			'Environment :: X11 Applications :: GTK',
56			'Environment :: Console',
57			'Intended Audience :: End Users/Desktop',
58			'License :: DFSG approved',
59			'License :: OSI Approved :: GNU General Public License v2 (GPLv2)',
60			'Natural Language :: English',
61			'Programming Language :: Python :: 2.7',
62			'Programming Language :: Python :: 3.2',
63			'Operating System :: POSIX :: Linux',
64			'Topic :: Utilities',
65			],
66
67		platforms=['linux'],
68
69		# sudo apt install python-gi python3-gi \
70		#        gir1.2-gtk-3.0 gir1.2-notify-0.7 gir1.2-appindicator3-0.1
71		# os_requires=['gi.repository.GObject (>= 2.0)', 'gi.repository.Gtk (>= 3.0)'],
72
73		install_requires=['pyudev (>= 0.13)', ],
74		package_dir={'': 'lib'},
75		packages=['hidapi', 'logitech_receiver', 'solaar', 'solaar.ui', 'solaar.cli'],
76		data_files=list(_data_files()),
77		scripts=_glob('bin/*'),
78	)
79