From f556b7fa6151de3c4ab0b2bd2aa146068e2d72ac Mon Sep 17 00:00:00 2001 From: Yorik van Havre Date: Mon, 1 Jul 2024 13:41:25 +0200 Subject: [PATCH] BIM: Fixed ifcopenshell version detection --- src/Mod/BIM/nativeifc/ifc_openshell.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/Mod/BIM/nativeifc/ifc_openshell.py b/src/Mod/BIM/nativeifc/ifc_openshell.py index 215558afe4..3a328d1bc9 100644 --- a/src/Mod/BIM/nativeifc/ifc_openshell.py +++ b/src/Mod/BIM/nativeifc/ifc_openshell.py @@ -149,19 +149,20 @@ class IFC_UpdateIOS: def compare_versions(self, v1, v2): - """Compare two version strings in the form '0.7.0' """ + """Compare two version strings in the form '0.7.0' or v0.7.0""" # code from https://www.geeksforgeeks.org/compare-two-version-numbers - arr1 = v1.split(".") - arr2 = v2.split(".") + + arr1 = v1.replace("v","").split(".") + arr2 = v2.replace("v","").split(".") n = len(arr1) m = len(arr2) arr1 = [int(i) for i in arr1] arr2 = [int(i) for i in arr2] - if n>m: + if n > m: for i in range(m, n): arr2.append(0) - elif m>n: + elif m > n: for i in range(n, m): arr1.append(0) for i in range(len(arr1)):