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

Skip to content

Commit d3bbc52

Browse files
authored
Enable signing Windows builds with SHA1 environment variable (GH-11279)
1 parent f0af4c5 commit d3bbc52

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
@@ -187,10 +187,11 @@ public override bool Execute() {
187187
<SdkBinPath Condition="!Exists($(SdkBinPath))">$(registry:HKEY_LOCAL_MACHINE\Software\Microsoft\Windows Kits\Installed Roots@KitsRoot)\bin\x86</SdkBinPath>
188188
<SdkBinPath Condition="!Exists($(SdkBinPath))">$(registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.1A@InstallationFolder)\Bin\</SdkBinPath>
189189
<_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>
190+
<_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>
190191
<_MakeCatCommand Condition="Exists($(SdkBinPath))">"$(SdkBinPath)\makecat.exe"</_MakeCatCommand>
191192
</PropertyGroup>
192-
193-
<Target Name="_SignBuild" AfterTargets="AfterBuild" Condition="'$(SigningCertificate)' != '' and $(SupportSigning)">
193+
194+
<Target Name="_SignBuild" AfterTargets="AfterBuild" Condition="'$(_SignCommand)' != '' and $(SupportSigning)">
194195
<Error Text="Unable to locate signtool.exe. Set /p:SignToolPath and rebuild" Condition="'$(_SignCommand)' == ''" />
195196
<Exec Command='$(_SignCommand) "$(TargetPath)" || $(_SignCommand) "$(TargetPath)" || $(_SignCommand) "$(TargetPath)"' ContinueOnError="false" />
196197
</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