From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Fri, 21 Dec 2018 22:04:18 +0000 (-0800) Subject: Enable signing Windows builds with SHA1 environment variable (GH-11279) X-Git-Tag: v3.7.3rc1~219 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=dd3b04ea8ce29d6bce4daca1fc38aaba73d94ab7;p=thirdparty%2FPython%2Fcpython.git Enable signing Windows builds with SHA1 environment variable (GH-11279) (cherry picked from commit d3bbc5241363d5fa4e749fe509c97c12501ae966) Co-authored-by: Steve Dower --- diff --git a/PCbuild/pyproject.props b/PCbuild/pyproject.props index 6d36977456e0..2019ca859c27 100644 --- a/PCbuild/pyproject.props +++ b/PCbuild/pyproject.props @@ -185,10 +185,11 @@ public override bool Execute() { $(registry:HKEY_LOCAL_MACHINE\Software\Microsoft\Windows Kits\Installed Roots@KitsRoot)\bin\x86 $(registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.1A@InstallationFolder)\Bin\ <_SignCommand Condition="Exists($(SdkBinPath)) and '$(SigningCertificate)' != '' and $(SupportSigning)">"$(SdkBinPath)\signtool.exe" sign /q /a /n "$(SigningCertificate)" /fd sha256 /t http://timestamp.verisign.com/scripts/timestamp.dll /d "Python $(PythonVersion)" + <_SignCommand Condition="Exists($(SdkBinPath)) and '$(SigningCertificateSha1)' != '' and $(SupportSigning)">"$(SdkBinPath)\signtool.exe" sign /q /a /sha1 "$(SigningCertificateSha1)" /fd sha256 /t http://timestamp.verisign.com/scripts/timestamp.dll /d "Python $(PythonVersion)" <_MakeCatCommand Condition="Exists($(SdkBinPath))">"$(SdkBinPath)\makecat.exe" - - + + diff --git a/Tools/msi/sdktools.psm1 b/Tools/msi/sdktools.psm1 index 81a74d3679d7..61edb3411760 100644 --- a/Tools/msi/sdktools.psm1 +++ b/Tools/msi/sdktools.psm1 @@ -21,6 +21,9 @@ function Sign-File { $description = "Python"; } } + if (-not $certsha1) { + $certsha1 = $env:SigningCertificateSha1; + } if (-not $certname) { $certname = $env:SigningCertificate; } @@ -32,7 +35,7 @@ function Sign-File { if ($certsha1) { SignTool sign /sha1 $certsha1 /fd sha256 /t http://timestamp.verisign.com/scripts/timestamp.dll /d $description $a } elseif ($certname) { - SignTool sign /n $certname /fd sha256 /t http://timestamp.verisign.com/scripts/timestamp.dll /d $description $a + SignTool sign /a /n $certname /fd sha256 /t http://timestamp.verisign.com/scripts/timestamp.dll /d $description $a } elseif ($certfile) { SignTool sign /f $certfile /fd sha256 /t http://timestamp.verisign.com/scripts/timestamp.dll /d $description $a } else {