Skip to content

Commit 8e21340

Browse files
authored
Merge branch 'master' into fix/addOption
2 parents fc69537 + bd2a2e3 commit 8e21340

13 files changed

Lines changed: 217 additions & 98 deletions

.appveyor.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ install:
1919
# direct choco install supposed to work, but not? still doing in install.bat
2020
#- cinst: dmd ldc swig vswhere ixsltproc winflexbison3
2121
- ps: .\.appveyor\install.ps1
22-
- ps: if ($env:COVERAGE -eq 1) { .\.appveyor\install-cov.ps1 }
22+
- ps: .\.appveyor\install-cov.ps1
2323

2424
# Build matrix will be number of images multiplied by #entries in matrix:,
2525
# less any excludes.
@@ -53,15 +53,15 @@ build_script:
5353

5454
# setup coverage by creating the coverage config file, and adding coverage
5555
# to the sitecustomize so that all python processes start with coverage
56-
- ps: if ($env:COVERAGE -eq 1) { .\.appveyor\coverage_setup.ps1 }
56+
- ps: .\.appveyor\coverage_setup.ps1
5757

5858
# NOTE: running powershell from cmd is intended because
5959
# it formats the output correctly
60-
- cmd: powershell -Command "& { if($env:COVERAGE -eq 1) { coverage run -p --rcfile=$($env:COVERAGE_PROCESS_START) runtest.py -j 2 -t --exclude-list exclude_list.txt -a } else { C:\\%WINPYTHON%\\python.exe runtest.py -j 2 -t --exclude-list exclude_list.txt -a }; if($LastExitCode -eq 2 -Or $LastExitCode -eq 0) { $host.SetShouldExit(0 )} else {$host.SetShouldExit(1)}}"
60+
- cmd: powershell -File .appveyor\run_tests.ps1
6161

6262
# run coverage even if there was a test failure
6363
on_finish:
64-
- ps: if ($env:COVERAGE -eq 1) { .\.appveyor\coverage_report.ps1 }
64+
- ps: .\.appveyor\coverage_report.ps1
6565
# running codecov in powershell causes an error so running in cmd
66-
- cmd: if %COVERAGE% equ 1 codecov -X gcov --file coverage_xml.xml
66+
- cmd: .appveyor\codecov_upload.bat
6767

.appveyor/codecov_upload.bat

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
@echo off
2+
if "%COVERAGE%"=="1" (
3+
"%SCONS_PYTHON_BIN%" -m codecov -X gcov --file coverage_xml.xml
4+
)

.appveyor/coverage_report.ps1

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
Write-Host "Entering .appveyor/coverage_report.ps1"
12
if ($env:COVERAGE -eq 1) {
2-
& coverage combine;
3-
& coverage report;
4-
& coverage xml -i -o coverage_xml.xml;
3+
& $env:SCONS_PYTHON_BIN -m coverage combine;
4+
& $env:SCONS_PYTHON_BIN -m coverage report;
5+
& $env:SCONS_PYTHON_BIN -m coverage xml -i -o coverage_xml.xml;
56
}
7+
Write-Host "Exiting .appveyor/coverage_report.ps1"

