-
-
Notifications
You must be signed in to change notification settings - Fork 47
Expand file tree
/
Copy pathtest-msi.ps1
More file actions
100 lines (85 loc) · 3.83 KB
/
test-msi.ps1
File metadata and controls
100 lines (85 loc) · 3.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
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"
iex $SetupCmd
if ($LASTEXITCODE) { 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'
# 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]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]reg HKCU\Software\Python /s"
reg HKCU\Software\Python /s
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"
iex $UninstallCmd
if ($LASTEXITCODE) { exit $LASTEXITCODE }