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
+98
-31
@@ -6,10 +6,15 @@
|
||||
# tools/preflight.sh --set rg=/opt/rg/rg use a path the user named
|
||||
# tools/preflight.sh --with browser also install the optional browser component
|
||||
#
|
||||
# --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.sh` - a copy with no tools/prerequisites.txt next
|
||||
# to it - the script is the first install step instead: it downloads the stack
|
||||
@@ -52,9 +57,9 @@ ROOT=$(dirname -- "$DIR")
|
||||
MANIFEST="$DIR/prerequisites.txt"
|
||||
TOOLS_FILE="$ROOT/.wikitool-tools.json"
|
||||
VENV="$DIR/.venv"
|
||||
REQUIREMENTS="$DIR/requirements.txt"
|
||||
REQUIREMENTS="$DIR/requirements.lock"
|
||||
STAMP="$VENV/.chemenu-requirements.sha256"
|
||||
BROWSER_REQUIREMENTS="$DIR/requirements-browser.txt"
|
||||
BROWSER_REQUIREMENTS="$DIR/requirements-browser.lock"
|
||||
BROWSER_STAMP="$VENV/.chemenu-browser.sha256"
|
||||
BROWSERS="$VENV/ms-playwright"
|
||||
SELF="tools/preflight.sh"
|
||||
@@ -475,7 +480,7 @@ manifest_field() { # <kind> <name> <field number, 1-based>
|
||||
}
|
||||
|
||||
TOOLS=""
|
||||
while IFS='|' read -r kind name minimum platforms rest; do
|
||||
while IFS='|' read -r kind name minimum maximum platforms rest; do
|
||||
case "$kind" in ''|'#'*) continue ;; esac
|
||||
[ "$kind" = tool ] || continue
|
||||
case "$name" in *[!a-z0-9]*|'') echo "preflight: bad tool name '$name' in $MANIFEST" >&2; exit 1 ;; esac
|
||||
@@ -494,11 +499,11 @@ done < "$MANIFEST"
|
||||
|
||||
# The install command for this machine's package manager, or every known one.
|
||||
install_hint() { # <tool>
|
||||
choco=$(manifest_field tool "$1" 7)
|
||||
winget=$(manifest_field tool "$1" 8)
|
||||
brew=$(manifest_field tool "$1" 9)
|
||||
apt=$(manifest_field tool "$1" 10)
|
||||
pacman=$(manifest_field tool "$1" 11)
|
||||
choco=$(manifest_field tool "$1" 8)
|
||||
winget=$(manifest_field tool "$1" 9)
|
||||
brew=$(manifest_field tool "$1" 10)
|
||||
apt=$(manifest_field tool "$1" 11)
|
||||
pacman=$(manifest_field tool "$1" 12)
|
||||
hint=""
|
||||
case "$PLATFORM" in
|
||||
windows)
|
||||
@@ -606,19 +611,33 @@ done
|
||||
|
||||
# --- python -------------------------------------------------------------------------
|
||||
|
||||
PY="" PY_VERSION="" PY_OLD=""
|
||||
PY="" PY_VERSION="" PY_OUT=""
|
||||
PY_MIN=$(manifest_field tool python 3)
|
||||
PY_MAX=$(manifest_field tool python 4)
|
||||
|
||||
try_python() { # <path> [extra] -> sets PY/PY_VERSION on success, PY_OLD when too old
|
||||
# Whether major.minor <version> lies in the span the manifest admits, both ends inclusive.
|
||||
py_admitted() { # <version>
|
||||
version_ge "$1" "$PY_MIN" || return 1
|
||||
[ "$PY_MAX" = - ] || version_ge "$PY_MAX" "$1"
|
||||
}
|
||||
|
||||
# The span in words, for every message that names it.
|
||||
if [ "$PY_MAX" = - ]; then
|
||||
PY_SPAN="$PY_MIN or newer"
|
||||
else
|
||||
PY_SPAN="$PY_MIN to $PY_MAX"
|
||||
fi
|
||||
|
||||
try_python() { # <path> [extra] -> sets PY/PY_VERSION on success, PY_OUT when outside the span
|
||||
out=$(probe_python "$@") || return 1
|
||||
version=$(printf '%s\n' "$out" | sed -n 1p)
|
||||
executable=$(printf '%s\n' "$out" | sed -n 2p)
|
||||
[ -n "$version" ] && [ -n "$executable" ] || return 1
|
||||
if version_ge "$version" "$PY_MIN"; then
|
||||
if py_admitted "$version"; then
|
||||
PY=$executable PY_VERSION=$version
|
||||
return 0
|
||||
fi
|
||||
PY_OLD="$version $1"
|
||||
[ -n "$PY_OUT" ] || PY_OUT="$version $1"
|
||||
return 1
|
||||
}
|
||||
|
||||
@@ -626,13 +645,30 @@ python_extra() { # py and py.exe are the launcher: they need -3
|
||||
case "${1##*/}" in py|py.exe) printf '%s\n' -3 ;; esac
|
||||
}
|
||||
|
||||
# The versioned interpreters of the span, newest first - python3.14 python3.13 - so a
|
||||
# machine whose plain python3 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.
|
||||
versioned_candidates() {
|
||||
[ "$PY_MAX" != - ] || return 0
|
||||
major=${PY_MIN%%.*}
|
||||
[ "${PY_MAX%%.*}" = "$major" ] || return 0
|
||||
minor=${PY_MAX#*.}
|
||||
while [ "$minor" -ge "${PY_MIN#*.}" ]; do
|
||||
if [ "$PLATFORM" = windows ]; then
|
||||
printf 'py:-%s.%s ' "$major" "$minor"
|
||||
fi
|
||||
printf 'python%s.%s: ' "$major" "$minor"
|
||||
minor=$((minor - 1))
|
||||
done
|
||||
}
|
||||
|
||||
given=$(set_value python)
|
||||
if [ -n "$given" ]; then
|
||||
extra=$(python_extra "$given")
|
||||
if ! usable "$given" || ! try_python "$given" $extra; then
|
||||
problem "The path given for Python does not work: $given" \
|
||||
"every wikitool command runs on Python $PY_MIN or newer, and this path did not start one" \
|
||||
"Check the path - it has to be the python executable itself, version $PY_MIN or newer.
|
||||
"every wikitool command runs on Python $PY_SPAN, and this path did not start one" \
|
||||
"Check the path - it has to be the python executable itself, version $PY_SPAN.
|
||||
Then run: $SELF --set python=<full path to python>"
|
||||
BAD_SET=1
|
||||
fi
|
||||
@@ -643,9 +679,9 @@ else
|
||||
fi
|
||||
if [ -z "$PY" ]; then
|
||||
if [ "$PLATFORM" = windows ]; then
|
||||
order="python: py:-3 python3:"
|
||||
order="python: py:-3 python3: $(versioned_candidates)"
|
||||
else
|
||||
order="python3: python:"
|
||||
order="python3: python: $(versioned_candidates)"
|
||||
fi
|
||||
for candidate in $order; do
|
||||
name=${candidate%%:*}
|
||||
@@ -679,18 +715,34 @@ if [ -n "$PY" ]; then
|
||||
report OK python "$PY_VERSION" "$PY"
|
||||
eval "FOUND_python=\$PY"
|
||||
elif [ "$BAD_SET" -eq 0 ]; then
|
||||
label=$(manifest_field tool python 5)
|
||||
why=$(manifest_field tool python 6)
|
||||
if [ -n "$PY_OLD" ]; then
|
||||
report TOO_OLD python "${PY_OLD%% *}" "${PY_OLD#* }"
|
||||
problem "$label ${PY_OLD%% *} is too old - this stack needs $PY_MIN or newer." "$why" \
|
||||
"$(install_hint python)
|
||||
Or, if a newer one is already installed, give its full path:
|
||||
label=$(manifest_field tool python 6)
|
||||
why=$(manifest_field 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" = linux ]; then
|
||||
distro="
|
||||
The package source of this Linux distribution may offer no Python $PY_SPAN -
|
||||
then that command installs one outside the span, and a Python $PY_SPAN
|
||||
installed another way has to be named with --set (below)."
|
||||
fi
|
||||
if [ -n "$PY_OUT" ]; then
|
||||
out_version=${PY_OUT%% *}
|
||||
if version_ge "$out_version" "$PY_MIN"; then
|
||||
status=TOO_NEW adjective=new
|
||||
else
|
||||
status=TOO_OLD adjective=old
|
||||
fi
|
||||
report "$status" python "$out_version" "${PY_OUT#* }"
|
||||
problem "$label $out_version is too $adjective - this stack needs Python $PY_SPAN." "$why" \
|
||||
"$(install_hint python)$distro
|
||||
Or, if a Python $PY_SPAN is already installed, give its full path:
|
||||
$SELF --set python=<full path to python>"
|
||||
else
|
||||
report MISSING python - -
|
||||
problem "$label $PY_MIN or newer was not found." "$why" \
|
||||
"$(install_hint python)
|
||||
problem "$label $PY_SPAN was not found." "$why" \
|
||||
"$(install_hint python)$distro
|
||||
Or, if it is installed somewhere this check did not look, give its full path:
|
||||
$SELF --set python=<full path to python>"
|
||||
fi
|
||||
@@ -698,8 +750,8 @@ fi
|
||||
|
||||
for tool in $TOOLS; do
|
||||
[ "$tool" = python ] && continue
|
||||
label=$(manifest_field tool "$tool" 5)
|
||||
why=$(manifest_field tool "$tool" 6)
|
||||
label=$(manifest_field tool "$tool" 6)
|
||||
why=$(manifest_field tool "$tool" 7)
|
||||
minimum=$(manifest_field tool "$tool" 3)
|
||||
given=$(set_value "$tool")
|
||||
path=""
|
||||
@@ -837,8 +889,23 @@ last_lines() {
|
||||
printf '%s\n' "$1" | tail -n 5 | sed 's/^/ /'
|
||||
}
|
||||
|
||||
# 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.
|
||||
VPY=$(venv_python) || VPY=""
|
||||
rebuild=""
|
||||
if [ -z "$VPY" ] || ! "$VPY" -m pip --version >/dev/null 2>&1; then
|
||||
rebuild=1
|
||||
else
|
||||
venv_version=$(probe_python "$VPY" | sed -n 1p)
|
||||
if [ -z "$venv_version" ] || ! py_admitted "$venv_version"; then
|
||||
rebuild=1
|
||||
printf 'REBUILD venv %-8s Python %s is outside %s - building tools/.venv again on %s\n' \
|
||||
"${venv_version:--}" "${venv_version:-of unknown version}" "$PY_SPAN" "$PY_VERSION"
|
||||
fi
|
||||
fi
|
||||
if [ -n "$rebuild" ]; then
|
||||
if ! output=$("$PY" -m venv --clear "$VENV" 2>&1) || ! VPY=$(venv_python); then
|
||||
fix="Python said:
|
||||
$(last_lines "$output")"
|
||||
@@ -857,7 +924,7 @@ want=$("$VPY" -c 'import hashlib, sys; print(hashlib.sha256(open(sys.argv[1], "r
|
||||
"$REQUIREMENTS" 2>/dev/null | tr -d '\r')
|
||||
have=$(cat "$STAMP" 2>/dev/null) || have=""
|
||||
if [ -z "$want" ] || [ "$want" != "$have" ]; then
|
||||
if ! output=$("$VPY" -m pip install --disable-pip-version-check --quiet -r "$REQUIREMENTS" 2>&1); then
|
||||
if ! output=$("$VPY" -m pip install --disable-pip-version-check --quiet --require-hashes -r "$REQUIREMENTS" 2>&1); then
|
||||
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" \
|
||||
"Check that this computer can reach the internet (a proxy or a security program can block it; if so, ask whoever looks after this computer).
|
||||
@@ -891,7 +958,7 @@ if [ "$WITH" = browser ] || [ -f "$BROWSER_STAMP" ]; then
|
||||
"$BROWSER_REQUIREMENTS" 2>/dev/null | tr -d '\r')
|
||||
have=$(cat "$BROWSER_STAMP" 2>/dev/null) || have=""
|
||||
if [ -z "$want" ] || [ "$want" != "$have" ] || ! has_browser; then
|
||||
if ! output=$("$VPY" -m pip install --disable-pip-version-check --quiet -r "$BROWSER_REQUIREMENTS" 2>&1); then
|
||||
if ! output=$("$VPY" -m pip install --disable-pip-version-check --quiet --require-hashes -r "$BROWSER_REQUIREMENTS" 2>&1); then
|
||||
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" \
|
||||
"Check that this computer can reach the internet (a proxy or a security program can block it; if so, ask whoever looks after this computer), then run: $SELF --with browser
|
||||
|
||||
Reference in new issue
Block a user