MCPcopy Create free account
hub / github.com/aaPanel/BaoTa / download

Method download

class/projectModel/btpyvm.py:184–203  ·  view source on GitHub ↗
(self, base_url)

Source from the content-addressed store, hash-verified

182 response.close()
183
184 def download(self, base_url) -> bool:
185 if self.is_pypy:
186 cache_dir = os.path.join(self.bt_pypy_path, "cached")
187 else:
188 cache_dir = os.path.join(self.bt_python_path, "cached")
189 if not os.path.exists(cache_dir):
190 os.makedirs(cache_dir)
191 dst = os.path.join(cache_dir, self.file_name)
192 if os.path.exists(dst) and os.path.getsize(dst) > 1024 * 1024 * 10:
193 print("[1/3] 使用缓存中的源码文件......", file=_vm_std.out, flush=True)
194 return self.check(dst)
195
196 print("[1/3] 下载源码文件......", file=_vm_std.out, flush=True)
197 print("下载源码文件中......", file=_vm_std.out, flush=True)
198 down_url = "{}{}/{}".format(base_url, self.version, self.file_name)
199 if self.is_pypy:
200 down_url = "{}{}".format(base_url, self.file_name)
201 self._download_file(dst, down_url)
202 print('下载完成', file=_vm_std.out, flush=True)
203 return self.check(dst)
204
205 def _install(self, extended_args='') -> bool:
206 if self.is_pypy:

Callers 1

installMethod · 0.95

Calls 5

checkMethod · 0.95
_download_fileMethod · 0.95
joinMethod · 0.45
existsMethod · 0.45
formatMethod · 0.45

Tested by

no test coverage detected