Ticket #249: without_connection_patch_2.diff
| File without_connection_patch_2.diff, 2.1 KB (added by haikubot, 6 years ago) |
|---|
-
haikuporter
409 409 self.lastTime = time.time() 410 410 os.chdir(self.downloadDir) 411 411 for src_uri in self.bepKeys['SRC_URI']: 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() 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...' 418 415 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_size421 else:422 local_size = 0423 # check if file was already downloaded424 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 archive430 416 return 431 except: 432 raise 433 print " error... trying next location" 434 continue 417 else: 418 print "Fetching " + src_uri 419 try: 420 file_uri = urllib2.urlopen(src_uri) 421 headers = file_uri.info() 422 remote_size = long(headers.getheader("Content-Length")) 423 src_uri = file_uri.geturl() 424 self.src_local = src_uri[src_uri.rindex('/') + 1:] 425 if os.path.exists(self.src_local): 426 local_size = os.stat(self.src_local).st_size 427 else: 428 local_size = 0 429 # check if file was already downloaded 430 if local_size == remote_size: 431 print ' file was already downloaded... continuing' 432 else: 433 urllib.urlretrieve(src_uri, self.src_local, self.downloadProgressIndicator) 434 print '' 435 # succesfully downloaded source archive 436 return 437 except: 438 raise 439 print " error... trying next location" 440 continue 435 441 # failed to fetch source 436 442 print "Failed to fetch source package from all locations" 437 443 sys.exit()
