From 186f4c0dad214a9184bcb9afbdf3c92837ed1e79 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 2 Dec 2012 10:42:28 +0530 Subject: [PATCH] Signing of the 64-bit installer --- setup/installer/windows/__init__.py | 41 ++++++++++++++++++++--------- 1 file changed, 28 insertions(+), 13 deletions(-) diff --git a/setup/installer/windows/__init__.py b/setup/installer/windows/__init__.py index f3c1c2d0cd..eea0f9b487 100644 --- a/setup/installer/windows/__init__.py +++ b/setup/installer/windows/__init__.py @@ -8,14 +8,14 @@ __docformat__ = 'restructuredtext en' import os, shutil, subprocess -from setup import Command, __appname__, __version__ +from setup import Command, __appname__, __version__, installer_name from setup.installer import VMInstaller class Win(Command): description = 'Build windows binary installers' - sub_commands = ['win32'] + sub_commands = ['win64', 'win32'] def run(self, opts): pass @@ -35,28 +35,43 @@ class Win32(WinBase): VM = '/vmware/bin/%s'%VM_NAME VM_CHECK = 'calibre_windows_xp_home' + @property + 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')) + if not os.path.exists(installer): + self.warn(errmsg) + raise SystemExit(1) def download_installer(self): installer = self.installer() if os.path.exists('build/winfrozen'): shutil.rmtree('build/winfrozen') - self.sign_msi() + 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') - subprocess.check_call(('scp', - 'xp_build:build/%s/%s'%(__appname__, installer), 'dist')) - if not os.path.exists(installer): - self.warn('Failed to freeze') - raise SystemExit(1) + self.do_dl(installer, 'Failed to freeze') installer = 'dist/%s-portable-installer-%s.exe'%(__appname__, __version__) - subprocess.check_call(('scp', - 'xp_build:build/%s/%s'%(__appname__, installer), 'dist')) - if not os.path.exists(installer): - self.warn('Failed to get portable installer') - raise SystemExit(1) + self.do_dl(installer, 'Failed to get portable installer') class Win64(WinBase):