From 12aaddb89131cd5e03ac1325974498c03c0a4a20 Mon Sep 17 00:00:00 2001 From: John Smith Date: Sun, 18 Feb 2024 17:22:44 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=8F=92=E4=BB=B6=E5=88=A4?= =?UTF-8?q?=E6=96=AD=E7=89=88=E6=9C=AC=E5=85=BC=E5=AE=B9=E7=9A=84=E6=96=B9?= =?UTF-8?q?=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- blcsdk/api.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/blcsdk/api.py b/blcsdk/api.py index 3f89826..3c3efda 100644 --- a/blcsdk/api.py +++ b/blcsdk/api.py @@ -147,20 +147,25 @@ def is_sdk_version_compatible(): """ assert _init_msg is not None, 'Please call init() first' - major_ver_pattern = r'(\d+)\.\d+\.\d+' + version_pattern = r'(\d+)\.(\d+)\.\d+' remote_ver = get_blc_sdk_version() - m = re.match(major_ver_pattern, remote_ver) + m = re.match(version_pattern, remote_ver) if m is None: raise exc.SdkError(f"Bad remote version format: {remote_ver}") remote_major_ver = m[1] + remote_minor_ver = m[2] - m = re.match(major_ver_pattern, __version__) + m = re.match(version_pattern, __version__) if m is None: raise exc.SdkError(f"Bad local version format: {__version__}") local_major_ver = m[1] + local_minor_ver = m[2] - res = remote_major_ver == local_major_ver + res = ( + remote_major_ver == local_major_ver + and int(remote_minor_ver) >= int(local_minor_ver) + ) if not res: logger.warning('SDK version is not compatible, remote=%s, local=%s', remote_ver, __version__) return res