Proper fix for incorrect progress in portable installer

This commit is contained in:
Kovid Goyal 2014-06-06 07:48:25 +05:30
parent 585eaaafea
commit 64c865f31d
2 changed files with 3 additions and 2 deletions

View File

@ -69,6 +69,7 @@ class Win32Freeze(Command, WixMixIn):
def run(self, opts):
self.SW = SW
self.portable_uncompressed_size = 0
self.opts = opts
self.src_root = self.d(self.SRC)
self.base = self.j(self.d(self.SRC), 'build', 'winfrozen')
@ -407,7 +408,7 @@ class Win32Freeze(Command, WixMixIn):
def build_portable_installer(self):
zf = self.a(self.j('dist', 'calibre-portable-%s.zip.lz'%VERSION))
usz = os.path.getsize(zf)
usz = self.portable_uncompressed_size or os.path.getsize(zf)
def cc(src, obj):
cflags = '/c /EHsc /MT /W4 /Ox /nologo /D_UNICODE /DUNICODE /DPSAPI_VERSION=1'.split()
cflags.append(r'/I%s\include'%LZMA)
@ -504,6 +505,7 @@ class Win32Freeze(Command, WixMixIn):
with zipfile.ZipFile(name, 'w', zipfile.ZIP_STORED) as zf:
self.add_dir_to_zip(zf, base, 'Calibre Portable')
self.portable_uncompressed_size = os.path.getsize(name)
subprocess.check_call([LZMA + r'\bin\elzma.exe', '-9', '--lzip', name])
def sign_installers(self):

View File

@ -188,7 +188,6 @@ output_callback(void *ctx, const void *buf, size_t size)
return 0;
}
written = SetFilePointer(ds->out, 0, NULL, FILE_CURRENT);
FlushFileBuffers(ds->out); // Ensure progress is accurate, otherwise there is a long pause after the decompressing phase while the OS flushes to a slow flash drive
ds->pd->SetProgress(written, UNCOMPRESSED_SIZE);
}