]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
manager: run kresctl from the executor's working directory
authorOto Šťáva <oto.stava@nic.cz>
Mon, 21 Aug 2023 07:44:10 +0000 (09:44 +0200)
committerVladimír Čunát <vladimir.cunat@nic.cz>
Thu, 24 Aug 2023 08:14:16 +0000 (08:14 +0000)
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.

manager/poe
manager/pyproject.toml

index e64b0675df005c47097232cc623d55f406dc78d2..6b75c48f90b5f42297e6cf07167065b431fdd0fa 100755 (executable)
@@ -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
index d7465ad33f0b49c1216189353f4745db4837a5ac..3330b8c842046af84000bb39f727c94623ef4c1e 100644 (file)
@@ -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