Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 22 additions & 19 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -827,35 +827,29 @@ tasks:
-r "{{.STYLELINTRC_SCHEMA_PATH}}" \
-d "{{.INSTANCE_PATH}}"

# Print the version constraint for the project's Poetry tool dependency.
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/poetry-task/Taskfile.yml
poetry:get-version:
poetry:install:
desc: Install Poetry
run: once
cmds:
- |
if ! which yq &>/dev/null; then
echo "yq not found or not in PATH."
echo "Please install: https://github.com/mikefarah/yq/#install"
exit 1
fi
- |
yq \
--input-format toml \
--output-format yaml \
'.tool.poetry.group.pipx.dependencies.poetry' \
< pyproject.toml

# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/poetry-task/Taskfile.yml
poetry:install:
desc: Install Poetry
run: once
vars:
POETRY_VERSION:
sh: task poetry:get-version
cmds:
- |
if ! which python &>/dev/null; then
python_constraint="$( \
yq \
--input-format toml \
--output-format yaml \
'.tool.poetry.dependencies.python' \
< pyproject.toml
)"

echo "Python not found or not in PATH."
echo "Please install a version of Python meeting the constraint {{.POETRY_VERSION}}:"
echo "Please install a version of Python satisfying the constraint ${python_constraint}:"
echo "https://wiki.python.org/moin/BeginnersGuide/Download"
exit 1
fi
Expand All @@ -870,9 +864,18 @@ tasks:
task utility:normalize-path \
RAW_PATH="$(which python)" \
)"

poetry_constraint="$( \
yq \
--input-format toml \
--output-format yaml \
'.tool.poetry.group.pipx.dependencies.poetry' \
< pyproject.toml
)"

pipx install \
--force \
"poetry=={{.POETRY_VERSION}}"
"poetry==$poetry_constraint"

# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/poetry-task/Taskfile.yml
poetry:install-deps:
Expand Down
41 changes: 22 additions & 19 deletions workflow-templates/assets/poetry-task/Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,29 @@
version: "3"

tasks:
# Print the version constraint for the project's Poetry tool dependency.
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/poetry-task/Taskfile.yml
poetry:get-version:
poetry:install:
desc: Install Poetry
run: once
cmds:
- |
if ! which yq &>/dev/null; then
echo "yq not found or not in PATH."
echo "Please install: https://github.com/mikefarah/yq/#install"
exit 1
fi
- |
yq \
--input-format toml \
--output-format yaml \
'.tool.poetry.group.pipx.dependencies.poetry' \
< pyproject.toml

# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/poetry-task/Taskfile.yml
poetry:install:
desc: Install Poetry
run: once
vars:
POETRY_VERSION:
sh: task poetry:get-version
cmds:
- |
if ! which python &>/dev/null; then
python_constraint="$( \
yq \
--input-format toml \
--output-format yaml \
'.tool.poetry.dependencies.python' \
< pyproject.toml
)"

echo "Python not found or not in PATH."
echo "Please install a version of Python meeting the constraint {{.POETRY_VERSION}}:"
echo "Please install a version of Python satisfying the constraint ${python_constraint}:"
echo "https://wiki.python.org/moin/BeginnersGuide/Download"
exit 1
fi
Expand All @@ -45,9 +39,18 @@ tasks:
task utility:normalize-path \
RAW_PATH="$(which python)" \
)"

poetry_constraint="$( \
yq \
--input-format toml \
--output-format yaml \
'.tool.poetry.group.pipx.dependencies.poetry' \
< pyproject.toml
)"

pipx install \
--force \
"poetry=={{.POETRY_VERSION}}"
"poetry==$poetry_constraint"

# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/poetry-task/Taskfile.yml
poetry:install-deps:
Expand Down
Loading