From 07997a77c6a6a61c23bb4b1a8a16d07c7aae39fb Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 11 Feb 2019 16:45:20 +0100 Subject: setup.py: Retry to downloading dependencies Fix frequent timeouts in COIN. Change-Id: I2a85fd6a72891a937a758e0f5c38aacdcb83de8f Reviewed-by: Cristian Maureira-Fredes --- build_scripts/utils.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/build_scripts/utils.py b/build_scripts/utils.py index 019090dab..6aafb7588 100644 --- a/build_scripts/utils.py +++ b/build_scripts/utils.py @@ -737,11 +737,16 @@ _7z_binary = None def download_and_extract_7z(fileurl, target): """ Downloads 7z file from fileurl and extract to target """ - print("Downloading fileUrl {} ".format(fileurl)) info = "" - try: - localfile, info = urllib.urlretrieve(fileurl) - except: + localfile = None + for i in range(1, 10): + try: + print("Downloading fileUrl {}, attempt #{}".format(fileurl, i)) + localfile, info = urllib.urlretrieve(fileurl) + break + except: + pass + if not localfile: print("Error downloading {} : {}".format(fileurl, info)) raise RuntimeError(' Error downloading {}'.format(fileurl)) -- cgit v1.2.3