@@ -827,15 +827,66 @@ tasks:
827827 -r "{{.STYLELINTRC_SCHEMA_PATH}}" \
828828 -d "{{.INSTANCE_PATH}}"
829829
830+ # Print the version constraint for the project's Poetry tool dependency.
831+ # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/poetry-task/Taskfile.yml
832+ poetry:get-version :
833+ cmds :
834+ - |
835+ if ! which yq &>/dev/null; then
836+ echo "yq not found or not in PATH."
837+ echo "Please install: https://github.com/mikefarah/yq/#install"
838+ exit 1
839+ fi
840+ - |
841+ yq \
842+ --input-format toml \
843+ --output-format yaml \
844+ '.tool.poetry.group.pipx.dependencies.poetry' \
845+ < pyproject.toml
846+
847+ # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/poetry-task/Taskfile.yml
848+ poetry:install :
849+ desc : Install Poetry
850+ run : once
851+ vars :
852+ POETRY_VERSION :
853+ sh : task poetry:get-version
854+ cmds :
855+ - |
856+ if ! which python &>/dev/null; then
857+ echo "Python not found or not in PATH."
858+ echo "Please install a version of Python meeting the constraint {{.POETRY_VERSION}}:"
859+ echo "https://wiki.python.org/moin/BeginnersGuide/Download"
860+ exit 1
861+ fi
862+ - |
863+ if ! which pipx &>/dev/null; then
864+ echo "pipx not found or not in PATH."
865+ echo "Please install: https://pipx.pypa.io/stable/installation/#installing-pipx"
866+ exit 1
867+ fi
868+ - |
869+ export PIPX_DEFAULT_PYTHON="$( \
870+ task utility:normalize-path \
871+ RAW_PATH="$(which python)" \
872+ )"
873+ pipx install \
874+ --force \
875+ "poetry=={{.POETRY_VERSION}}"
876+
830877 # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/poetry-task/Taskfile.yml
831878 poetry:install-deps :
832879 desc : Install dependencies managed by Poetry
880+ deps :
881+ - task : poetry:install
833882 cmds :
834883 - poetry install --no-root
835884
836885 # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/poetry-task/Taskfile.yml
837886 poetry:update-deps :
838887 desc : Update all dependencies managed by Poetry to their newest versions
888+ deps :
889+ - task : poetry:install
839890 cmds :
840891 - poetry update
841892
0 commit comments