From: Laurent Mazet Date: Mon, 29 Jan 2024 12:15:27 +0000 (+0100) Subject: adapt for windows X-Git-Url: https://secure.softndesign.org/git/?a=commitdiff_plain;h=refs%2Fheads%2Fdev;p=battleships.git adapt for windows --- 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