tools, instructions: Abhängigkeiten festgeschrieben - Lock-Dateien mit Hashes und 7 Tagen Abkühlzeit, Preflight-Stempel über das Lock, pip-audit und frische Auflösung im Nightly; Python 3.13-3.14 als zugelassene Spanne, CI auf beiden Enden (#245); 11.0.0-beta.1
CI / verify (push) Successful in 8m47s
CI / pwsh (push) Successful in 3m13s
CI / python314 (push) Successful in 5m35s
Converters / converters (push) Successful in 9m49s
Release / converters (push) Successful in 26s
Release / release (push) Successful in 39s
Release / wiki-mirror (push) Skipped
CI / verify (push) Successful in 8m47s
CI / pwsh (push) Successful in 3m13s
CI / python314 (push) Successful in 5m35s
Converters / converters (push) Successful in 9m49s
Release / converters (push) Successful in 26s
Release / release (push) Successful in 39s
Release / wiki-mirror (push) Skipped
Files changed: - .gitea/workflows/ci.yml - .gitea/workflows/converters.yml - .gitea/workflows/nightly.yml - .gitea/workflows/release.yml - .gitea/workflows/tracker-live.yml - CHANGES.md - INSTALL.md - VERSION - docs/dev/development.md - docs/how-to/set-up-the-mcp-server.md - instructions/dev/dependency-locks.md - instructions/dev/publish-and-ci.md - instructions/dev/stack-mode.md - instructions/dev/tracker-testing.md - instructions/mcp-read-server.md - instructions/preflight.md - tools/CONTRACT.md - tools/README.md - tools/chemenu/commands/dist_cmd.py - tools/chemenu/commands/doctor.py - tools/chemenu/install_doc.py - tools/chemenu/prerequisites.py - tools/chemenu/tests/test_dependency_locks.py - tools/chemenu/tests/test_dist_cmd.py - tools/chemenu/tests/test_doctor.py - tools/chemenu/tests/test_install_doc.py - tools/chemenu/tests/test_preflight.py - tools/chemenu/tests/test_preflight_pwsh.py - tools/lock_requirements.py - tools/preflight.ps1 - tools/preflight.sh - tools/prerequisites.txt - tools/requirements-browser.lock - tools/requirements-browser.txt - tools/requirements-dev.lock - tools/requirements-dev.txt - tools/requirements-mcp.lock - tools/requirements-mcp.txt - tools/requirements.lock - tools/requirements.txt Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015uxGFdBAmyA23g1isCtGEY
This commit is contained in:
1 parent
0fce67e6b9
commit
37070ffae2
40 files changed
+3472
-159
No files matched your search
+104
-28
@@ -6,10 +6,15 @@
|
||||
# pwsh -NoProfile -ExecutionPolicy Bypass -File tools/preflight.ps1 --set rg=C:\Tools\rg.exe
|
||||
# pwsh -NoProfile -ExecutionPolicy Bypass -File tools/preflight.ps1 --with browser
|
||||
#
|
||||
# --with browser installs tools/requirements-browser.txt into tools/.venv and the
|
||||
# tools/.venv gets exactly the versions tools/requirements.lock names, checked against
|
||||
# the hashes in it (pip --require-hashes); whenever the lock changes, the next run moves
|
||||
# the venv to it, up or down. A venv built on a Python outside the span the manifest
|
||||
# admits is built again on the Python found here.
|
||||
#
|
||||
# --with browser installs tools/requirements-browser.lock into tools/.venv and the
|
||||
# Chromium that Playwright drives into tools/.venv/ms-playwright - only on request,
|
||||
# because it is a large download that only `raw login` and pages a site handler
|
||||
# declares `render` need. Once installed, every later run keeps it up to date.
|
||||
# declares `render` need. Once installed, every later run keeps it at its lock.
|
||||
#
|
||||
# As the release asset `preflight.ps1` - a copy with no tools/prerequisites.txt next
|
||||
# to it - the script is the first install step instead: it downloads the stack
|
||||
@@ -61,9 +66,9 @@ $Root = Split-Path -Parent $Dir
|
||||
$Manifest = Join-Path $Dir 'prerequisites.txt'
|
||||
$ToolsFile = Join-Path $Root '.wikitool-tools.json'
|
||||
$Venv = Join-Path $Dir '.venv'
|
||||
$Requirements = Join-Path $Dir 'requirements.txt'
|
||||
$Requirements = Join-Path $Dir 'requirements.lock'
|
||||
$Stamp = Join-Path $Venv '.chemenu-requirements.sha256'
|
||||
$BrowserRequirements = Join-Path $Dir 'requirements-browser.txt'
|
||||
$BrowserRequirements = Join-Path $Dir 'requirements-browser.lock'
|
||||
$BrowserStamp = Join-Path $Venv '.chemenu-browser.sha256'
|
||||
$Browsers = Join-Path $Venv 'ms-playwright'
|
||||
$Self = 'pwsh -NoProfile -ExecutionPolicy Bypass -File tools/preflight.ps1'
|
||||
@@ -564,7 +569,7 @@ foreach ($line in $ManifestLines) {
|
||||
Write-ErrorLine "preflight: bad tool name '$($parts[1])' in $Manifest"
|
||||
exit 1
|
||||
}
|
||||
if ($parts[3] -eq 'all' -or $parts[3] -eq $Platform) {
|
||||
if ($parts[4] -eq 'all' -or $parts[4] -eq $Platform) {
|
||||
$Tools += $parts[1]
|
||||
}
|
||||
}
|
||||
@@ -585,11 +590,11 @@ foreach ($line in $ManifestLines) {
|
||||
|
||||
function Get-InstallHint {
|
||||
param([string]$Tool)
|
||||
$choco = Get-ManifestField 'tool' $Tool 7
|
||||
$winget = Get-ManifestField 'tool' $Tool 8
|
||||
$brew = Get-ManifestField 'tool' $Tool 9
|
||||
$apt = Get-ManifestField 'tool' $Tool 10
|
||||
$pacman = Get-ManifestField 'tool' $Tool 11
|
||||
$choco = Get-ManifestField 'tool' $Tool 8
|
||||
$winget = Get-ManifestField 'tool' $Tool 9
|
||||
$brew = Get-ManifestField 'tool' $Tool 10
|
||||
$apt = Get-ManifestField 'tool' $Tool 11
|
||||
$pacman = Get-ManifestField 'tool' $Tool 12
|
||||
$hint = ''
|
||||
switch ($Platform) {
|
||||
'windows' {
|
||||
@@ -752,10 +757,27 @@ foreach ($name in $Sets.Keys) {
|
||||
|
||||
$script:Py = ''
|
||||
$script:PyVersion = ''
|
||||
$script:PyOld = $null
|
||||
$script:PyOut = $null
|
||||
$PyMin = Get-ManifestField 'tool' 'python' 3
|
||||
$PyMax = Get-ManifestField 'tool' 'python' 4
|
||||
|
||||
# Sets Py/PyVersion on success, PyOld when the version is too old.
|
||||
# Whether major.minor lies in the span the manifest admits, both ends inclusive.
|
||||
function Test-PythonAdmitted {
|
||||
param([string]$Version)
|
||||
if (-not (Test-VersionGe $Version $PyMin)) {
|
||||
return $false
|
||||
}
|
||||
return ($PyMax -eq '-' -or (Test-VersionGe $PyMax $Version))
|
||||
}
|
||||
|
||||
# The span in words, for every message that names it.
|
||||
if ($PyMax -eq '-') {
|
||||
$PySpan = "$PyMin or newer"
|
||||
} else {
|
||||
$PySpan = "$PyMin to $PyMax"
|
||||
}
|
||||
|
||||
# Sets Py/PyVersion on success, PyOut when the version lies outside the span.
|
||||
function Test-PythonCandidate {
|
||||
param([string]$Path, [string[]]$Extra = @())
|
||||
$out = Invoke-Native -Path $Path -Arguments ($Extra + @('-c', $PyProbe))
|
||||
@@ -771,12 +793,14 @@ function Test-PythonCandidate {
|
||||
if (-not $version -or -not $executable) {
|
||||
return $false
|
||||
}
|
||||
if (Test-VersionGe $version $PyMin) {
|
||||
if (Test-PythonAdmitted $version) {
|
||||
$script:Py = $executable
|
||||
$script:PyVersion = $version
|
||||
return $true
|
||||
}
|
||||
$script:PyOld = @{ Version = $version; Path = $Path }
|
||||
if (-not $script:PyOut) {
|
||||
$script:PyOut = @{ Version = $version; Path = $Path }
|
||||
}
|
||||
return $false
|
||||
}
|
||||
|
||||
@@ -789,12 +813,33 @@ function Get-PythonExtra {
|
||||
return @()
|
||||
}
|
||||
|
||||
# The versioned interpreters of the span, newest first - python3.14 python3.13 - so a
|
||||
# machine whose plain python lies outside the span, with one inside it beside, is not
|
||||
# turned away. On Windows the launcher's py -3.14 py -3.13 come before each.
|
||||
function Get-VersionedCandidate {
|
||||
if ($PyMax -eq '-') {
|
||||
return @()
|
||||
}
|
||||
$major = $PyMin.Split('.')[0]
|
||||
if ($PyMax.Split('.')[0] -ne $major) {
|
||||
return @()
|
||||
}
|
||||
$candidates = @()
|
||||
for ($minor = [int]$PyMax.Split('.')[1]; $minor -ge [int]$PyMin.Split('.')[1]; $minor--) {
|
||||
if ($Platform -eq 'windows') {
|
||||
$candidates += , @('py', @("-$major.$minor"))
|
||||
}
|
||||
$candidates += , @("python$major.$minor", @())
|
||||
}
|
||||
return $candidates
|
||||
}
|
||||
|
||||
$given = Get-SetValue 'python'
|
||||
if ($given) {
|
||||
if (-not (Test-Usable $given) -or -not (Test-PythonCandidate $given (Get-PythonExtra $given))) {
|
||||
Add-Problem "The path given for Python does not work: $given" `
|
||||
"every wikitool command runs on Python $PyMin or newer, and this path did not start one" `
|
||||
"Check the path - it has to be the python executable itself, version $PyMin or newer.`nThen run: $Self --set python=<full path to python>"
|
||||
"every wikitool command runs on Python $PySpan, and this path did not start one" `
|
||||
"Check the path - it has to be the python executable itself, version $PySpan.`nThen run: $Self --set python=<full path to python>"
|
||||
$script:BadSet = $true
|
||||
}
|
||||
} else {
|
||||
@@ -808,6 +853,7 @@ if ($given) {
|
||||
} else {
|
||||
$order = @(@('python3', @()), @('python', @()))
|
||||
}
|
||||
$order += Get-VersionedCandidate
|
||||
foreach ($candidate in $order) {
|
||||
foreach ($path in (Find-OnPath $candidate[0])) {
|
||||
if (Test-PythonCandidate $path $candidate[1]) {
|
||||
@@ -835,16 +881,30 @@ if ($script:Py) {
|
||||
Add-Report 'OK' 'python' $script:PyVersion $script:Py
|
||||
$Found['python'] = $script:Py
|
||||
} elseif (-not $script:BadSet) {
|
||||
$label = Get-ManifestField 'tool' 'python' 5
|
||||
$why = Get-ManifestField 'tool' 'python' 6
|
||||
if ($script:PyOld) {
|
||||
Add-Report 'TOO_OLD' 'python' $script:PyOld.Version $script:PyOld.Path
|
||||
Add-Problem "$label $($script:PyOld.Version) is too old - this stack needs $PyMin or newer." $why `
|
||||
"$(Get-InstallHint 'python')`nOr, if a newer one is already installed, give its full path:`n$Self --set python=<full path to python>"
|
||||
$label = Get-ManifestField 'tool' 'python' 6
|
||||
$why = Get-ManifestField 'tool' 'python' 7
|
||||
# On Linux the fix is the distribution's own package, which may hold no Python of
|
||||
# the span at all (Debian 12 has 3.11, Ubuntu 24.04 3.12); then the only way is a
|
||||
# Python installed some other way, named with --set. No other tool is suggested.
|
||||
$distro = ''
|
||||
if ($Platform -eq 'linux') {
|
||||
$distro = "`nThe package source of this Linux distribution may offer no Python $PySpan -`nthen that command installs one outside the span, and a Python $PySpan`ninstalled another way has to be named with --set (below)."
|
||||
}
|
||||
if ($script:PyOut) {
|
||||
if (Test-VersionGe $script:PyOut.Version $PyMin) {
|
||||
$status = 'TOO_NEW'
|
||||
$adjective = 'new'
|
||||
} else {
|
||||
$status = 'TOO_OLD'
|
||||
$adjective = 'old'
|
||||
}
|
||||
Add-Report $status 'python' $script:PyOut.Version $script:PyOut.Path
|
||||
Add-Problem "$label $($script:PyOut.Version) is too $adjective - this stack needs Python $PySpan." $why `
|
||||
"$(Get-InstallHint 'python')$distro`nOr, if a Python $PySpan is already installed, give its full path:`n$Self --set python=<full path to python>"
|
||||
} else {
|
||||
Add-Report 'MISSING' 'python' '-' '-'
|
||||
Add-Problem "$label $PyMin or newer was not found." $why `
|
||||
"$(Get-InstallHint 'python')`nOr, if it is installed somewhere this check did not look, give its full path:`n$Self --set python=<full path to python>"
|
||||
Add-Problem "$label $PySpan was not found." $why `
|
||||
"$(Get-InstallHint 'python')$distro`nOr, if it is installed somewhere this check did not look, give its full path:`n$Self --set python=<full path to python>"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -852,8 +912,8 @@ foreach ($tool in $Tools) {
|
||||
if ($tool -eq 'python') {
|
||||
continue
|
||||
}
|
||||
$label = Get-ManifestField 'tool' $tool 5
|
||||
$why = Get-ManifestField 'tool' $tool 6
|
||||
$label = Get-ManifestField 'tool' $tool 6
|
||||
$why = Get-ManifestField 'tool' $tool 7
|
||||
$minimum = Get-ManifestField 'tool' $tool 3
|
||||
$given = Get-SetValue $tool
|
||||
$path = ''
|
||||
@@ -1066,8 +1126,24 @@ function Get-LastLine {
|
||||
return ((($Text -split "`n") | Select-Object -Last 5 | ForEach-Object { " $_" }) -join "`n")
|
||||
}
|
||||
|
||||
# A venv keeps the Python it was created with, whatever the search above found. One
|
||||
# outside the span - an instance set up under an older stack - is built again on $Py;
|
||||
# `--clear` takes the stamps with it, so the install below runs. A venv inside the span
|
||||
# stays, even when $Py is another version of it.
|
||||
$venvPython = Get-VenvPython
|
||||
$rebuild = $false
|
||||
if (-not $venvPython -or $null -eq (Invoke-Native -Path $venvPython -Arguments @('-m', 'pip', '--version'))) {
|
||||
$rebuild = $true
|
||||
} else {
|
||||
$probe = Invoke-Native -Path $venvPython -Arguments @('-c', $PyProbe)
|
||||
$venvVersion = if ($probe) { ($probe -split "`n")[0].Trim() } else { '' }
|
||||
if (-not $venvVersion -or -not (Test-PythonAdmitted $venvVersion)) {
|
||||
$rebuild = $true
|
||||
$shown = if ($venvVersion) { $venvVersion } else { '-' }
|
||||
Write-Line ('REBUILD venv {0,-8} Python {0} is outside {1} - building tools/.venv again on {2}' -f $shown, $PySpan, $script:PyVersion)
|
||||
}
|
||||
}
|
||||
if ($rebuild) {
|
||||
$created = Invoke-NativeVerbose -Path $script:Py -Arguments @('-m', 'venv', '--clear', $Venv)
|
||||
$venvPython = Get-VenvPython
|
||||
if ($created.Code -ne 0 -or -not $venvPython) {
|
||||
@@ -1088,7 +1164,7 @@ if (Test-Path -LiteralPath $Stamp -PathType Leaf) {
|
||||
$have = (Get-Content -Raw -LiteralPath $Stamp).Trim()
|
||||
}
|
||||
if ($want -ne $have) {
|
||||
$installed = Invoke-NativeVerbose -Path $venvPython -Arguments @('-m', 'pip', 'install', '--disable-pip-version-check', '--quiet', '-r', $Requirements)
|
||||
$installed = Invoke-NativeVerbose -Path $venvPython -Arguments @('-m', 'pip', 'install', '--disable-pip-version-check', '--quiet', '--require-hashes', '-r', $Requirements)
|
||||
if ($installed.Code -ne 0) {
|
||||
Add-Problem 'The libraries wikitool needs could not be installed into tools/.venv.' `
|
||||
'they are downloaded once from the internet; without them no wikitool command starts' `
|
||||
@@ -1123,7 +1199,7 @@ if ($With -eq 'browser' -or (Test-Path -LiteralPath $BrowserStamp -PathType Leaf
|
||||
$have = (Get-Content -Raw -LiteralPath $BrowserStamp).Trim()
|
||||
}
|
||||
if ($want -ne $have -or -not (Test-Browser)) {
|
||||
$installed = Invoke-NativeVerbose -Path $venvPython -Arguments @('-m', 'pip', 'install', '--disable-pip-version-check', '--quiet', '-r', $BrowserRequirements)
|
||||
$installed = Invoke-NativeVerbose -Path $venvPython -Arguments @('-m', 'pip', 'install', '--disable-pip-version-check', '--quiet', '--require-hashes', '-r', $BrowserRequirements)
|
||||
if ($installed.Code -ne 0) {
|
||||
Add-Problem 'The optional browser component could not be installed into tools/.venv.' `
|
||||
'only raw login and pages a site handler fetches through a browser need it; everything else works without it' `
|
||||
|
||||
Reference in new issue
Block a user