Skip to content

Commit

Permalink
[Fix](mlu-ops): Catch version_compare error (#1052)
Browse files Browse the repository at this point in the history
  • Loading branch information
chqy99 authored Jun 24, 2024
1 parent 6eab566 commit b6d911d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion version_pre_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,16 @@
# version(str1) > version(str2)
def gtVersion(str1, str2):
global version_check_module

if version_check_module == 1:
try:
from packaging import version
return version.parse(str1) > version.parse(str2)
except ImportError:
print("packaging not exists, try import distutils")
version_check_module = 0
except Exception as e1:
print(f"version check error: {e1}")

if version_check_module == 0:
try:
Expand All @@ -34,8 +37,10 @@ def gtVersion(str1, str2):
except ImportError:
print("distutils not exists, version check failed")
version_check_module = -1
except Exception as e1:
print(f"version check error: {e1}")

return FALSE
return False

def get_build_requires(print_mode=1):
global required_version
Expand Down

0 comments on commit b6d911d

Please sign in to comment.