IVGCVSW-4813 Update semantic versioning of ArmNN to 22.0.0 for 20.08 release
[platform/upstream/armnn.git] / python / pyarmnn / src / pyarmnn / _version.py
1 # Copyright © 2020 Arm Ltd. All rights reserved.
2 # Copyright 2020 NXP
3 # SPDX-License-Identifier: MIT
4 import os
5
6 version_info = (22, 0, 0)
7
8 __dev_version_env = os.getenv("PYARMNN_DEV_VER", "")
9
10 if __dev_version_env:
11     __dev_version = "dev0"
12     try:
13         __dev_version = "dev{}".format(int(__dev_version_env))
14     except ValueError:
15         __dev_version = str(__dev_version_env)
16
17     version_info = (*version_info, __dev_version)
18
19 __version__ = '.'.join(str(c) for c in version_info)
20 __arm_ml_version__ = '{}.{}.{}'.format(version_info[0], version_info[1], version_info[2])
21
22
23 def check_armnn_version(installed_armnn_version: str, expected_armnn_version: str = __arm_ml_version__):
24     """Compares expected Arm NN version and Arm NN version used to build the package.
25
26     Args:
27         installed_armnn_version (str): Arm NN version used to generate the package (e.g. 22.0.0)
28         expected_armnn_version (str): Expected Arm NN version
29
30     Returns:
31         None
32     """
33     expected = expected_armnn_version.split('.', 2)
34     installed = installed_armnn_version.split('.', 2)
35
36     # only compare major and minor versions, not patch
37     assert (expected[0] == installed[0]) and (expected[1] == installed[1]), \
38         "Expected ArmNN version is {} but installed ArmNN version is {}".format(expected_armnn_version, installed_armnn_version)