From ad10b2cc4c711a194effe5dfcb4e059bacd4893c Mon Sep 17 00:00:00 2001 From: Sven van Heugten Date: Wed, 15 Apr 2026 21:03:02 +0200 Subject: [PATCH] Execute the assertion blocks with Python instead --- bin/git-check-assertions | 6 +++++- default.nix | 3 +++ flake.nix | 1 + 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/bin/git-check-assertions b/bin/git-check-assertions index 5cc842f..dcb91be 100755 --- a/bin/git-check-assertions +++ b/bin/git-check-assertions @@ -119,7 +119,11 @@ for commit_hash in "${commits[@]}"; do echo "git-check-assertions block $block_num:" printf '%s' "$block" | sed 's/^/> /' 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 echo "git-check-assertions block failed in $commit_hash" >&2 diff --git a/default.nix b/default.nix index c260e4c..e3b912d 100644 --- a/default.nix +++ b/default.nix @@ -11,6 +11,7 @@ shfmt, perl, coreutils, + python3, }: let @@ -44,6 +45,7 @@ resholve.mkDerivation { shfmt perl coreutils + python3 ]; checkPhase = '' @@ -72,6 +74,7 @@ resholve.mkDerivation { bash perl coreutils + python3 ]; execer = [ # Not true at all, but ¯\_(ツ)_/¯ diff --git a/flake.nix b/flake.nix index 1fabe89..0dbfbc8 100644 --- a/flake.nix +++ b/flake.nix @@ -25,6 +25,7 @@ pkgs.perl pkgs.shfmt pkgs.coreutils + pkgs.python3 ]; }; }