From 817032eb99df6deff41e594b8170dd4d108f4a78 Mon Sep 17 00:00:00 2001 From: Nick Bolton Date: Sat, 30 Jun 2012 12:37:50 +0000 Subject: [PATCH] added sign command. --- hm.py | 1 + tools/build/toolchain.py | 42 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) diff --git a/hm.py b/hm.py index be126a63..8c29a9a3 100644 --- a/hm.py +++ b/hm.py @@ -69,6 +69,7 @@ cmd_opt_dict = { 'open' : ['', []], 'genlist' : ['', []], 'reset' : ['', []], + 'sign' : ['', ['pfx=', 'pwd=', 'dist']] } # aliases to valid commands diff --git a/tools/build/toolchain.py b/tools/build/toolchain.py index 086d5332..5177d5ee 100644 --- a/tools/build/toolchain.py +++ b/tools/build/toolchain.py @@ -347,6 +347,35 @@ class InternalCommands: if self.enable_make_gui: self.make_gui(targets) + def sign(self, pfx, pwdFile, dist): + generator = self.getGeneratorFromConfig().cmakeName + if not generator.startswith('Visual Studio'): + raise Exception('only windows is supported') + + f = open(pwdFile) + lines = f.readlines() + f.close() + pwd = lines[0] + + if (dist): + self.signFile(pfx, pwd, 'bin', self.dist_name('win')) + else: + self.signFile(pfx, pwd, 'bin/Release', 'synergy.exe') + self.signFile(pfx, pwd, 'bin/Release', 'synergyc.exe') + self.signFile(pfx, pwd, 'bin/Release', 'synergys.exe') + self.signFile(pfx, pwd, 'bin/Release', 'synergyd.exe') + self.signFile(pfx, pwd, 'bin/Release', 'synrgyhk.dll') + + def signFile(self, pfx, pwd, dir, file): + self.try_chdir(dir) + err = os.system( + 'signtool sign' + ' /f ' + pfx + + ' /p ' + pwd + + ' /t http://timestamp.verisign.com/scripts/timstamp.dll ' + + file) + self.restore_chdir() + def runBuildCommand(self, cmd, target): self.try_chdir(self.getBuildDir(target)) @@ -1253,3 +1282,16 @@ class CommandHandler: def reset(self): self.ic.reset() + + def sign(self): + pfx = None + pwd = None + dist = False + for o, a in self.opts: + if o == '--pfx': + pfx = a + elif o == '--pwd': + pwd = a + elif o == '--dist': + dist = True + self.ic.sign(pfx, pwd, dist)