This repository has been archived by the owner on Apr 6, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
79 lines (63 loc) · 2.55 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
import os
from babel.messages import frontend as babel
from distutils import cmd
from distutils.command.install_data import install_data as _install_data
from distutils.command.build import build as _build
from setuptools import setup
from copy import copy
from tune.tune import VERSION
# Utility function to read the README file.
# Used for the long_description. It's nice, because now 1) we have a top level
# README file and 2) it's easier to type in the README file than to put a raw
# string in below ...
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
message_extractors = {'tune': [
('**.py', 'python', None)]
}
# Link tune.py to tune
if not os.path.exists("tune/tune"):
os.symlink(os.path.abspath("tune/tune.py"), "tune/tune")
langs = [l[:-3] for l in os.listdir('po') if l.endswith('.po')
and l != "messages.po"]
mofiles = [('share/locale/%s/LC_MESSAGES' % lang, ['build/mo/%s/tune.mo' % lang]) for lang in langs]
class BuildPofiles(cmd.Command):
def initialize_options(self): pass
def finalize_options(self): pass
def run(self):
# Create mo files:
if not os.path.exists("build/mo/"):
os.mkdir("build/mo/")
for lang in langs:
pofile = os.path.join("po", "%s.po" % lang)
modir = os.path.join("build", "mo", lang)
mofile = os.path.join(modir, "tune.mo")
if not os.path.exists(modir):
os.mkdir(modir)
print "generating", mofile
os.system("msgfmt --statistics %s -o %s" % (pofile, mofile))
class build(_build):
sub_commands = _build.sub_commands + [('build_pofiles', None)]
def run(self):
_build.run(self)
setup(
name = "mpd-tune",
version = VERSION,
author = "Rafal Macyszyn",
author_email = "[email protected]",
description = ("Easily find and tune a song in MPD playlist"),
cmdclass = {'build': build,
'compile_catalog': babel.compile_catalog,
'extract_messages': babel.extract_messages,
'init_catalog': babel.init_catalog,
'update_catalog': babel.update_catalog,
'build_pofiles': BuildPofiles},
data_files = mofiles,
install_requires = ['python-Levenshtein', 'termcolor', 'python-mpd2', 'babel'],
license = "ISC",
url = "http://github.com/chommik/mpd-tune",
packages = ['tune'],
package_dir = {"tune": "tune/"},
scripts = ["tune/tune"],
long_description=read('README'),
)