forked from lvgl/docs_old
-
Notifications
You must be signed in to change notification settings - Fork 0
/
update.py
executable file
·56 lines (40 loc) · 1.08 KB
/
update.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
#!/usr/bin/env python
import sys
import os
import re
langs = ['en']
def cmd(s):
print("")
print(s)
print("----------------------------")
r = os.system(s)
if r != 0:
print "Exit update due to previous error"
exit(-1)
br_arr = sys.argv[1:]
for br in br_arr:
tmpdir = "_docs_tmp_" + re.sub('/', '_', br)
urlpath = re.sub('release/', '', br)
print("")
print("Update " + br)
print("========================")
cmd("git co " + br)
cmd("git clean -fd")
cmd("git pull origin " + br)
cmd("git submodule update")
cmd("./build.py trans")
os.system("git ci -am 'Rebuild'")
cmd("git push origin " + br)
cmd("rm -fr ../" + tmpdir)
for l in langs:
if os.path.isdir("./" + l):
cmd("mkdir -p ../" + tmpdir + "/" + l + "/")
cmd("cp -r " + l +"/ ../" + tmpdir + "/")
cmd("git co master")
cmd("git clean -fd")
for l in langs:
cmd("rm -rf " + br + "/" + l)
cmd("cp -r ../" + tmpdir + "/. " + br + "/")
cmd("git add " + urlpath)
os.system("git ci -m 'Update " + urlpath + "'")
cmd("git push origin master")