@@ -827,35 +827,29 @@ tasks:
827827 -r "{{.STYLELINTRC_SCHEMA_PATH}}" \
828828 -d "{{.INSTANCE_PATH}}"
829829
830- # Print the version constraint for the project's Poetry tool dependency.
831830 # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/poetry-task/Taskfile.yml
832- poetry:get-version :
831+ poetry:install :
832+ desc : Install Poetry
833+ run : once
833834 cmds :
834835 - |
835836 if ! which yq &>/dev/null; then
836837 echo "yq not found or not in PATH."
837838 echo "Please install: https://github.com/mikefarah/yq/#install"
838839 exit 1
839840 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 :
855841 - |
856842 if ! which python &>/dev/null; then
843+ python_constraint="$( \
844+ yq \
845+ --input-format toml \
846+ --output-format yaml \
847+ '.tool.poetry.dependencies.python' \
848+ < pyproject.toml
849+ )"
850+
857851 echo "Python not found or not in PATH."
858- echo "Please install a version of Python meeting the constraint {{.POETRY_VERSION} }:"
852+ echo "Please install a version of Python satisfying the constraint ${python_constraint }:"
859853 echo "https://wiki.python.org/moin/BeginnersGuide/Download"
860854 exit 1
861855 fi
@@ -870,9 +864,18 @@ tasks:
870864 task utility:normalize-path \
871865 RAW_PATH="$(which python)" \
872866 )"
867+
868+ poetry_constraint="$( \
869+ yq \
870+ --input-format toml \
871+ --output-format yaml \
872+ '.tool.poetry.group.pipx.dependencies.poetry' \
873+ < pyproject.toml
874+ )"
875+
873876 pipx install \
874877 --force \
875- "poetry=={{.POETRY_VERSION}} "
878+ "poetry==$poetry_constraint "
876879
877880 # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/poetry-task/Taskfile.yml
878881 poetry:install-deps :
0 commit comments