MCPcopy Create free account
hub / github.com/WasmEdge/WasmEdge / VersionString

Class VersionString

utils/install.py:232–278  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

230
231
232class VersionString:
233 def __init__(self, version):
234 self.version = version
235
236 def __str__(self):
237 return self.version
238
239 def __repr__(self):
240 return "VersionString:" + self.version
241
242 def _preprocess(self, v, separator, ignorecase):
243 if ignorecase:
244 v = v.lower()
245 return [
246 (
247 int(x)
248 if x.isdigit()
249 else [
250 int(y) if y.isdigit() else y for y in re.findall("\d+|[a-zA-Z]+", x)
251 ]
252 )
253 for x in re.split(separator, v)
254 ]
255
256 def compare(self, version2, separator=". |-", ignorecase=True):
257 """
258 # return 1 if self.version > version2
259 # return 0 if self.version == version2
260 # return -1 if self.version < version2
261 # return False if not comparable
262 """
263 if "rc" in self.version and not "rc" in version2:
264 a = self._preprocess(
265 self.version.split("rc")[0].strip("-"), separator, ignorecase
266 )
267 b = b = self._preprocess(version2, separator, ignorecase)
268 if ((a > b) - (a < b)) == 0:
269 return -1
270 else:
271 return (a > b) - (a < b)
272 else:
273 a = self._preprocess(self.version, separator, ignorecase)
274 b = self._preprocess(version2, separator, ignorecase)
275 try:
276 return (a > b) - (a < b)
277 except:
278 return False
279
280
281SUPPORTED_PLATFORM_MACHINE = {

Callers 5

install.pyFile · 0.85
install_pluginsFunction · 0.85
set_constsFunction · 0.85
__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected