Scripts: Workaround deprecated parse_version

Different approach from #3579

Instead of completely ddropping the deprecated path, support the new
path and the old path using python try-except import exceptions.

This allows us to continue using old packages in CI, while supporting
the future API once pkg_resources gets deprecated and removed. Best of
both worlds.
This commit is contained in:
Ryan Houdek committed 2024-07-31 01:57:31 -07:00
1 parent d24d0a95a0
commit 4beb29141b
1 file changed
+5 -2
+5 -2
View File
@@ -2,7 +2,10 @@
import re
import sys
import subprocess
from pkg_resources import parse_version
try:
from packaging import version as version_check
except:
from pkg_resources import parse_version as version_check
# Order this list from oldest to newest
# try not to list something newer than our minimum compiler supported version
@@ -89,7 +92,7 @@ for core in cpuinfo:
IDList = BigCoreIDs.get(core)
if type(IDList) is list:
for ID in IDList:
if parse_version(clang_version) >= parse_version(ID[1]):
if version_check(clang_version) >= version_check(ID[1]):
largest_big = ID[0]
else:
largest_big = BigCoreIDs.get(core)