-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsetup.py
executable file
·121 lines (104 loc) · 4.11 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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
#!/usr/bin/env python3
# Copyright 2018-2024 The Wazo Authors (see the AUTHORS file)
# SPDX-License-Identifier: GPL-3.0-or-later
from datetime import date
from distutils.cmd import Command as _Command
from setuptools import find_packages, setup
from setuptools.command.build_py import build_py as _build_py
PROJECT = 'wazo-phoned'
AUTHOR = 'Wazo Authors'
EMAIL = '[email protected]'
class build_py(_build_py):
def run(self):
self.run_command('compile_catalog')
super().run()
class BabelWrapper:
DEFAULT_HEADER = """\
# Translations template for {PROJECT}.
# Copyright {YEAR} The Wazo Authors (see the AUTHORS file)
# This file is distributed under the same license as the
# {PROJECT} project.
# Wazo Dev Team ([email protected]), {YEAR}.
#""".format(
PROJECT=PROJECT, YEAR=date.today().year
)
class Command(_Command):
user_options = []
class compile_catalog(Command):
def __new__(cls, *args, **kwargs):
return BabelWrapper().babel.compile_catalog(*args, **kwargs)
class extract_messages(Command):
def __new__(cls, *args, **kwargs):
return BabelWrapper().babel.extract_messages(*args, **kwargs)
class init_catalog(Command):
def __new__(cls, *args, **kwargs):
return BabelWrapper().babel.init_catalog(*args, **kwargs)
class update_catalog(Command):
def __new__(cls, *args, **kwargs):
return BabelWrapper().babel.update_catalog(*args, **kwargs)
@property
def babel(self):
from babel.messages import frontend as babel
from babel.messages.catalog import Catalog as _Catalog
class Catalog(_Catalog):
def __init__(
self,
project=PROJECT,
copyright_holder='The Wazo Authors (see the AUTHORS file)',
msgid_bugs_address=EMAIL,
last_translator=f'{AUTHOR} <{EMAIL}>',
language_team=f'en <{EMAIL}>',
**kwargs,
):
super().__init__(
header_comment=BabelWrapper.DEFAULT_HEADER,
project=project,
copyright_holder=copyright_holder,
msgid_bugs_address=msgid_bugs_address,
last_translator=last_translator,
language_team=language_team,
fuzzy=False,
**kwargs,
)
babel.Catalog = Catalog
return babel
babel_wrapper = BabelWrapper()
setup(
name=PROJECT,
version='1.0',
description='Wazo Phone Daemon',
author=AUTHOR,
author_email=EMAIL,
url='http://wazo-platform.org',
packages=find_packages(),
include_package_data=True,
package_data={'wazo_phoned.plugins': ['*/api.yml']},
setup_requires=['babel'],
install_requires=['babel'],
cmdclass={
'build_py': build_py,
'compile_catalog': babel_wrapper.compile_catalog,
'extract_messages': babel_wrapper.extract_messages,
'init_catalog': babel_wrapper.init_catalog,
'update_catalog': babel_wrapper.update_catalog,
},
entry_points={
'console_scripts': ['wazo-phoned=wazo_phoned.bin.daemon:main'],
'wazo_phoned.plugins': [
'api = wazo_phoned.plugins.api.plugin:Plugin',
'blf = wazo_phoned.plugins.blf.plugin:Plugin',
'aastra = wazo_phoned.plugins.aastra.plugin:Plugin',
'cisco = wazo_phoned.plugins.cisco.plugin:Plugin',
'config = wazo_phoned.plugins.config.plugin:Plugin',
'endpoint = wazo_phoned.plugins.endpoint.plugin:Plugin',
'fanvil = wazo_phoned.plugins.fanvil.plugin:Plugin',
'gigaset = wazo_phoned.plugins.gigaset.plugin:Plugin',
'htek = wazo_phoned.plugins.htek.plugin:Plugin',
'polycom = wazo_phoned.plugins.polycom.plugin:Plugin',
'snom = wazo_phoned.plugins.snom.plugin:Plugin',
'status = wazo_phoned.plugins.status.plugin:Plugin',
'thomson = wazo_phoned.plugins.thomson.plugin:Plugin',
'yealink = wazo_phoned.plugins.yealink.plugin:Plugin',
],
},
)