MCPcopy Create free account
hub / github.com/cppcheck-opensource/cppcheck / __wget

Function __wget

tools/donate_cpu_lib.py:319–336  ·  view source on GitHub ↗
(url, destfile, bandwidth_limit)

Source from the content-addressed store, hash-verified

317
318
319def __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
339def download_package(work_path, package, bandwidth_limit):

Callers 1

download_packageFunction · 0.85

Calls 2

strFunction · 0.85
existsMethod · 0.45

Tested by

no test coverage detected