forked from readthedocs/sphinx_rtd_theme
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.py
More file actions
Latest commit
96 lines (64 loc) · 2.06 KB
/
Copy pathsetup.py
File metadata and controls
96 lines (64 loc) · 2.06 KB
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
# -*- coding: utf-8 -*-
importdistutils.cmd
importos
importsubprocess
fromioimportopen
fromsetuptoolsimportsetup
classWebpackBuildCommand(distutils.cmd.Command):
description="Generate static assets"
user_options= []
definitialize_options(self):
pass
deffinalize_options(self):
pass
defrun(self):
ifnot'CI'inos.environandnot'TOX_ENV_NAME'inos.environ:
subprocess.run(['npm', 'install'], check=True)
subprocess.run(['node_modules/.bin/webpack', '--config', 'webpack.prod.js'], check=True)
classWebpackDevelopCommand(distutils.cmd.Command):
description="Run Webpack dev server"
user_options= []
definitialize_options(self):
pass
deffinalize_options(self):
pass
defrun(self):
subprocess.run(
["node_modules/.bin/webpack-dev-server", "--open", "--config", "webpack.dev.js"],
check=True
)
classUpdateTranslationsCommand(distutils.cmd.Command):
description="Run all localization commands"
user_options= []
sub_commands= [
('extract_messages', None),
('update_catalog', None),
('transifex', None),
('compile_catalog', None),
]
definitialize_options(self):
pass
deffinalize_options(self):
pass
defrun(self):
forcmd_nameinself.get_sub_commands():
self.run_command(cmd_name)
classTransifexCommand(distutils.cmd.Command):
description="Update translation files through Transifex"
user_options= []
definitialize_options(self):
pass
deffinalize_options(self):
pass
defrun(self):
subprocess.run(['tx', 'push', '--source'], check=True)
subprocess.run(['tx', 'pull', '--mode', 'onlyreviewed', '-f', '-a'], check=True)
setup(
version='3.0.0rc1',
cmdclass={
'update_translations': UpdateTranslationsCommand,
'transifex': TransifexCommand,
'build_assets': WebpackBuildCommand,
'watch': WebpackDevelopCommand,
},
)