forked from shirof1re/OpenDocPy
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdate_excel.py
More file actions
45 lines (37 loc) · 943 Bytes
/
Copy pathupdate_excel.py
File metadata and controls
45 lines (37 loc) · 943 Bytes
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
import subprocess
import os
import shutil
import stat
for i, j, k in [
[
"https://github.com/Kengxxiao/ArknightsGameData.git", "zh_CN", "data"
],
[
"https://github.com/Kengxxiao/ArknightsGameData_YoStar.git", "en_US", "data-global"
]
]:
subprocess.run(
[
"git", "clone",
"-n", "--depth=1", "--filter=tree:0",
i, "tmp"
]
)
subprocess.run(
[
"git", "sparse-checkout", "set",
f"{j}/gamedata/excel/"
], cwd="tmp"
)
subprocess.run(
[
"git", "checkout"
], cwd="tmp"
)
if os.path.isdir(f"tmp/{j}/gamedata/excel/"):
shutil.rmtree(f"{k}/excel")
shutil.move(f"tmp/{j}/gamedata/excel/", k)
def rmtree_onerror(function, path, excinfo):
os.chmod(path, stat.S_IWUSR)
function(path)
shutil.rmtree("tmp/", onerror=rmtree_onerror)