Commit 469c889e authored by Jason R. Coombs's avatar Jason R. Coombs

Use iterables for getting best downloader

parent aae75a3d
......@@ -246,16 +246,14 @@ def download_file_insecure(url, target):
download_file_insecure.viable = lambda: True
def get_best_downloader():
downloaders = [
downloaders = (
download_file_powershell,
download_file_curl,
download_file_wget,
download_file_insecure,
]
for dl in downloaders:
if dl.viable():
return dl
)
viable_downloaders = (dl for dl in downloaders if dl.viable())
return next(viable_downloaders, None)
def download_setuptools(version=DEFAULT_VERSION, download_base=DEFAULT_URL,
to_dir=os.curdir, delay=15, downloader_factory=get_best_downloader):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment