diff --git a/setup/installer/windows/freeze.py b/setup/installer/windows/freeze.py index 08aa91fe10..b983d09e73 100644 --- a/setup/installer/windows/freeze.py +++ b/setup/installer/windows/freeze.py @@ -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): diff --git a/setup/installer/windows/portable-installer.cpp b/setup/installer/windows/portable-installer.cpp index 4929fb2312..af8281470f 100644 --- a/setup/installer/windows/portable-installer.cpp +++ b/setup/installer/windows/portable-installer.cpp @@ -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); }