From 710f6fc94deacbb07ed9e62567eabd22d36d180c Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 4 Dec 2012 12:08:49 +0530 Subject: [PATCH] Faster signing of windows installers --- setup/installer/windows/__init__.py | 18 ------------------ setup/installer/windows/freeze.py | 12 ++++++++++++ 2 files changed, 12 insertions(+), 18 deletions(-) diff --git a/setup/installer/windows/__init__.py b/setup/installer/windows/__init__.py index eea0f9b487..5e1ad4a7c0 100644 --- a/setup/installer/windows/__init__.py +++ b/setup/installer/windows/__init__.py @@ -39,18 +39,6 @@ class Win32(WinBase): def msi64(self): return installer_name('msi', is64bit=True) - def sign_msi(self): - import xattr - print ('Signing installers ...') - sign64 = False - msi64 = self.msi64 - if os.path.exists(msi64) and 'user.signed' not in xattr.list(msi64): - subprocess.check_call(['scp', msi64, self.VM_NAME + - ':build/%s/%s'%(__appname__, msi64)]) - sign64 = True - subprocess.check_call(['ssh', self.VM_NAME, '~/sign.sh'], shell=False) - return sign64 - def do_dl(self, installer, errmsg): subprocess.check_call(('scp', '%s:build/%s/%s'%(self.VM_NAME, __appname__, installer), 'dist')) @@ -62,14 +50,8 @@ class Win32(WinBase): installer = self.installer() if os.path.exists('build/winfrozen'): shutil.rmtree('build/winfrozen') - sign64 = self.sign_msi() - if sign64: - self.do_dl(self.msi64, 'Failed to d/l signed 64 bit installer') - import xattr - xattr.set(self.msi64, 'user.signed', 'true') self.do_dl(installer, 'Failed to freeze') - installer = 'dist/%s-portable-installer-%s.exe'%(__appname__, __version__) self.do_dl(installer, 'Failed to get portable installer') diff --git a/setup/installer/windows/freeze.py b/setup/installer/windows/freeze.py index bd05fb06c9..4008317341 100644 --- a/setup/installer/windows/freeze.py +++ b/setup/installer/windows/freeze.py @@ -91,6 +91,7 @@ class Win32Freeze(Command, WixMixIn): if not is64bit: self.build_portable() self.build_portable_installer() + self.sign_installers() def remove_CRT_from_manifests(self): ''' @@ -488,6 +489,17 @@ class Win32Freeze(Command, WixMixIn): subprocess.check_call([LZMA + r'\bin\elzma.exe', '-9', '--lzip', name]) + def sign_installers(self): + self.info('Signing installers...') + files = glob.glob(self.j('dist', '*.msi')) + glob.glob(self.j('dist', + '*.exe')) + if not files: + raise ValueError('No installers found') + subprocess.check_call(['signtool.exe', 'sign', '/a', '/d', + 'calibre - E-book management', '/du', + 'http://calibre-ebook.com', '/t', + 'http://timestamp.verisign.com/scripts/timstamp.dll'] + files) + def add_dir_to_zip(self, zf, path, prefix=''): ''' Add a directory recursively to the zip file with an optional prefix.