| 412 | | print "Fetching " + src_uri |
| 413 | | try: |
| 414 | | file_uri = urllib2.urlopen(src_uri) |
| 415 | | headers = file_uri.info() |
| 416 | | remote_size = long(headers.getheader("Content-Length")) |
| 417 | | src_uri = file_uri.geturl() |
| 418 | | self.src_local = src_uri[src_uri.rindex('/') + 1:] |
| 419 | | if os.path.exists(self.src_local): |
| 420 | | local_size = os.stat(self.src_local).st_size |
| 421 | | else: |
| 422 | | local_size = 0 |
| 423 | | # check if file was already downloaded |
| 424 | | if local_size == remote_size: |
| 425 | | print ' file was already downloaded... continuing' |
| 426 | | else: |
| 427 | | urllib.urlretrieve(src_uri, self.src_local, self.downloadProgressIndicator) |
| 428 | | print '' |
| 429 | | # succesfully downloaded source archive |
| 430 | | return |
| 431 | | except: |
| 432 | | raise |
| 433 | | print " error... trying next location" |
| 434 | | continue |
| | 412 | fp = self.downloadDir+'/'+src_uri[src_uri.rindex('/') + 1:] |
| | 413 | if os.path.isfile(fp): |
| | 414 | print 'Seems file already exist, checkout: ' + fp + '.\nSkip fetching file...' |
| | 415 | else: |
| | 416 | print "Fetching " + src_uri |
| | 417 | try: |
| | 418 | file_uri = urllib2.urlopen(src_uri) |
| | 419 | headers = file_uri.info() |
| | 420 | remote_size = long(headers.getheader("Content-Length")) |
| | 421 | src_uri = file_uri.geturl() |
| | 422 | self.src_local = src_uri[src_uri.rindex('/') + 1:] |
| | 423 | if os.path.exists(self.src_local): |
| | 424 | local_size = os.stat(self.src_local).st_size |
| | 425 | else: |
| | 426 | local_size = 0 |
| | 427 | # check if file was already downloaded |
| | 428 | if local_size == remote_size: |
| | 429 | print ' file was already downloaded... continuing' |
| | 430 | else: |
| | 431 | urllib.urlretrieve(src_uri, self.src_local, self.downloadProgressIndicator) |
| | 432 | print '' |
| | 433 | # succesfully downloaded source archive |
| | 434 | return |
| | 435 | except: |
| | 436 | raise |
| | 437 | print " error... trying next location" |
| | 438 | continue |