mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix linux binary installer to work with dumb terminals
This commit is contained in:
parent
3aa2eea42c
commit
37eceaf02f
@ -240,13 +240,21 @@ def do_postinstall(destdir):
|
||||
os.chdir(cwd)
|
||||
|
||||
def download_tarball():
|
||||
pb = ProgressBar(TerminalController(sys.stdout), 'Downloading calibre...')
|
||||
try:
|
||||
pb = ProgressBar(TerminalController(sys.stdout), 'Downloading calibre...')
|
||||
except ValueError:
|
||||
print 'Downloading calibre...'
|
||||
pb = None
|
||||
src = urllib2.urlopen(MOBILEREAD+'calibre-%version-i686.tar.bz2')
|
||||
size = int(src.info()['content-length'])
|
||||
f = tempfile.NamedTemporaryFile()
|
||||
while f.tell() < size:
|
||||
f.write(src.read(4*1024))
|
||||
pb.update(f.tell()/float(size))
|
||||
percent = f.tell()/float(size)
|
||||
if pb is not None:
|
||||
pb.update(percent)
|
||||
else:
|
||||
print '%d%, '%int(percent*100)
|
||||
f.seek(0)
|
||||
return f
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user