adapt for windows dev
authorLaurent Mazet <laurent.mazet@thalesgroup.com>
Mon, 29 Jan 2024 12:15:27 +0000 (13:15 +0100)
committerLaurent Mazet <laurent.mazet@thalesgroup.com>
Mon, 29 Jan 2024 12:15:27 +0000 (13:15 +0100)
makefile
testpy [new file with mode: 0644]

index de7c7617e36ef268b04d5ec96035281833223ed3..c2f1e4ceaa278d4ee7e5491917f5dd508eb5f147 100644 (file)
--- 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 (file)
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