From 8baafed49fdfd0646f0b35d881d1dc92df761cd6 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 26 Jan 2025 11:49:50 +1100 Subject: [PATCH] Add check for minimum invoke version (#8952) (#8954) (cherry picked from commit d5928f038dd00efb583bad5b38db945601517d32) Co-authored-by: Oliver --- tasks.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tasks.py b/tasks.py index fe67a6a569..3e3a6840d7 100644 --- a/tasks.py +++ b/tasks.py @@ -11,6 +11,7 @@ from pathlib import Path from platform import python_version from typing import Optional +import invoke from invoke import Collection, task from invoke.exceptions import UnexpectedExit @@ -39,6 +40,19 @@ def info(*args): print(f'\033[94m{msg}\033[0m') +def checkInvokeVersion(): + """Check that the installed invoke version meets minimum requirements.""" + MIN_INVOKE_VERSION = '2.0.0' + + min_version = tuple(map(int, MIN_INVOKE_VERSION.split('.'))) + invoke_version = tuple(map(int, invoke.__version__.split('.'))) # noqa: RUF048 + + if invoke_version < min_version: + error(f'The installed invoke version ({invoke.__version__}) is not supported!') + error(f'InvenTree requires invoke version {MIN_INVOKE_VERSION} or above') + sys.exit(1) + + def checkPythonVersion(): """Check that the installed python version meets minimum requirements. @@ -63,6 +77,7 @@ def checkPythonVersion(): if __name__ in ['__main__', 'tasks']: + checkInvokeVersion() checkPythonVersion()