From 2f4adb93d3259cf1d64d9ecf24f96a5cf2fd2e28 Mon Sep 17 00:00:00 2001 From: Weicao-CatilGrass <1992414357@qq.com> Date: Sat, 16 May 2026 16:01:19 +0800 Subject: Add support for Python scripts in run-tools --- run-tools.ps1 | 11 +++++++---- run-tools.sh | 8 ++++++++ 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/run-tools.ps1 b/run-tools.ps1 index 5aaa785..20c4565 100644 --- a/run-tools.ps1 +++ b/run-tools.ps1 @@ -13,7 +13,7 @@ if ($args.Count -eq 0) { Write-Host "Warning: dev_tools/src/bin directory does not exist" } if (Test-Path "dev_tools/scripts") { - $scripts = Get-ChildItem -Path "dev_tools/scripts/*.ps1" + $scripts = Get-ChildItem -Path "dev_tools/scripts/*.ps1", "dev_tools/scripts/*.py" foreach ($script in $scripts) { if ($script -is [System.IO.FileInfo]) { Write-Host $script.BaseName @@ -26,11 +26,14 @@ if ($args.Count -eq 0) { } $target_name = $args[0] -$script_file = "dev_tools/scripts/${target_name}.ps1" +$script_file_ps1 = "dev_tools/scripts/${target_name}.ps1" +$script_file_py = "dev_tools/scripts/${target_name}.py" $rust_file = "dev_tools/src/bin/${target_name}.rs" -if (Test-Path $script_file) { - & $script_file +if (Test-Path $script_file_ps1) { + & $script_file_ps1 +} elseif (Test-Path $script_file_py) { + python $script_file_py } elseif (Test-Path $rust_file) { cargo run --manifest-path dev_tools/Cargo.toml --bin $target_name --quiet } else { diff --git a/run-tools.sh b/run-tools.sh index 8faf80f..7a1062a 100755 --- a/run-tools.sh +++ b/run-tools.sh @@ -10,6 +10,11 @@ if [ $# -eq 0 ]; then basename "$file" .sh fi done + for file in dev_tools/scripts/*.py; do + if [ -f "$file" ]; then + basename "$file" .py + fi + done fi if [ -d "dev_tools/src/bin" ]; then for file in dev_tools/src/bin/*.rs; do @@ -23,11 +28,14 @@ fi target_bin="$1" target_script="dev_tools/scripts/${target_bin}.sh" +target_python="dev_tools/scripts/${target_bin}.py" target_file="dev_tools/src/bin/${target_bin}.rs" if [ -f "$target_script" ]; then chmod +x "$target_script" "$target_script" +elif [ -f "$target_python" ]; then + python "$target_python" elif [ -f "$target_file" ]; then cargo run --manifest-path dev_tools/Cargo.toml --bin "$1" --quiet else -- cgit