Execute the assertion blocks with Python instead

This commit is contained in:
Sven van Heugten 2026-04-15 21:03:02 +02:00
parent d92713930e
commit ad10b2cc4c
No known key found for this signature in database
GPG key ID: D612F88666F4F660
3 changed files with 9 additions and 1 deletions

View file

@ -119,7 +119,11 @@ for commit_hash in "${commits[@]}"; do
echo "git-check-assertions block $block_num:" echo "git-check-assertions block $block_num:"
printf '%s' "$block" | sed 's/^/> /' printf '%s' "$block" | sed 's/^/> /'
check_assertions() { check_assertions() {
bash -euo pipefail -c "$block" python3 - "$block" <<-EOF
import sys
import subprocess
subprocess.run(sys.argv[1], shell=True, check=True)
EOF
} }
if ! check_assertions; then if ! check_assertions; then
echo "git-check-assertions block failed in $commit_hash" >&2 echo "git-check-assertions block failed in $commit_hash" >&2

View file

@ -11,6 +11,7 @@
shfmt, shfmt,
perl, perl,
coreutils, coreutils,
python3,
}: }:
let let
@ -44,6 +45,7 @@ resholve.mkDerivation {
shfmt shfmt
perl perl
coreutils coreutils
python3
]; ];
checkPhase = '' checkPhase = ''
@ -72,6 +74,7 @@ resholve.mkDerivation {
bash bash
perl perl
coreutils coreutils
python3
]; ];
execer = [ execer = [
# Not true at all, but ¯\_(ツ)_/¯ # Not true at all, but ¯\_(ツ)_/¯

View file

@ -25,6 +25,7 @@
pkgs.perl pkgs.perl
pkgs.shfmt pkgs.shfmt
pkgs.coreutils pkgs.coreutils
pkgs.python3
]; ];
}; };
} }