Merge branch 'kovidgoyal/master'

This commit is contained in:
Charles Haley 2013-06-25 08:25:30 +02:00
commit 9f12bd5699
5 changed files with 34 additions and 2 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

@ -62,7 +62,7 @@
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" title="Contribute to support calibre development">
<input type="hidden" name="cmd" value="_s-xclick" />
<input type="hidden" name="hosted_button_id" value="AF4H3B8QVDG6N" />
<input type="image" src="http://manual.calibre-ebook.com/simple_donate_button.gif" border="0" name="submit" alt="Contribute to support calibre development" style="border:0pt" />
<input type="image" src="_static/simple_donate_button.gif" border="0" name="submit" alt="Contribute to support calibre development" style="border:0pt" />
<img alt="" border="0" src="https://www.paypalobjects.com/en_GB/i/scr/pixel.gif" width="1" height="1" />
</form>
<hr/>

View File

@ -402,6 +402,29 @@ def upload_to_servers(files, version): # {{{
print ('Uploaded in', int(time.time() - start), 'seconds\n\n')
# }}}
def upload_to_dbs(files, version): # {{{
print('Uploading to downloadbestsoftware.com')
server = 'www.downloadbestsoft-mirror1.com'
rdir = 'release/'
check_call(['ssh', 'kovid@%s' % server, 'rm -f release/*'])
for x in files:
start = time.time()
print ('Uploading', x)
for i in range(5):
try:
check_call(['rsync', '-h', '-z', '--progress', '-e', 'ssh -x', x,
'kovid@%s:%s'%(server, rdir)])
except KeyboardInterrupt:
raise SystemExit(1)
except:
print ('\nUpload failed, trying again in 30 seconds')
time.sleep(30)
else:
break
print ('Uploaded in', int(time.time() - start), 'seconds\n\n')
check_call(['ssh', 'kovid@%s' % server, '/home/kovid/uploadFiles'])
# }}}
# CLI {{{
def cli_parser():
epilog='Copyright Kovid Goyal 2012'
@ -434,6 +457,7 @@ def cli_parser():
epilog=epilog)
cron = subparsers.add_parser('cron', help='Call script from cron')
subparsers.add_parser('calibre', help='Upload to calibre file servers')
subparsers.add_parser('dbs', help='Upload to downloadbestsoftware.com')
a = gc.add_argument
@ -498,6 +522,8 @@ def main(args=None):
login_to_google(args.username, args.password)
elif args.service == 'calibre':
upload_to_servers(ofiles, args.version)
elif args.service == 'dbs':
upload_to_dbs(ofiles, args.version)
if __name__ == '__main__':
main()

View File

@ -114,6 +114,9 @@ def sf_cmdline(ver, sdata):
def calibre_cmdline(ver):
return [__appname__, ver, 'fmap', 'calibre']
def dbs_cmdline(ver):
return [__appname__, ver, 'fmap', 'dbs']
def run_remote_upload(args):
print 'Running remotely:', ' '.join(args)
subprocess.check_call(['ssh', '-x', '%s@%s'%(STAGING_USER, STAGING_HOST),
@ -140,6 +143,7 @@ class UploadInstallers(Command): # {{{
self.upload_to_staging(tdir, backup, files)
self.upload_to_sourceforge()
self.upload_to_calibre()
self.upload_to_dbs()
# self.upload_to_google(opts.replace)
finally:
shutil.rmtree(tdir, ignore_errors=True)
@ -184,6 +188,8 @@ class UploadInstallers(Command): # {{{
def upload_to_calibre(self):
run_remote_upload(calibre_cmdline(__version__))
def upload_to_dbs(self):
run_remote_upload(dbs_cmdline(__version__))
# }}}
class UploadUserManual(Command): # {{{

View File

@ -104,7 +104,7 @@ class HTMLConverter(object):
# Replace entities
(re.compile(ur'&(\S+?);'), partial(entity_to_unicode,
exceptions=['lt', 'gt', 'amp'])),
exceptions=['lt', 'gt', 'amp', 'quot'])),
# Remove comments from within style tags as they can mess up BeatifulSoup
(re.compile(r'(<style.*?</style>)', re.IGNORECASE|re.DOTALL),
strip_style_comments),