-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathsetup.py
191 lines (157 loc) · 5.92 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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
from distutils.cmd import Command
from pathlib import Path
from babel.messages.frontend import compile_catalog, extract_messages, init_catalog, update_catalog
from setuptools import setup, find_packages
from setuptools.command.build_py import build_py
from jellyfin_alexa_skill import __version__
from jellyfin_alexa_skill.alexa.setup.interaction.l10n import build_pot_file_str as interaction_build_pot_file_str
from jellyfin_alexa_skill.alexa.setup.manifest.l10n import build_pot_file_str as manifest_build_pot_file_str
with open("Readme.md") as f:
long_description = f.read()
install_requires = [
"flask-ask-sdk~=1.0.0",
"ask-smapi-sdk~=1.0.0",
"ask_smapi_model>=1.13.1,<1.15.0",
"peewee>=3.14.4,<3.16.0",
"gunicorn~=20.1.0",
"Flask-WTF>=0.15.1,<1.1.0",
"psycopg2~=2.9.3"
]
setup_requires = [
"Babel>=2.9.1,<2.11.0",
]
LOCAL_BASE_PATH = Path("jellyfin_alexa_skill/locales")
class CompileCatalogAndBuildPyCommand(build_py):
def run(self):
self.run_command("compile_catalog")
build_py.run(self)
class CompileCatalogCommand(compile_catalog):
def initialize_options(self):
compile_catalog.initialize_options(self)
self.directory = "jellyfin_alexa_skill/locales"
self.domain = "skill manifest interaction_model"
self.use_fuzzy = True
class ExtractMessagesCommand(Command):
description = "Extract messages from source code"
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
# extract skill messages
cmd = SkillExtractMessagesCommand()
cmd.initialize_options()
cmd.finalize_options()
cmd.run()
# extract manifest messages
manifest_pot_file_str = manifest_build_pot_file_str()
with (LOCAL_BASE_PATH / "manifest.pot").open("w") as f:
f.write(manifest_pot_file_str)
# extract interaction model messages
interaction_model_pot_file_str = interaction_build_pot_file_str()
with (LOCAL_BASE_PATH / "interaction_model.pot").open("w") as f:
f.write(interaction_model_pot_file_str)
class SkillExtractMessagesCommand(extract_messages):
def initialize_options(self):
extract_messages.initialize_options(self)
self.input_paths = "jellyfin_alexa_skill"
self.output_file = "jellyfin_alexa_skill/locales/skill.pot"
class UpdateCatalogCommand(Command):
description = "Update the message catalogs"
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
cmd = UpdateSkillCatalogCommand()
cmd.initialize_options()
cmd.finalize_options()
cmd.run()
# update manifest catalog
cmd = UpdateManifestCatalogCommand()
cmd.initialize_options()
cmd.finalize_options()
cmd.run()
# update interaction model catalog
cmd = UpdateInteractionModelCatalogCommand()
cmd.initialize_options()
cmd.finalize_options()
cmd.run()
class UpdateSkillCatalogCommand(update_catalog):
def initialize_options(self):
update_catalog.initialize_options(self)
self.output_dir = "jellyfin_alexa_skill/locales"
self.domain = "skill"
self.input_file = "jellyfin_alexa_skill/locales/skill.pot"
self.no_wrap = True
self.ignore_obsolete = True
self.update_header_comment = False
class UpdateManifestCatalogCommand(update_catalog):
def initialize_options(self):
update_catalog.initialize_options(self)
self.output_dir = "jellyfin_alexa_skill/locales"
self.domain = "manifest"
self.input_file = "jellyfin_alexa_skill/locales/manifest.pot"
self.no_wrap = True
self.ignore_obsolete = True
self.update_header_comment = False
class UpdateInteractionModelCatalogCommand(update_catalog):
def initialize_options(self):
update_catalog.initialize_options(self)
self.output_dir = "jellyfin_alexa_skill/locales"
self.domain = "interaction_model"
self.input_file = "jellyfin_alexa_skill/locales/interaction_model.pot"
self.no_wrap = True
self.ignore_obsolete = True
self.update_header_comment = False
setup(
name="jellyfin_alexa_skill",
version=__version__,
author="infinityofspace",
url="https://github.com/infinityofspace/jellyfin_alexa_skill",
description="Selfhosted Alexa media player skill for Jellyfin",
long_description=long_description,
long_description_content_type="text/markdown",
license="MIT",
classifiers=[
"Development Status :: 3 - Alpha",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
"Topic :: Utilities",
"Topic :: Multimedia :: Sound/Audio",
"Topic :: Multimedia :: Video"
],
packages=find_packages(),
python_requires=">=3.7",
install_requires=install_requires,
setup_requires=setup_requires,
package_data={
"jellyfin_alexa_skill": [
"alexa/setup/interaction/*.json",
"alexa/setup/manifest/*.json",
"locales/*/*/*.po",
"locales/*/*/*.mo",
"jellyfin/web/templates/*.html"
]
},
include_package_data=True,
entry_points={
"console_scripts": [
"jellyfin-alexa-skill = jellyfin_alexa_skill.main:main",
]
},
cmdclass={
"build_py": CompileCatalogAndBuildPyCommand,
"compile_catalog": CompileCatalogCommand,
"extract_messages": ExtractMessagesCommand,
"init_catalog": init_catalog,
"update_catalog": UpdateCatalogCommand
}
)