8000 Enable signing Windows builds with SHA1 environment variable (GH-11279) · python/cpython@dd3b04e · GitHub
[go: up one dir, main page]

Skip to content

Commit dd3b04e

Browse files
Enable signing Windows builds with SHA1 environment variable (GH-11279)
(cherry picked from commit d3bbc52) Co-authored-by: Steve Dower <steve.dower@microsoft.com>
1 parent aa7922a commit dd3b04e

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

PCbuild/pyproject.props

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,10 +185,11 @@ public override bool Execute() {
185185
<SdkBinPath Condition="!Exists($(SdkBinPath))">$(registry:HKEY_LOCAL_MACHINE\Software\Microsoft\Windows Kits\Installed Roots@KitsRoot)\bin\x86</SdkBinPath>
186186
<SdkBinPath Condition="!Exists($(SdkBinPath))">$(registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.1A@InstallationFolder)\Bin\</SdkBinPath>
187187
<_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>
188+
<_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)"</_SignCommand>
188189
<_MakeCatCommand Condition="Exists($(SdkBinPath))">"$(SdkBinPath)\makecat.exe"</_MakeCatCommand>
189190
</PropertyGroup>
190-
191-
<Target Name="_SignBuild" AfterTargets="AfterBuild" Condition="'$(SigningCertificate)' != '' and $(SupportSigning)">
191+
192+
<Target Name="_SignBuild" AfterTargets="AfterBuild" Condition="'$(_SignCommand)' != '' and $(SupportSigning)">
192193
<Error Text="Unable to locate signtool.exe. Set /p:SignToolPath and rebuild" Condition="'$(_SignCommand)' == ''" />
193194
<Exec Command='$(_SignCommand) "$(TargetPath)" || $(_SignCommand) "$(TargetPath)" || $(_SignCommand) "$(TargetPath)"' ContinueOnError="false" />
194195
</Target>

Tools/msi/sdktools.psm1

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ function Sign-File {
2121
$description = "Python";
2222
}
2323
}
24+
if (-not $certsha1) {
25+
$certsha1 = $env:SigningCertificateSha1;
26+
}
2427
if (-not $certname) {
2528
$certname = $env:SigningCertificate;
2629
}
@@ -32,7 +35,7 @@ function Sign-File {
3235
if ($certsha1) {
3336
SignTool sign /sha1 $certsha1 /fd sha256 /t http://timestamp.verisign.com/scripts/timestamp.dll /d $description $a
3437
} elseif ($certname) {
35-
SignTool sign /n $certname /fd sha256 /t http://timestamp.verisign.com/scripts/timestamp.dll /d $description $a
38+
SignTool sign /a /n $certname /fd sha256 /t http://timestamp.verisign.com/scripts/timestamp.dll /d $description $a
3639
} elseif ($certfile) {
3740
SignTool sign /f $certfile /fd sha256 /t http://timestamp.verisign.com/scripts/timestamp.dll /d $description $a
3841
} else {

0 commit comments

Comments
 (0)
0