From: Oto Šťáva Date: Mon, 21 Aug 2023 07:44:10 +0000 (+0200) Subject: manager: run kresctl from the executor's working directory X-Git-Tag: v6.0.2~2^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bd6eeb4e56af71c6cd0005221adb9f66c758b794;p=thirdparty%2Fknot-resolver.git manager: run kresctl from the executor's working directory This updates `poethepoet` to version `^0.22.0` (https://github.com/nat-n/poethepoet/releases/tag/v.0.22.0), which allows tasks to have a working directory different from the project path. This breaks the `poe` script on Python `<3.8`, but discussions took place on Slack where we came to the conclusion that this is fine. The script is meant for developers only and does not affect end users on systems that do not provide newer Python versions. --- diff --git a/manager/poe b/manager/poe index e64b0675d..6b75c48f9 100755 --- a/manager/poe +++ b/manager/poe @@ -1,3 +1,10 @@ #!/bin/bash -poetry run poe $@ +script_dir="$(dirname "$(realpath "$BASH_SOURCE[0]")")" + +if poetry run python -c 'import sys; sys.exit(0 if sys.version_info >= (3, 8) else 1)'; then + poetry --directory "$script_dir" run poe --root "$script_dir" $@ +else + echo "Unsupported Python version - must be >=3.8" >&2 + exit 1 +fi diff --git a/manager/pyproject.toml b/manager/pyproject.toml index d7465ad33..3330b8c84 100644 --- a/manager/pyproject.toml +++ b/manager/pyproject.toml @@ -25,7 +25,7 @@ prometheus-client = "*" [tool.poetry.group.dev.dependencies] poetry = "^1.4.2" pyparsing = "^3.0.9" -poethepoet = "^0.18.1" +poethepoet = { version = "^0.22.0", python = ">=3.8,<4.0" } debugpy = "^1.6.7" [tool.poetry.group.test.dependencies] @@ -65,7 +65,7 @@ format = { shell = "black knot_resolver_manager/ tests/ scripts/ build.py; isort fixdeps = { shell = "poetry install; npm install; npm update", help = "Install/update dependencies according to configuration files"} commit = { shell = "scripts/commit", help = "Invoke every single check before commiting" } container = { cmd = "scripts/container.py", help = "Manage containers" } -kresctl = { script = "knot_resolver_manager.cli.main:main", help="run kresctl" } +kresctl = { script = "knot_resolver_manager.cli.main:main", cwd="${POE_PWD}", help="run kresctl" } clean = """ rm -rf .coverage .mypy_cache