From dcc1545ac813c3a1ab3917c5292975e9eee49ea6 Mon Sep 17 00:00:00 2001 From: Sam Wilson Date: Tue, 24 May 2016 14:04:48 +1000 Subject: [PATCH] Added more robust error handling around jar downloads --- setup.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index e1e6991..13d6482 100644 --- a/setup.py +++ b/setup.py @@ -14,7 +14,7 @@ """ from __future__ import print_function from setuptools import setup -import os, sys, glob +import os, sys, glob, errno from setuptools import Command from setuptools.command.install import install @@ -105,11 +105,17 @@ def download_file(self, url, dest): Downloads a file at the url to the destination. ''' print('Attempting to retrieve remote jar {url}'.format(url=url)) + try: + os.makedirs(self.destdir) + except OSError as exception: + if exception.errno != errno.EEXIST: + raise try: urlretrieve(url, dest) print('Saving {url} -> {dest}'.format(url=url, dest=dest)) - except: + except Exception as exception: print('Failed to retrieve {url}'.format(url=url)) + print(exception) return def download_files(self):