.appveyor/coverage_setup.ps1

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1+
Write-Host "Entering .appveyor/coverage_setup.ps1"
12
if ($env:COVERAGE -eq 1) {
23
$env:COVERAGE_PROCESS_START = "$($env:APPVEYOR_BUILD_FOLDER)\.coveragerc";
34
$env:COVERAGE_FILE = "$($env:APPVEYOR_BUILD_FOLDER)\.coverage";
5+
Set-AppveyorBuildVariable -Name "COVERAGE_PROCESS_START" -Value "$env:COVERAGE_PROCESS_START"
6+
Set-AppveyorBuildVariable -Name "COVERAGE_FILE" -Value "$env:COVERAGE_FILE"
47
New-Item -ItemType Directory -Force -Path "$($env:PYSITEDIR)";
58

69
(Get-Content -path .coverage_templates\.coveragerc.template -Raw) -replace '\$PWD',"$((Get-Location) -replace '\\', '/')" | Set-Content -Path "$($env:COVERAGE_PROCESS_START)";
@@ -11,3 +14,4 @@ if ($env:COVERAGE -eq 1) {
1114
Write-Host "$($env:COVERAGE_PROCESS_START)";
1215
Get-Content -Path "$($env:COVERAGE_PROCESS_START)";
1316
}
17+
Write-Host "Exiting .appveyor/coverage_setup.ps1"

.appveyor/exclude_tests.ps1

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
Write-Host "Entering .appveyor/exclude_tests.ps1"
12
New-Item -Name exclude_list.txt -ItemType File;
23

34
# exclude VS 10.0 because it hangs the testing until this is resolved:
@@ -6,3 +7,4 @@ $workaround_image = "Visual Studio 2015";
67
if ($env:APPVEYOR_BUILD_WORKER_IMAGE -eq $workaround_image) {
78
Add-Content -Path 'exclude_list.txt' -Value 'test\MSVS\vs-10.0-exec.py';
89
}
10+
Write-Host "Exiting .appveyor/exclude_tests.ps1"

.appveyor/ignore_git_bins.ps1

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
Write-Host "Entering .appveyor/ignore_git_bins.ps1"
12
dir "C:\Program Files\Git\usr\bin\x*.exe";
23
if (Test-Path "C:\Program Files\Git\usr\bin\xsltproc.EXE" ) {
34
Remove-Item "C:\Program Files\Git\usr\bin\xsltproc.EXE" -ErrorAction Ignore;
45
}
56
dir "C:\Program Files\Git\usr\bin\x*.exe";
7+
Write-Host "Exiting .appveyor/ignore_git_bins.ps1"

.appveyor/install-cov.ps1

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1-
$pythonExe = "C:\$($env:WINPYTHON)\python.exe"
2-
$env:PYSITEDIR = & $pythonExe -c "import sys; print(sys.path[-1])"
3-
& $pythonExe -m pip install -U --progress-bar off coverage codecov
1+
Write-Host "Entering .appveyor/install-cov.ps1"
2+
if ($env:COVERAGE -eq 1) {
3+
$pythonExe = $env:SCONS_PYTHON_BIN
4+
$env:PYSITEDIR = & $pythonExe -c "import sys; print(sys.path[-1])"
5+
& $pythonExe -m pip install -U --progress-bar off coverage codecov
6+
}
7+
Write-Host "Exiting .appveyor/install-cov.ps1"

.appveyor/install.ps1

Lines changed: 71 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
Write-Host "Entering .appveyor/install.ps1"
2+
Write-Host "Build using $env:WINPYTHON"
13
$pythonExe = "C:\$($env:WINPYTHON)\python.exe"
24

35
# If the initial call to python --version fails, call "choco install %WINPYTHON%"
@@ -15,25 +17,83 @@ try {
1517

1618
if (-not $pyVersionSucceeded) {
1719
Write-Host "Python version check failed or Python not found at $pythonExe. Installing $env:WINPYTHON via Chocolatey..."
18-
choco install --allow-empty-checksums $env:WINPYTHON
20+
choco install --force --allow-empty-checksums $env:WINPYTHON
21+
dir C:\ProgramData\chocolatey\bin\python*.exe
22+
dir c:\python*
1923
}
2024

21-
# Set PYSITEDIR
22-
$env:PYSITEDIR = & $pythonExe -c "import sys; print(sys.path[-1])"
23-
24-
# Use mingw 32 bit until #3291 is resolved
2525
# Add python and python user-base to path for pip installs
26-
$extraPaths = @(
27-
"C:\$($env:WINPYTHON)",
28-
"C:\$($env:WINPYTHON)\Scripts",
29-
"C:\ProgramData\chocolatey\bin",
26+
$pythonPaths = @()
27+
if (Test-Path "C:\$($env:WINPYTHON)") {
28+
$pythonPaths += "C:\$($env:WINPYTHON)"
29+
}
30+
31+
# Always add chocolatey bin
32+
# Prioritize it if we just installed python there AND C:\PythonXX wasn't found
33+
if (-not $pyVersionSucceeded -and -not (Test-Path "C:\$($env:WINPYTHON)")) {
34+
$pythonPaths = @("C:\ProgramData\chocolatey\bin") + $pythonPaths
35+
} else {
36+
$pythonPaths += "C:\ProgramData\chocolatey\bin"
37+
}
38+
39+
# Add tools AFTER python paths to avoid picking up MSYS/Cygwin python shims
40+
$toolPaths = @(
3041
"C:\MinGW\bin",
3142
"C:\MinGW\msys\1.0\bin",
3243
"C:\cygwin\bin",
3344
"C:\msys64\usr\bin",
3445
"C:\msys64\mingw64\bin"
3546
)
36-
$env:PATH = ($extraPaths + @($env:PATH)) -join ';'
47+
48+
$env:PATH = ($pythonPaths + $toolPaths + @($env:PATH)) -join ';'
49+
# Ensure we have the correct path to the python executable,
50+
# explicitly avoiding MSYS/Cygwin versions.
51+
$pythonExe = $null
52+
53+
# Derive a version-specific shim name (e.g. Python310 -> python3.10.exe)
54+
$pyVersion = $env:WINPYTHON -replace "Python", "" # e.g. "310"
55+
if ($pyVersion -match "^(\d)(\d+)$") {
56+
$specName = "python$($Matches[1]).$($Matches[2]).exe" # e.g. "python3.10.exe"
57+
} else {
58+
$specName = "python.exe"
59+
}
60+
61+
$checkNames = @("$env:WINPYTHON.exe", $specName, "python.exe", "python3.exe")
62+
63+
foreach ($name in $checkNames) {
64+
Write-Host "Checking for Python shim: $name"
65+
$cmds = Get-Command $name -ErrorAction SilentlyContinue | Where-Object { $_.Path -notlike "*\msys64\*" -and $_.Path -notlike "*\cygwin\*" }
66+
if ($cmds) {
67+
$pythonExe = ($cmds | Select-Object -First 1).Path
68+
69+
$pyDir = Split-Path -Parent $pythonExe
70+
$pyScripts = Join-Path $pyDir "Scripts"
71+
if (Test-Path $pyScripts) {
72+
Write-Host "Adding $pyScripts to PATH"
73+
$env:PATH = "$pyScripts;$env:PATH"
74+
}
75+
76+
& $pythonExe --version
77+
break
78+
} else {
79+
Write-Host "Didn't find $name"
80+
}
81+
}
82+
if (-not $pythonExe -or -not (Test-Path $pythonExe)) {
83+
Write-Error "Could not find a valid Python executable (WINPYTHON=$env:WINPYTHON). Aborting."
84+
exit 1
85+
}
86+
87+
Write-Host "Using Python at: $pythonExe"
88+
89+
Write-Host "PATH: $env:PATH"
90+
91+
# Set SCONS_PYTHON_BIN for future steps
92+
Set-AppveyorBuildVariable -Name "SCONS_PYTHON_BIN" -Value "$pythonExe"
93+
94+
# Set PYSITEDIR
95+
$env:PYSITEDIR = & $pythonExe -c "import sys; print(sys.path[-1])"
96+
Set-AppveyorBuildVariable -Name "PYSITEDIR" -Value "$env:PYSITEDIR"
3797

3898
# pip installs
3999
& $pythonExe -m pip install -U --progress-bar off pip setuptools wheel
@@ -46,3 +106,4 @@ choco install --allow-empty-checksums dmd ldc swig vswhere xsltproc winflexbison
46106

47107
# Show environment variables
48108
Get-ChildItem Env: | Sort-Object Name
109+
Write-Host "Exiting .appveyor/install.ps1"

.appveyor/run_tests.ps1

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Write-Host "Entering .appveyor/run_tests.ps1"
2+
Write-Host "COVERAGE: $env:COVERAGE"
3+
Write-Host "SCONS_PYTHON_BIN: $env:SCONS_PYTHON_BIN"
4+
5+
if ($env:COVERAGE -eq 1) {
6+
& "$env:SCONS_PYTHON_BIN" -m coverage run -p --rcfile "$env:COVERAGE_PROCESS_START" runtest.py -j 2 -t --exclude-list exclude_list.txt -a
7+
} else {
8+
& "$env:SCONS_PYTHON_BIN" runtest.py -j 2 -t --exclude-list exclude_list.txt -a
9+
}
10+
11+
# Treat exit code 2 (some tests failed) as success for AppVeyor
12+
# as per original configuration.
13+
if ($LastExitCode -eq 2 -or $LastExitCode -eq 0) {
14+
Write-Host "Exiting .appveyor/run_tests.ps1"
15+
exit 0
16+
} else {
17+
Write-Host "Exiting .appveyor/run_tests.ps1"
18+
exit $LastExitCode
19+
}

CHANGES.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER
3838
- Used Gemini to refactor runtest.py to better organized the code and add docstrings.
3939
- Added script for release process to find all contributors in a release and highlight
4040
new contributors. (Using Gemini AI)
41+
- Fix Appveyor scripting to install unavailable python versions when needed and use them
42+
for testing.
4143

4244
From Dillan Mills:
4345
- Fix handling of AddOption for option-arguments with spaces
@@ -80,6 +82,11 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER
8082
the general unavailablility of the obsolete build-time Qt3 package.
8183
- A few more typing cleanups in Environment (and in one case which
8284
affected it in the Node package).
85+
- Adjust race protection for CacheDir - now uses a unique temporary
86+
directory for each writer before doing the move, instead of depending
87+
on a one-time uuid to make a path to the file.
88+
- Clarify VariantDir behavior when switching to not duplicate sources
89+
and tweak wording a bit.
8390

8491

8592
RELEASE 4.10.1 - Sun, 16 Nov 2025 10:51:57 -0700

0 commit comments

Comments
 (0)