(url, destfile, bandwidth_limit)
| 317 | |
| 318 | |
| 319 | def __wget(url, destfile, bandwidth_limit): |
| 320 | if os.path.exists(destfile): |
| 321 | if os.path.isfile(destfile): |
| 322 | os.remove(destfile) |
| 323 | else: |
| 324 | print('Error: ' + destfile + ' exists but it is not a file! Please check the path and delete it manually.') |
| 325 | sys.exit(1) |
| 326 | wget_call = ['wget', '--tries=10', '--timeout=300', '-O', destfile, url] |
| 327 | if bandwidth_limit and isinstance(bandwidth_limit, str): |
| 328 | wget_call.append('--limit-rate=' + bandwidth_limit) |
| 329 | exitcode = subprocess.call(wget_call) |
| 330 | if exitcode != 0: |
| 331 | print('wget failed with ' + str(exitcode)) |
| 332 | os.remove(destfile) |
| 333 | return False |
| 334 | if not os.path.isfile(destfile): |
| 335 | return False |
| 336 | return True |
| 337 | |
| 338 | |
| 339 | def download_package(work_path, package, bandwidth_limit): |
no test coverage detected