eric6/Globals/__init__.py

changeset 8240
93b8a353c4bf
parent 8126
e7278bf7168f
child 8243
cc717c2ae956
equal deleted inserted replaced
8239:59a9a658618c 8240:93b8a353c4bf
13 13
14 import sys 14 import sys
15 import os 15 import os
16 import re 16 import re
17 import shutil 17 import shutil
18 import contextlib
18 19
19 from PyQt5.QtCore import ( 20 from PyQt5.QtCore import (
20 QDir, QByteArray, QCoreApplication, QT_VERSION, QProcess, qVersion 21 QDir, QByteArray, QCoreApplication, QT_VERSION, QProcess, qVersion
21 ) 22 )
22 23
370 versionParts = [] 371 versionParts = []
371 372
372 # step 1: extract suffix 373 # step 1: extract suffix
373 version = re.split(r"[^\d.]", version)[0] 374 version = re.split(r"[^\d.]", version)[0]
374 for part in version.split("."): 375 for part in version.split("."):
375 try: 376 with contextlib.suppress(ValueError):
376 versionParts.append(int(part.strip())) 377 versionParts.append(int(part.strip()))
377 except ValueError:
378 # skip non-integer parts
379 pass
380 versionParts.extend([0] * length) 378 versionParts.extend([0] * length)
381 379
382 return tuple(versionParts[:length]) 380 return tuple(versionParts[:length])
383 381
384 382

eric ide

mercurial