From 5871cde0850f3094ff134315ae92b7072e55d16c Mon Sep 17 00:00:00 2001 From: Steve Dower Date: Tue, 27 Feb 2024 16:42:02 +0000 Subject: [PATCH 01/11] Run installer tests in their own container --- windows-release/stage-test-msi.yml | 99 +++++------------------------- windows-release/test-msi.ps1 | 91 +++++++++++++++++++++++++++ 2 files changed, 105 insertions(+), 85 deletions(-) create mode 100644 windows-release/test-msi.ps1 diff --git a/windows-release/stage-test-msi.yml b/windows-release/stage-test-msi.yml index 26215bb5..f621220d 100644 --- a/windows-release/stage-test-msi.yml +++ b/windows-release/stage-test-msi.yml @@ -37,7 +37,7 @@ jobs: InstallAllUsers: 1 steps: - - checkout: none + - checkout: self - task: DownloadPipelineArtifact@1 displayName: 'Download artifact: msi' @@ -52,90 +52,19 @@ jobs: displayName: 'Find installer executable' workingDirectory: $(Build.BinariesDirectory)\msi - - script: > - "$(SetupExe)" - /passive - /log "$(Logs)\install\log.txt" - TargetDir="$(Build.BinariesDirectory)\Python" - Include_debug=1 - Include_symbols=1 - InstallAllUsers=$(InstallAllUsers) - $(IncludeFreethreadedOpt) - displayName: 'Install Python' - - - powershell: | - gci "$(Build.BinariesDirectory)\python" - displayName: 'List installed files' - - - powershell: | - $p = gi "$(Build.BinariesDirectory)\Python\python.exe" - Write-Host "##vso[task.prependpath]$(Split-Path -Parent $p)" - displayName: 'Add test Python to PATH' - - - script: | - python -c "import sys; print(sys.version)" - displayName: 'Collect version number' - condition: and(succeeded(), not(variables['SkipTests'])) - - - script: | - python -m site - displayName: 'Collect site' - condition: and(succeeded(), not(variables['SkipTests'])) - - - ${{ if eq(parameters.DoFreethreaded, 'true') }}: - - powershell: | - $p = (gci "$(Build.BinariesDirectory)\Python\python3*t.exe" | select -First 1) - Write-Host "Found $p" - if (-not $p) { - Write-Host "Did not find python3*t.exe in:" - dir "$(Build.BinariesDirectory)\Python" - throw "Free-threaded binaries were not installed" - } else { - & $p -c "import sys; print(sys.version)" - } - displayName: 'Collect free-threaded version number' - condition: and(succeeded(), not(variables['SkipTests'])) - - - powershell: | - gci -r "${env:PROGRAMDATA}\Microsoft\Windows\Start Menu\Programs\Python*" - displayName: 'Capture per-machine Start Menu items' - - powershell: | - gci -r "${env:APPDATA}\Microsoft\Windows\Start Menu\Programs\Python*" - displayName: 'Capture per-user Start Menu items' - - - powershell: | - gci -r "HKLM:\Software\WOW6432Node\Python" - displayName: 'Capture per-machine 32-bit registry' - - powershell: | - gci -r "HKLM:\Software\Python" - displayName: 'Capture per-machine native registry' - - powershell: | - gci -r "HKCU:\Software\Python" - displayName: 'Capture current-user registry' - - - script: | - python -m pip install "azure<0.10" - python -m pip uninstall -y azure python-dateutil six - displayName: 'Test (un)install package' - condition: and(succeeded(), not(variables['SkipTests'])) - - - powershell: | - if (Test-Path -Type Container "$(Build.BinariesDirectory)\Python\Lib\test\test_ttk") { - # New set of tests (3.12 and later) - python -m test -uall -v test_ttk test_tkinter test_idle - } else { - # Old set of tests - python -m test -uall -v test_ttk_guionly test_tk test_idle - } - displayName: 'Test Tkinter and Idle' - condition: and(succeeded(), not(variables['SkipTests']), not(variables['SkipTkTests'])) - - - script: > - "$(SetupExe)" - /passive - /uninstall - /log "$(Logs)\uninstall\log.txt" - displayName: 'Uninstall Python' + - powershell: > + docker run --rm + -v "$(Build.BinariesDirectory)\msi:C:\msi" + -v "$(Build.SourcesDirectory)\windows-release:C:\scripts" + -v "$(Build.BinariesDirectory)\tmp:C:\Python" + -v ('{}:C:\logs' -f (mkdir "$(Build.ArtifactStagingDirectory)\logs")) + -e InstallAllUsers + -e IncludeFreethreadedOpt + -e SkipTests + -e SkipTkTests + mcr.microsoft.com/windows/servercore:ltsc2022 + powershell C:\scripts\test-msi.ps1 "C:\msi\$(SetupExeName)" + displayName: 'Run installer tests' - task: PublishBuildArtifacts@1 displayName: 'Publish Artifact: logs' diff --git a/windows-release/test-msi.ps1 b/windows-release/test-msi.ps1 new file mode 100644 index 00000000..8a71c0ae --- /dev/null +++ b/windows-release/test-msi.ps1 @@ -0,0 +1,91 @@ +param ([string]$SetupExe) + +Write-Host "##[section]Install Python" +$SetupCmd = "$SetupExe /passive /log ""C:\Logs\install\log.txt"" "` + "TargetDir=C:\Python " ` + "Include_debug=1 " ` + "Include_symbols=1 " ` + "InstallAllUsers=${env:InstallAllUsers} " ` + "${env:IncludeFreethreadedOpt}" +Write-Host "##[command]$SetupCmd" +& $SetupCmd +if (!$?) { exit $LASTEXITCODE } + +Write-Host "##[command]dir C:\Python" +dir C:\Python + +$env:PATH = "C:\Python:${env:PATH}" + + +Write-Host "##[section]Capture Start Menu items" +Write-Host "##[command]dir -r ""${env:PROGRAMDATA}\Microsoft\Windows\Start Menu\Programs\Python*""" +dir -r "${env:PROGRAMDATA}\Microsoft\Windows\Start Menu\Programs\Python*" + +Write-Host "##[command]dir -r ""${env:APPDATA}\Microsoft\Windows\Start Menu\Programs\Python*""" +dir -r "${env:APPDATA}\Microsoft\Windows\Start Menu\Programs\Python*" + +Write-Host "##[section]Capture registry" +Write-Host 'Capture per-machine 32-bit registry' +Write-Host "##[command]dir -r ""HKLM:\Software\WOW6432Node\Python""" +dir -r "HKLM:\Software\WOW6432Node\Python" + +Write-Host 'Capture per-machine native registry' +Write-Host "##[command]dir -r ""HKLM:\Software\Python""" +dir -r "HKLM:\Software\Python" + +Write-Host 'Capture current-user registry' +Write-Host "##[command]dir -r ""HKCU:\Software\Python""" +dir -r "HKCU:\Software\Python" + + +if (-not $env:SkipTests) { + Write-Host "##[section]Smoke tests" + Write-Host "##[command]python -c ""import sys; print(sys.version)""" + python -c "import sys; print(sys.version)" + if (!$?) { exit $LASTEXITCODE } + Write-Host "##[command]python -m site" + python -m site + if (!$?) { exit $LASTEXITCODE } + + if ($env:IncludeFreethreadedOpt) { + $p = (gci "C:\Python\python3*t.exe" | select -First 1) + if (-not $p) { + Write-Host "Did not find python3*t.exe in:" + dir "C:\Python" + throw "Free-threaded binaries were not installed" + } + Write-Host "Found free threaded executable $p" + Write-Host "##[command]$p -c ""import sys; print(sys.version)""" + & $p -c "import sys; print(sys.version)" + if (!$?) { exit $LASTEXITCODE } + } + + Write-Host "##[section]Test (un)install package" + Write-Host "##[command]python -m pip install ""azure<0.10""" + python -m pip install "azure<0.10" + if (!$?) { exit $LASTEXITCODE } + Write-Host "##[command]python -m pip uninstall -y azure python-dateutil six" + python -m pip uninstall -y azure python-dateutil six + if (!$?) { exit $LASTEXITCODE } + + if (-not $env:SkipTkTests) { + Write-Host "##[section]Test Tkinter and Idle" + if (Test-Path -Type Container "C:\Python\Lib\test\test_ttk") { + # New set of tests (3.12 and later) + Write-Host "##[command]python -m test -uall -v test_ttk test_tkinter test_idle" + python -m test -uall -v test_ttk test_tkinter test_idle + if (!$?) { exit $LASTEXITCODE } + } else { + # Old set of tests + Write-Host "##[command]python -m test -uall -v test_ttk_guionly test_tk test_idle" + python -m test -uall -v test_ttk_guionly test_tk test_idle + if (!$?) { exit $LASTEXITCODE } + } + } +} + +Write-Host "##[section]Uninstall Python" +$UninstallCmd = "$(SetupExe) /passive /uninstall /log C:\Logs\uninstall\log.txt" +Write-Host "##[command]$UninstallCmd" +& $UninstallCmd +if (!$?) { exit $LASTEXITCODE } From a9dae6c5fd021c9d9bcb84e9ae573cdfeb007e86 Mon Sep 17 00:00:00 2001 From: Steve Dower Date: Tue, 27 Feb 2024 17:05:58 +0000 Subject: [PATCH 02/11] This is PowerShell, not Python --- windows-release/stage-test-msi.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/windows-release/stage-test-msi.yml b/windows-release/stage-test-msi.yml index f621220d..b00e1c16 100644 --- a/windows-release/stage-test-msi.yml +++ b/windows-release/stage-test-msi.yml @@ -57,7 +57,7 @@ jobs: -v "$(Build.BinariesDirectory)\msi:C:\msi" -v "$(Build.SourcesDirectory)\windows-release:C:\scripts" -v "$(Build.BinariesDirectory)\tmp:C:\Python" - -v ('{}:C:\logs' -f (mkdir "$(Build.ArtifactStagingDirectory)\logs")) + -v ('{0}:C:\logs' -f (mkdir "$(Build.ArtifactStagingDirectory)\logs")) -e InstallAllUsers -e IncludeFreethreadedOpt -e SkipTests From 1c7bcc1c00ee6bb482ff1ffe76e6365c75921374 Mon Sep 17 00:00:00 2001 From: Steve Dower Date: Tue, 27 Feb 2024 17:35:21 +0000 Subject: [PATCH 03/11] Ensure tmp directory exists --- windows-release/stage-test-msi.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/windows-release/stage-test-msi.yml b/windows-release/stage-test-msi.yml index b00e1c16..9dc0b942 100644 --- a/windows-release/stage-test-msi.yml +++ b/windows-release/stage-test-msi.yml @@ -56,7 +56,7 @@ jobs: docker run --rm -v "$(Build.BinariesDirectory)\msi:C:\msi" -v "$(Build.SourcesDirectory)\windows-release:C:\scripts" - -v "$(Build.BinariesDirectory)\tmp:C:\Python" + -v ('{0}:C:\Python' -f (mkdir "$(Build.BinariesDirectory)\tmp")) -v ('{0}:C:\logs' -f (mkdir "$(Build.ArtifactStagingDirectory)\logs")) -e InstallAllUsers -e IncludeFreethreadedOpt From fb7d8957cf492a4fe976892c29a9bf246c7696ca Mon Sep 17 00:00:00 2001 From: Steve Dower Date: Tue, 27 Feb 2024 18:57:54 +0000 Subject: [PATCH 04/11] Needs plusses --- windows-release/test-msi.ps1 | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/windows-release/test-msi.ps1 b/windows-release/test-msi.ps1 index 8a71c0ae..cafaa9d9 100644 --- a/windows-release/test-msi.ps1 +++ b/windows-release/test-msi.ps1 @@ -1,11 +1,11 @@ param ([string]$SetupExe) Write-Host "##[section]Install Python" -$SetupCmd = "$SetupExe /passive /log ""C:\Logs\install\log.txt"" "` - "TargetDir=C:\Python " ` - "Include_debug=1 " ` - "Include_symbols=1 " ` - "InstallAllUsers=${env:InstallAllUsers} " ` +$SetupCmd = "$SetupExe /passive /log ""C:\Logs\install\log.txt"" " + ` + "TargetDir=C:\Python " + ` + "Include_debug=1 " + ` + "Include_symbols=1 " + ` + "InstallAllUsers=${env:InstallAllUsers} " + ` "${env:IncludeFreethreadedOpt}" Write-Host "##[command]$SetupCmd" & $SetupCmd From 69b0c53d7f3ed7b84df7759be00c04a539f4f80b Mon Sep 17 00:00:00 2001 From: Steve Dower Date: Tue, 27 Feb 2024 19:38:52 +0000 Subject: [PATCH 05/11] iex instead of & --- windows-release/test-msi.ps1 | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/windows-release/test-msi.ps1 b/windows-release/test-msi.ps1 index cafaa9d9..bdd16e22 100644 --- a/windows-release/test-msi.ps1 +++ b/windows-release/test-msi.ps1 @@ -1,14 +1,15 @@ param ([string]$SetupExe) Write-Host "##[section]Install Python" -$SetupCmd = "$SetupExe /passive /log ""C:\Logs\install\log.txt"" " + ` +$SetupArgs = "$SetupExe " + ` + "/passive /log ""C:\Logs\install\log.txt"" " + ` "TargetDir=C:\Python " + ` "Include_debug=1 " + ` "Include_symbols=1 " + ` "InstallAllUsers=${env:InstallAllUsers} " + ` "${env:IncludeFreethreadedOpt}" Write-Host "##[command]$SetupCmd" -& $SetupCmd +iex $SetupCmd if (!$?) { exit $LASTEXITCODE } Write-Host "##[command]dir C:\Python" @@ -87,5 +88,5 @@ if (-not $env:SkipTests) { Write-Host "##[section]Uninstall Python" $UninstallCmd = "$(SetupExe) /passive /uninstall /log C:\Logs\uninstall\log.txt" Write-Host "##[command]$UninstallCmd" -& $UninstallCmd +iex $UninstallCmd if (!$?) { exit $LASTEXITCODE } From 698c94103c6131d6e83c767dc9a37929b770857c Mon Sep 17 00:00:00 2001 From: Steve Dower Date: Tue, 27 Feb 2024 19:41:40 +0000 Subject: [PATCH 06/11] Check exit code after iex --- windows-release/test-msi.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/windows-release/test-msi.ps1 b/windows-release/test-msi.ps1 index bdd16e22..5c398d46 100644 --- a/windows-release/test-msi.ps1 +++ b/windows-release/test-msi.ps1 @@ -10,7 +10,7 @@ $SetupArgs = "$SetupExe " + ` "${env:IncludeFreethreadedOpt}" Write-Host "##[command]$SetupCmd" iex $SetupCmd -if (!$?) { exit $LASTEXITCODE } +if ($LASTEXITCODE) { exit $LASTEXITCODE } Write-Host "##[command]dir C:\Python" dir C:\Python @@ -89,4 +89,4 @@ Write-Host "##[section]Uninstall Python" $UninstallCmd = "$(SetupExe) /passive /uninstall /log C:\Logs\uninstall\log.txt" Write-Host "##[command]$UninstallCmd" iex $UninstallCmd -if (!$?) { exit $LASTEXITCODE } +if ($LASTEXITCODE) { exit $LASTEXITCODE } From 7c7380cbbd783024b81fd7770a6055f5a364dfb6 Mon Sep 17 00:00:00 2001 From: Steve Dower Date: Tue, 27 Feb 2024 20:35:24 +0000 Subject: [PATCH 07/11] Correct name helps --- windows-release/test-msi.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/windows-release/test-msi.ps1 b/windows-release/test-msi.ps1 index 5c398d46..8e7551f9 100644 --- a/windows-release/test-msi.ps1 +++ b/windows-release/test-msi.ps1 @@ -1,7 +1,7 @@ param ([string]$SetupExe) Write-Host "##[section]Install Python" -$SetupArgs = "$SetupExe " + ` +$SetupCmd = "$SetupExe " + ` "/passive /log ""C:\Logs\install\log.txt"" " + ` "TargetDir=C:\Python " + ` "Include_debug=1 " + ` From 2ce2d54ba92f209f9f0b180e8a12c97ac518c003 Mon Sep 17 00:00:00 2001 From: Steve Dower Date: Tue, 27 Feb 2024 21:40:44 +0000 Subject: [PATCH 08/11] Mount MSI directory properly --- windows-release/stage-test-msi.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/windows-release/stage-test-msi.yml b/windows-release/stage-test-msi.yml index 9dc0b942..6895e840 100644 --- a/windows-release/stage-test-msi.yml +++ b/windows-release/stage-test-msi.yml @@ -54,10 +54,10 @@ jobs: - powershell: > docker run --rm - -v "$(Build.BinariesDirectory)\msi:C:\msi" - -v "$(Build.SourcesDirectory)\windows-release:C:\scripts" - -v ('{0}:C:\Python' -f (mkdir "$(Build.BinariesDirectory)\tmp")) - -v ('{0}:C:\logs' -f (mkdir "$(Build.ArtifactStagingDirectory)\logs")) + -v ('{0}:C:\msi' -f (Split-Path -Parent "$(SetupExe)")) + -v ('{0}:C:\scripts' -f (gi windows-release)) + -v ('{0}:C:\Python' -f (mkdir "$(Build.BinariesDirectory)\tmp" -Force)) + -v ('{0}:C:\logs' -f (mkdir "$(Build.ArtifactStagingDirectory)\logs" -Force)) -e InstallAllUsers -e IncludeFreethreadedOpt -e SkipTests From 8e53eb4011a02fce1cb1361880680da2080c9847 Mon Sep 17 00:00:00 2001 From: Steve Dower Date: Tue, 27 Feb 2024 22:40:44 +0000 Subject: [PATCH 09/11] Work around broken Powershell 5.0+ --- windows-release/test-msi.ps1 | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/windows-release/test-msi.ps1 b/windows-release/test-msi.ps1 index 8e7551f9..2d36799d 100644 --- a/windows-release/test-msi.ps1 +++ b/windows-release/test-msi.ps1 @@ -27,16 +27,24 @@ dir -r "${env:APPDATA}\Microsoft\Windows\Start Menu\Programs\Python*" Write-Host "##[section]Capture registry" Write-Host 'Capture per-machine 32-bit registry' -Write-Host "##[command]dir -r ""HKLM:\Software\WOW6432Node\Python""" -dir -r "HKLM:\Software\WOW6432Node\Python" +# PS 5.0 and later can't do this, because they normalise registry paths incorrectly +# So we'll use the good old "reg" tool +#Write-Host "##[command]dir -r ""HKLM:\Software\WOW6432Node\Python""" +#dir -r "HKLM:\Software\WOW6432Node\Python" +Write-Host "##[command]reg HKLM\Software\Python /s /reg:32" +reg HKLM\Software\Python /s /reg:32 Write-Host 'Capture per-machine native registry' -Write-Host "##[command]dir -r ""HKLM:\Software\Python""" -dir -r "HKLM:\Software\Python" +#Write-Host "##[command]dir -r ""HKLM:\Software\Python""" +#dir -r "HKLM:\Software\Python" +Write-Host "##[command]reg HKLM\Software\Python /s /reg:64" +reg HKLM\Software\Python /s /reg:64 Write-Host 'Capture current-user registry' -Write-Host "##[command]dir -r ""HKCU:\Software\Python""" -dir -r "HKCU:\Software\Python" +#Write-Host "##[command]dir -r ""HKCU:\Software\Python""" +#dir -r "HKCU:\Software\Python" +Write-Host "##[command]reg HKCU\Software\Python /s" +reg HKCU\Software\Python /s if (-not $env:SkipTests) { From 8bea5f923219a5a6571997dae17ff071da9ae6c6 Mon Sep 17 00:00:00 2001 From: Steve Dower Date: Tue, 27 Feb 2024 22:41:47 +0000 Subject: [PATCH 10/11] Use correct logs directory --- windows-release/stage-test-msi.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/windows-release/stage-test-msi.yml b/windows-release/stage-test-msi.yml index 6895e840..1dd5f176 100644 --- a/windows-release/stage-test-msi.yml +++ b/windows-release/stage-test-msi.yml @@ -57,7 +57,7 @@ jobs: -v ('{0}:C:\msi' -f (Split-Path -Parent "$(SetupExe)")) -v ('{0}:C:\scripts' -f (gi windows-release)) -v ('{0}:C:\Python' -f (mkdir "$(Build.BinariesDirectory)\tmp" -Force)) - -v ('{0}:C:\logs' -f (mkdir "$(Build.ArtifactStagingDirectory)\logs" -Force)) + -v ('{0}:C:\logs' -f (mkdir "$(Logs)" -Force)) -e InstallAllUsers -e IncludeFreethreadedOpt -e SkipTests From c7f51253726dfb4ba018b9655938f30c084926cb Mon Sep 17 00:00:00 2001 From: Steve Dower Date: Wed, 28 Feb 2024 17:10:34 +0000 Subject: [PATCH 11/11] Try with server image --- windows-release/stage-test-msi.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/windows-release/stage-test-msi.yml b/windows-release/stage-test-msi.yml index 1dd5f176..e905d817 100644 --- a/windows-release/stage-test-msi.yml +++ b/windows-release/stage-test-msi.yml @@ -62,7 +62,7 @@ jobs: -e IncludeFreethreadedOpt -e SkipTests -e SkipTkTests - mcr.microsoft.com/windows/servercore:ltsc2022 + mcr.microsoft.com/windows/server:ltsc2022 powershell C:\scripts\test-msi.ps1 "C:\msi\$(SetupExeName)" displayName: 'Run installer tests' pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy