9
9
# Dependency versions
10
10
maafw_version = "v1.7.0-alpha.2"
11
11
12
+
12
13
def copy_file_recursively (src , dst , system ):
13
14
if os .path .isdir (src ):
14
15
if not os .path .exists (dst ):
@@ -23,6 +24,7 @@ def copy_file_recursively(src, dst, system):
23
24
else :
24
25
os .system ("cp " + src + " " + dst )
25
26
27
+
26
28
def download (url : str , fname : str , chunk_size = 1024 ):
27
29
resp = requests .get (url , stream = True )
28
30
total = int (resp .headers .get ('content-length' , 0 ))
@@ -37,10 +39,11 @@ def download(url: str, fname: str, chunk_size=1024):
37
39
size = file .write (data )
38
40
bar .update (size )
39
41
42
+
40
43
def figure_triplet ():
41
44
supported_triplets = {
42
- "windows" : ["x86_64" ,"aarch64" ],
43
- "linux" : ["x86_64" ,"aarch64" ],
45
+ "windows" : ["x86_64" , "aarch64" ],
46
+ "linux" : ["x86_64" , "aarch64" ],
44
47
# may add macos support in the future
45
48
}
46
49
@@ -60,13 +63,15 @@ def figure_triplet():
60
63
61
64
return host_system , host_arch
62
65
66
+
63
67
def setup_deps_dir ():
64
68
deps_dir = "deps"
65
69
if not os .path .exists (deps_dir ):
66
70
os .makedirs (deps_dir )
67
71
68
72
return deps_dir
69
73
74
+
70
75
def setup_maafw_dynamic_libs (host_system , fw_dir ):
71
76
needed_libs = [
72
77
"fastdeploy_ppocr_maa" ,
@@ -80,6 +85,7 @@ def setup_maafw_dynamic_libs(host_system, fw_dir):
80
85
lib_dir = os .path .join (fw_dir , "bin" )
81
86
copy_file_recursively (lib_dir , os .path .join ("tauri" ), host_system )
82
87
88
+
83
89
def setup_maafw (host_system , host_arch , dst , force = False ):
84
90
print ("Setting up MAA Framework" )
85
91
print ("Downloading MAA Framework " + maafw_version )
@@ -88,8 +94,10 @@ def setup_maafw(host_system, host_arch, dst, force=False):
88
94
print ("MAA Framework already downloaded" )
89
95
else :
90
96
maafw_base_url = "https://github.com/MaaAssistantArknights/MaaFramework/releases/download/"
91
- triplet_string = ("win" if host_system == "windows" else host_system ) + "-" + host_arch
92
- maafw_url = maafw_base_url + maafw_version + "/MAA-" + triplet_string + "-" + maafw_version + ".zip"
97
+ triplet_string = ("win" if host_system ==
98
+ "windows" else host_system ) + "-" + host_arch
99
+ maafw_url = maafw_base_url + maafw_version + "/MAA-" + \
100
+ triplet_string + "-" + maafw_version + ".zip"
93
101
print ("Downloading from " + maafw_url )
94
102
download (maafw_url , maafw_zip )
95
103
@@ -111,7 +119,8 @@ def main():
111
119
host_system , host_arch = figure_triplet ()
112
120
print ("Setting up dependencies for " + host_system + "-" + host_arch )
113
121
triplet_dir = setup_deps_dir ()
114
- setup_maafw (host_system , host_arch , triplet_dir ,force )
122
+ setup_maafw (host_system , host_arch , triplet_dir , force )
123
+
115
124
116
125
if __name__ == "__main__" :
117
- main ()
126
+ main ()
0 commit comments