From c84a03953673a15dd64d7aa40dd56f69f696172c Mon Sep 17 00:00:00 2001 From: Brendan Shanks Date: Tue, 19 Nov 2024 12:42:09 -0800 Subject: [PATCH] Taskfile: Call 'python3' on non-Windows platforms --- Taskfile.yml | 59 +++++++++++++++--------------- scripts/tasks/Taskfile_windows.yml | 1 + 2 files changed, 31 insertions(+), 29 deletions(-) diff --git a/Taskfile.yml b/Taskfile.yml index 62b722638c2..6e1c669fd16 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -16,6 +16,7 @@ vars: GOALCTEST_BIN_RELEASE_DIR: './build' FORMATTER_BIN_RELEASE_DIR: './build/tools' EXE_FILE_EXTENSION: '' + PYTHON: 'python3' dotenv: - ./scripts/tasks/.env @@ -24,33 +25,33 @@ dotenv: tasks: # SETTINGS / CONFIGURATION settings: - - 'python ./scripts/tasks/update-env.py --info' + - '{{.PYTHON}} ./scripts/tasks/update-env.py --info' set-game-jak1: - - 'python ./scripts/tasks/update-env.py --game jak1' + - '{{.PYTHON}} ./scripts/tasks/update-env.py --game jak1' set-game-jak2: - - 'python ./scripts/tasks/update-env.py --game jak2' + - '{{.PYTHON}} ./scripts/tasks/update-env.py --game jak2' set-game-jak3: - - 'python ./scripts/tasks/update-env.py --game jak3' + - '{{.PYTHON}} ./scripts/tasks/update-env.py --game jak3' set-decomp-ntscv1: desc: "aka black label" cmds: - - 'python ./scripts/tasks/update-env.py --decomp_config ntscv1' + - '{{.PYTHON}} ./scripts/tasks/update-env.py --decomp_config ntscv1' set-decomp-ntscv2: desc: "aka red label" cmds: - - 'python ./scripts/tasks/update-env.py --decomp_config ntscv2' + - '{{.PYTHON}} ./scripts/tasks/update-env.py --decomp_config ntscv2' set-decomp-pal: desc: "PAL region version" cmds: - - 'python ./scripts/tasks/update-env.py --decomp_config pal' + - '{{.PYTHON}} ./scripts/tasks/update-env.py --decomp_config pal' set-decomp-ntscjp: desc: "NTSC-J region version" cmds: - - 'python ./scripts/tasks/update-env.py --decomp_config ntscjp' + - '{{.PYTHON}} ./scripts/tasks/update-env.py --decomp_config ntscjp' set-decomp-ntscko: desc: "NTSC-K region version" cmds: - - 'python ./scripts/tasks/update-env.py --decomp_config ntscko' + - '{{.PYTHON}} ./scripts/tasks/update-env.py --decomp_config ntscko' # GENERAL extract: desc: "Extracts the game's assets from './iso_data' with the set decompiler config" @@ -105,9 +106,9 @@ tasks: format: desc: "Format code" cmds: - - cmd: python ./scripts/cpp/format-includes.py - - cmd: python ./scripts/ci/lint-trailing-whitespace.py --fix - - cmd: python ./third-party/run-clang-format/run-clang-format.py -r common decompiler game goalc test tools lsp -i + - cmd: '{{.PYTHON}} ./scripts/cpp/format-includes.py' + - cmd: '{{.PYTHON}} ./scripts/ci/lint-trailing-whitespace.py --fix' + - cmd: '{{.PYTHON}} ./third-party/run-clang-format/run-clang-format.py -r common decompiler game goalc test tools lsp -i' - task: format-json format-gsrc: desc: "Run formatter on gsrc file" @@ -125,28 +126,28 @@ tasks: - "{{.DECOMP_BIN_RELEASE_DIR}}/decompiler \"./decompiler/config/{{.DECOMP_CONFIG}}\" \"./iso_data\" \"./decompiler_out\" --version \"{{.DECOMP_CONFIG_VERSION}}\" --config-override '{\"decompile_code\": true, \"levels_extract\": false, \"allowed_objects\": [\"{{.FILE}}\"]}'" decomp-clean: cmds: - - python ./scripts/tasks/clean-decomp.py --game "{{.GAME}}" + - '{{.PYTHON}} ./scripts/tasks/clean-decomp.py --game "{{.GAME}}"' lint-gsrc-file: cmds: - - python ./scripts/gsrc/lint-gsrc-file.py --game {{.GAME}} --file "{{.FILE}}" + - '{{.PYTHON}} ./scripts/gsrc/lint-gsrc-file.py --game {{.GAME}} --file "{{.FILE}}"' update-gsrc: cmds: - - python ./scripts/gsrc/update-gsrc-via-refs.py --game "{{.GAME}}" --decompiler "{{.DECOMP_BIN_RELEASE_DIR}}/decompiler" --decompiler_config {{.DECOMP_CONFIG}} --version {{.DECOMP_CONFIG_VERSION}} + - '{{.PYTHON}} ./scripts/gsrc/update-gsrc-via-refs.py --game "{{.GAME}}" --decompiler "{{.DECOMP_BIN_RELEASE_DIR}}/decompiler" --decompiler_config {{.DECOMP_CONFIG}} --version {{.DECOMP_CONFIG_VERSION}}' update-gsrc-glob: cmds: - - python ./scripts/gsrc/update-gsrc-via-refs.py --game "{{.GAME}}" --file_pattern "{{.GLOB}}" --decompiler "{{.DECOMP_BIN_RELEASE_DIR}}/decompiler" --decompiler_config {{.DECOMP_CONFIG}} --version {{.DECOMP_CONFIG_VERSION}} + - '{{.PYTHON}} ./scripts/gsrc/update-gsrc-via-refs.py --game "{{.GAME}}" --file_pattern "{{.GLOB}}" --decompiler "{{.DECOMP_BIN_RELEASE_DIR}}/decompiler" --decompiler_config {{.DECOMP_CONFIG}} --version {{.DECOMP_CONFIG_VERSION}}' update-gsrc-file: cmds: - task: decomp-file - - python ./scripts/gsrc/update-from-decomp.py --game "{{.GAME}}" --file "{{.FILE}}" + - '{{.PYTHON}} ./scripts/gsrc/update-from-decomp.py --game "{{.GAME}}" --file "{{.FILE}}"' - task: lint-gsrc-file copy-common-naming: cmds: - - python ./scripts/gsrc/copy-common-naming.py --file "{{.FILE}}" --decompiler "{{.DECOMP_BIN_RELEASE_DIR}}/decompiler" + - '{{.PYTHON}} ./scripts/gsrc/copy-common-naming.py --file "{{.FILE}}" --decompiler "{{.DECOMP_BIN_RELEASE_DIR}}/decompiler"' - task: format-json copy-common-naming-from-refs: cmds: - - python ./scripts/gsrc/copy-common-naming.py --update-names-from-refs --decompiler "{{.DECOMP_BIN_RELEASE_DIR}}/decompiler" + - '{{.PYTHON}} ./scripts/gsrc/copy-common-naming.py --update-names-from-refs --decompiler "{{.DECOMP_BIN_RELEASE_DIR}}/decompiler"' - task: format-json # ASSET RIPPING rip-textures: @@ -161,10 +162,10 @@ tasks: # TOOLS analyze-ee-memory: cmds: - - python ./scripts/tasks/extract-zip.py --file "{{.FILE}}" --out ./savestate_out/ + - '{{.PYTHON}} ./scripts/tasks/extract-zip.py --file "{{.FILE}}" --out ./savestate_out/' - '{{.MEMDUMP_BIN_RELEASE_DIR}}/memory_dump_tool ./savestate_out/eeMemory.bin --output-path ./ --game {{.GAME}} > ee-analysis.log' watch-pcsx2: - # python -m pip install -U "watchdog[watchmedo]" + # {{.PYTHON}} -m pip install -U "watchdog[watchmedo]" cmds: - watchmedo shell-command --drop --patterns="*.p2s" --recursive --command='task analyze-ee-memory FILE="${watch_src_path}"' "{{.SAVESTATE_DIR}}" vars: @@ -177,15 +178,15 @@ tasks: desc: Updates locally built tree-sitter rules cmds: - cd ../tree-sitter-opengoal && yarn gen - - python ./scripts/tasks/cp.py --src "../tree-sitter-opengoal/src/*" --dest "./third-party/tree-sitter/tree-sitter-opengoal" - - python ./scripts/tasks/cp.py --src "../tree-sitter-opengoal/grammar.js" --dest "./third-party/tree-sitter/tree-sitter-opengoal" + - '{{.PYTHON}} ./scripts/tasks/cp.py --src "../tree-sitter-opengoal/src/*" --dest "./third-party/tree-sitter/tree-sitter-opengoal"' + - '{{.PYTHON}} ./scripts/tasks/cp.py --src "../tree-sitter-opengoal/grammar.js" --dest "./third-party/tree-sitter/tree-sitter-opengoal"' fix-translations: desc: Finds and tries to fix invalid translation Characters cmds: - - python ./scripts/ci/lint-characters.py --fix + - '{{.PYTHON}} ./scripts/ci/lint-characters.py --fix' lint: cmds: - - python ./scripts/ci/lint-trailing-whitespace.py + - '{{.PYTHON}} ./scripts/ci/lint-trailing-whitespace.py' run-gpu-test: desc: "Runs the game's built in GPU test" preconditions: @@ -206,17 +207,17 @@ tasks: # TODO - amalgamate offline-tests and this task, run twice if the previous step fails update-ref-tests: cmds: - - cmd: python ./scripts/tasks/delete-file-or-folder.py --path failures + - cmd: '{{.PYTHON}} ./scripts/tasks/delete-file-or-folder.py --path failures' - cmd: '{{.OFFLINETEST_BIN_RELEASE_DIR}}/offline-test --iso_data_path "./iso_data/{{.GAME}}" --game {{.GAME}} --pretty-print --num_threads 32 --dump_current_output --fail-on-cmp' ignore_error: true - - python ./scripts/update_decomp_reference.py ./failures ./test/decompiler/reference/ --game {{.GAME}} + - '{{.PYTHON}} ./scripts/update_decomp_reference.py ./failures ./test/decompiler/reference/ --game {{.GAME}}' - task: offline-tests-fast update-ref-file: cmds: - - cmd: python ./scripts/tasks/delete-file-or-folder.py --path failures + - cmd: '{{.PYTHON}} ./scripts/tasks/delete-file-or-folder.py --path failures' - cmd: '{{.OFFLINETEST_BIN_RELEASE_DIR}}/offline-test --iso_data_path "./iso_data/{{.GAME}}" --file {{.FILE}} --game {{.GAME}} --dump_current_output --fail-on-cmp' ignore_error: true - - python ./scripts/update_decomp_reference.py ./failures ./test/decompiler/reference/ --game {{.GAME}} + - '{{.PYTHON}} ./scripts/update_decomp_reference.py ./failures ./test/decompiler/reference/ --game {{.GAME}}' - task: offline-test-file type-test: cmds: diff --git a/scripts/tasks/Taskfile_windows.yml b/scripts/tasks/Taskfile_windows.yml index f47cb37161f..2aa17c3d770 100644 --- a/scripts/tasks/Taskfile_windows.yml +++ b/scripts/tasks/Taskfile_windows.yml @@ -10,3 +10,4 @@ vars: GOALCTEST_BIN_RELEASE_DIR: './out/build/Release/bin' FORMATTER_BIN_RELEASE_DIR: './out/build/Release/bin' EXE_FILE_EXTENSION: '.exe' + PYTHON: 'python'