forked from multani/sonata
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
103 lines (84 loc) · 2.6 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#!/usr/bin/env python
import sys
if sys.version_info <= (3, 2):
sys.stderr.write("Sonata requires Python 3.2+\n")
sys.exit(1)
from distutils.dep_util import newer
import glob
import os
from setuptools import setup, Extension
from sonata.version import version
tests_require = []
if sys.version_info < (3, 3):
# Available as unittest.mock since 3.3
tests_require.append('mock')
def capture(cmd):
return os.popen(cmd).read().strip()
def generate_translation_files():
lang_files = []
langs = (os.path.splitext(l)[0]
for l in os.listdir('po')
if l.endswith('po') and l != "messages.po")
for lang in langs:
pofile = os.path.join("po", "%s.po" % lang)
modir = os.path.join("sonata", "share", "locale", lang, "LC_MESSAGES")
mofile = os.path.join(modir, "sonata.mo")
if not os.path.exists(modir):
os.makedirs(modir)
lang_files.append(('share/locale/%s/LC_MESSAGES' % lang, [mofile]))
if newer(pofile, mofile):
print("Generating %s" % mofile)
os.system("msgfmt %s -o %s" % (pofile, mofile))
return lang_files
versionfile = open("sonata/genversion.py","wt")
versionfile.write("""
# generated by setup.py
VERSION = 'v%s'
""" % version)
versionfile.close()
data_files = [
('share/sonata', ['README.rst', 'CHANGELOG', 'TODO', 'TRANSLATORS']),
('share/applications', ['sonata.desktop']),
('share/man/man1', ['sonata.1']),
] + generate_translation_files()
setup(
name='Sonata',
version=version,
description='GTK+ client for the Music Player Daemon (MPD).',
author='Scott Horowitz',
author_email='[email protected]',
url='http://www.nongnu.org/sonata/',
classifiers=[
'Development Status :: 4 - Beta',
'Environment :: X11 Applications',
'Intended Audience :: End Users/Desktop',
'License :: GNU General Public License (GPL)',
'Operating System :: Linux',
'Programming Language :: Python',
'Topic :: Multimedia :: Sound :: Players',
],
packages=["sonata", "sonata.plugins"],
package_dir={"sonata": "sonata"},
data_files=data_files,
package_data={
'sonata': [
'pixmaps/*.*',
'ui/*.glade',
'ui/*.css',
'plugins/ui/*.glade',
'plugins/ui/*.css',
],
},
entry_points={
'console_scripts': [
'sonata=sonata.launcher:run',
]
},
test_suite='sonata.tests',
tests_require=tests_require,
)
try:
os.remove("sonata/genversion.py")
os.remove("sonata/genversion.pyc")
except:
pass