When uploading installers, try repeatedly in case of failure

This commit is contained in:
Kovid Goyal 2011-11-25 11:37:58 +05:30
parent fe0744431f
commit f2ce27fae9

View File

@ -141,8 +141,17 @@ class UploadToGoogleCode(Command): # {{{
'dmg':'OSX','bz2':'Linux','gz':'All'}[ext] 'dmg':'OSX','bz2':'Linux','gz':'All'}[ext]
desc = installer_description(fname) desc = installer_description(fname)
start = time.time() start = time.time()
for i in range(5):
try:
path = self.upload(os.path.abspath(fname), desc, path = self.upload(os.path.abspath(fname), desc,
labels=[typ, op, 'Featured']) labels=[typ, op, 'Featured'])
except:
import traceback
traceback.print_exc()
print ('\nUpload failed, trying again in 30 secs')
time.sleep(30)
else:
break
self.info('Uploaded to:', path, 'in', int(time.time() - start), self.info('Uploaded to:', path, 'in', int(time.time() - start),
'seconds') 'seconds')
return path return path
@ -312,9 +321,16 @@ class UploadToSourceForge(Command): # {{{
if not os.path.exists(x): continue if not os.path.exists(x): continue
start = time.time() start = time.time()
self.info('Uploading', x) self.info('Uploading', x)
for i in range(5):
try:
check_call(['rsync', '-z', '--progress', '-e', 'ssh -x', x, check_call(['rsync', '-z', '--progress', '-e', 'ssh -x', x,
'%s,%s@frs.sourceforge.net:%s'%(self.USERNAME, self.PROJECT, '%s,%s@frs.sourceforge.net:%s'%(self.USERNAME, self.PROJECT,
self.rdir+'/')]) self.rdir+'/')])
except:
print ('\nUpload failed, trying again in 30 seconds')
time.sleep(30)
else:
break
print 'Uploaded in', int(time.time() - start), 'seconds' print 'Uploaded in', int(time.time() - start), 'seconds'
print ('\n') print ('\n')