MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / VersionCmp

Function VersionCmp

tools/utils.py:250–274  ·  view source on GitHub ↗
(ver1, ver2)

Source from the content-addressed store, hash-verified

248 return proj
249
250def VersionCmp(ver1, ver2):
251 la=[]
252 if ver1:
253 la = re.split("[. ]", ver1)
254 lb = re.split("[. ]", ver2)
255
256 f = 0
257 if len(la) > len(lb):
258 f = len(la)
259 else:
260 f = len(lb)
261 for i in range(f):
262 try:
263 if int(la[i]) > int(lb[i]):
264 return 1
265 elif int(la[i]) == int(lb[i]):
266 continue
267 else:
268 return -1
269 except (IndexError, ValueError) as e:
270 if len(la) > len(lb):
271 return 1
272 else:
273 return -1
274 return 0
275
276def GCCC99Patch(cflags):
277 import building

Callers 1

GCCC99PatchFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected