From 7aafb31929bf34fa18bf39722b83d03d08057495 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 17 Jul 2012 13:32:54 +0530 Subject: [PATCH] Digitally sign the windows .msi installer --- setup/installer/windows/__init__.py | 13 ++++++++++++- setup/installer/windows/freeze.py | 1 - 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/setup/installer/windows/__init__.py b/setup/installer/windows/__init__.py index a7b4a62af4..13b452b31c 100644 --- a/setup/installer/windows/__init__.py +++ b/setup/installer/windows/__init__.py @@ -6,11 +6,13 @@ __license__ = 'GPL v3' __copyright__ = '2009, Kovid Goyal ' __docformat__ = 'restructuredtext en' -import os, shutil, subprocess +import os, shutil, subprocess, re from setup import Command, __appname__, __version__ from setup.installer import VMInstaller +SIGNTOOL = r'C:\cygwin\home\kovid\sign.bat' + class Win(Command): description = 'Build windows binary installers' @@ -34,10 +36,19 @@ class Win32(VMInstaller): INSTALLER_EXT = 'msi' SHUTDOWN_CMD = ['shutdown.exe', '-s', '-f', '-t', '0'] + def sign_msi(self): + raw = open(self.VM).read() + vmx = re.search(r'''launch_vmware\(['"](.+?)['"]''', raw).group(1) + subprocess.check_call(['vmrun', '-T', 'ws', '-gu', 'kovid', '-gp', + "et tu brutus", 'runProgramInGuest', vmx, 'cmd.exe', '/C', + r'C:\cygwin\home\kovid\sign.bat']) + def download_installer(self): installer = self.installer() if os.path.exists('build/winfrozen'): shutil.rmtree('build/winfrozen') + self.sign_msi() + subprocess.check_call(('scp', 'xp_build:build/%s/%s'%(__appname__, installer), 'dist')) if not os.path.exists(installer): diff --git a/setup/installer/windows/freeze.py b/setup/installer/windows/freeze.py index b7f6c426f1..48dd2479c2 100644 --- a/setup/installer/windows/freeze.py +++ b/setup/installer/windows/freeze.py @@ -23,7 +23,6 @@ SW = r'C:\cygwin\home\kovid\sw' IMAGEMAGICK = os.path.join(SW, 'build', 'ImageMagick-6.7.6', 'VisualMagick', 'bin') CRT = r'C:\Microsoft.VC90.CRT' -SIGNTOOL = r'C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin\signtool.exe' VERSION = re.sub('[a-z]\d+', '', __version__) WINVER = VERSION+'.0'