[Lldb-commits] [lldb] [lldb][windows] refactor the version check in @skipIfWindows (PR #172838)
Ebuka Ezike via lldb-commits
lldb-commits at lists.llvm.org
Thu Dec 18 05:51:02 PST 2025
================
@@ -322,8 +342,34 @@ def getDwarfVersion():
return "0"
+def isExpectedVersion(
+ actual_version: str, required_version: str, operator: str
+) -> bool:
+ """Returns True if actual_version matches the required_version given the operator.
+ Any operator other than the following defaults to an equality test:
+ '>', '>=', "=>", '<', '<=', '=<', '!=', "!" or 'not'
+
+ Example:
+ - actual_version='1.2.0', required_version='1.0.0', operator='>=' returns True
+ """
+ actual_version_ = version.parse(actual_version)
+ required_version_ = version.parse(required_version)
+
+ if operator == ">":
+ return actual_version_ > required_version_
+ if operator == ">=" or operator == "=>":
+ return actual_version_ >= required_version_
+ if operator == "<":
+ return actual_version_ < required_version_
+ if operator == "<=" or operator == "=<":
+ return actual_version_ <= required_version_
+ if operator == "!=" or operator == "!" or operator == "not":
+ return actual_version not in required_version
----------------
da-viper wrote:
We could use the `parsed versions` here as it takes care of extra spaces for the `!=` and `==` cases.
https://github.com/llvm/llvm-project/pull/172838
More information about the lldb-commits
mailing list