Skip to content

Commit 8baafed

Browse files
Add check for minimum invoke version (#8952) (#8954)
(cherry picked from commit d5928f0) Co-authored-by: Oliver <oliver.henry.walters@gmail.com>
1 parent abddfb0 commit 8baafed

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

tasks.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
from platform import python_version
1212
from typing import Optional
1313

14+
import invoke
1415
from invoke import Collection, task
1516
from invoke.exceptions import UnexpectedExit
1617

@@ -39,6 +40,19 @@ def info(*args):
3940
print(f'\033[94m{msg}\033[0m')
4041

4142

43+
def checkInvokeVersion():
44+
"""Check that the installed invoke version meets minimum requirements."""
45+
MIN_INVOKE_VERSION = '2.0.0'
46+
47+
min_version = tuple(map(int, MIN_INVOKE_VERSION.split('.')))
48+
invoke_version = tuple(map(int, invoke.__version__.split('.'))) # noqa: RUF048
49+
50+
if invoke_version < min_version:
51+
error(f'The installed invoke version ({invoke.__version__}) is not supported!')
52+
error(f'InvenTree requires invoke version {MIN_INVOKE_VERSION} or above')
53+
sys.exit(1)
54+
55+
4256
def checkPythonVersion():
4357
"""Check that the installed python version meets minimum requirements.
4458
@@ -63,6 +77,7 @@ def checkPythonVersion():
6377

6478

6579
if __name__ in ['__main__', 'tasks']:
80+
checkInvokeVersion()
6681
checkPythonVersion()
6782

6883

0 commit comments

Comments
 (0)