From 0b30209f773e08ac0e36b71911fd01299b5b5ff8 Mon Sep 17 00:00:00 2001 From: Tobias Wolf Date: Fri, 31 May 2024 08:38:05 +0200 Subject: [PATCH 1/3] Fix missing "dynamic" flag for `setup.cfg` based `optional-dependencies` entry Signed-off-by: Tobias Wolf --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 97da775..16f1b0a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,7 +3,7 @@ requires = [ "setuptools", "wheel" ] build-backend = "setuptools.build_meta" [project] -dynamic = ["dependencies", "scripts", "version"] +dynamic = ["dependencies", "optional-dependencies", "scripts", "version"] requires-python = ">=3.9" name = "Rookify" From 7c4a40a78b6ce446f0e8811c1fb2167c9a502110 Mon Sep 17 00:00:00 2001 From: Tobias Wolf Date: Fri, 31 May 2024 08:38:18 +0200 Subject: [PATCH 2/3] Ensure states are only scheduled once (first time) Signed-off-by: Tobias Wolf --- src/rookify/modules/machine.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/rookify/modules/machine.py b/src/rookify/modules/machine.py index e0ec915..45a5a50 100644 --- a/src/rookify/modules/machine.py +++ b/src/rookify/modules/machine.py @@ -28,7 +28,8 @@ def add_preflight_state(self, name: str, **kwargs: Dict[str, Any]) -> None: def execute(self) -> None: for state in self._preflight_states + self._execution_states: - self.add_state(state) + if state.name not in self.states: + self.add_state(state) self.add_state("migrated") self.add_ordered_transitions(loop=False) From d7deaba441a7192a7828cf7471ce1bc8e3cea5f4 Mon Sep 17 00:00:00 2001 From: Tobias Wolf Date: Fri, 31 May 2024 08:38:30 +0200 Subject: [PATCH 3/3] Fix path calculation for templates of modules Signed-off-by: Tobias Wolf --- src/rookify/modules/module.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/rookify/modules/module.py b/src/rookify/modules/module.py index 1de3997..a02e743 100644 --- a/src/rookify/modules/module.py +++ b/src/rookify/modules/module.py @@ -213,7 +213,12 @@ def execute(self) -> None: pass def load_template(self, filename: str, **variables: Any) -> __Template: - template_path = os.path.join(os.path.dirname(__file__), "templates", filename) + template_path = os.path.join( + os.path.dirname(__file__), + self.__class__.__module__.rsplit(".", 2)[1], + "templates", + filename, + ) template = ModuleHandler.__Template(template_path) template.render(**variables) return template