1#!/usr/bin/env python3
2# -*- coding: utf-8 -*-
3#
4# Copyright (c) 2024 Huawei Device Co., Ltd.
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16
17import os
18import yaml
19
20CURRENT_VERSION = "13.0.0.0"
21
22script_dir = os.path.dirname(os.path.realpath(__file__))
23
24isa_file_path = os.path.join(script_dir, 'isa.yaml')
25
26
27def check_version(yaml_file, cur_version):
28    try:
29        with open(yaml_file, 'r') as file:
30            data = yaml.safe_load(file)
31
32            file_version = data.get('version')
33
34            if file_version == cur_version:
35                print("No change in version!")
36            else:
37                print(f"[IMPORTANT] Version change detected ({cur_version} -> {file_version}), please contact the relevant domain.")
38    except Exception as e:
39        print(f"Error reading file: {e}")
40
41check_version(isa_file_path, CURRENT_VERSION)
42