| 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: |