From c1670bbd068527a026f4412804111b121526b9fc Mon Sep 17 00:00:00 2001 From: Laurent Mazet Date: Mon, 29 Jan 2024 13:15:27 +0100 Subject: [PATCH] adapt for windows --- makefile | 3 ++- testpy | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 testpy diff --git a/makefile b/makefile index de7c761..c2f1e4c 100644 --- a/makefile +++ b/makefile @@ -1,7 +1,8 @@ # makefile MAKEFLAGS = -s -PYTHON = python3 +#PYTHON = python3 +PYTHON = ./testpy SHELL = bash # Functions diff --git a/testpy b/testpy new file mode 100644 index 0000000..136edbb --- /dev/null +++ b/testpy @@ -0,0 +1,14 @@ +#!/bin/sh + +file=$1 +[ -f "$file" ] || { echo "missing file"; exit 1; } + +import=$(awk '/import/ { print $2 }' $file) + +tmp=$(mktemp).py +trap "rm $tmp" 0 1 2 15 + +awk '/__main__/,/^$/ { $0="" } { print }' $import.py > $tmp +awk '/from/ && /'$import'/ { $0="" } { print }' $file >> $tmp + +python $tmp -- 2.30.2