forked from soundmud/soundrts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-doc.py
47 lines (39 loc) · 1.09 KB
/
build-doc.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
#! python2
import os
from os.path import join
import shutil
import tempfile
import webbrowser
from docutils import core
import rules2doc
SRC = "doc/src"
DEST = join(tempfile.gettempdir(), "soundrts/build/doc")
try:
os.makedirs(DEST)
except OSError:
pass
for lang in ("es", "it"):
p = join(SRC, lang, "htm")
dp = join(DEST, lang)
try:
os.mkdir(dp)
except OSError:
pass
for n in os.listdir(p):
shutil.copyfile(join(p, n), join(dp, n))
for lang in ("en", "pt-BR"):
p = join(SRC, lang)
dp = join(DEST, lang)
open(join(p, "stats.inc"), "w").write(rules2doc.stats)
try:
os.mkdir(dp)
except OSError:
pass
for n in os.listdir(p):
if n.endswith(".rst"):
core.publish_file(source_path=join(p, n), writer_name="html",
destination_path=join(dp, n[:-3] + "htm"))
shutil.copyfile(join(DEST, "en/units.htm"), join(DEST, "it/units.htm"))
for n in ("mapmaking", "modding", "aimaking"):
shutil.copyfile(join(DEST, "en/%s.htm" % n),
join(DEST, "pt-BR/%s.htm" % n))