From ec1acd8a06186f60070947071986d18b8c11d7ef Mon Sep 17 00:00:00 2001 From: Damian Wrobel Date: Mon, 11 Dec 2023 11:05:39 +0100 Subject: [PATCH] Be more tolerant to string in VERSION file When the string in VERSION file contains date and git sha like the following: 2.10.0-0.96.20231128git2217582.fc38.src.rpm then qtplasma refuses to work as it is unnable to properly find 'major' and 'minor' components from the version string. So let's parse the string from left where we always expect 'major' and 'minor' to be located. Signed-off-by: Damian Wrobel --- share/qtvcp/screens/qtplasmac/qtplasmac_handler.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/share/qtvcp/screens/qtplasmac/qtplasmac_handler.py b/share/qtvcp/screens/qtplasmac/qtplasmac_handler.py index 3bc64087022..9c7d63f944a 100644 --- a/share/qtvcp/screens/qtplasmac/qtplasmac_handler.py +++ b/share/qtvcp/screens/qtplasmac/qtplasmac_handler.py @@ -130,7 +130,7 @@ def __init__(self, halcomp, widgets, paths): if os.path.realpath(m190Path) != os.path.realpath(self.PATHS.CONFIGPATH): COPY(os.path.join(m190Path, 'M190'), os.path.join(self.PATHS.CONFIGPATH, 'M190')) self.machineName = self.iniFile.find('EMC', 'MACHINE') - self.machineTitle = f'{self.machineName} - QtPlasmaC v{LCNCVER}-{VERSION}, powered by QtVCP and LinuxCNC' + self.machineTitle = f'{self.machineName} - QtPlasmaC v{LCNCVER}-{VERSION}, powered by QtVCP and LinuxCNC v{linuxcnc.version}' self.prefsFile = os.path.join(self.PATHS.CONFIGPATH, self.machineName + '.prefs') self.materialFile = os.path.join(self.PATHS.CONFIGPATH, self.machineName + '_material.cfg') self.unitsPerMm = 1 @@ -327,10 +327,10 @@ def __init__(self, halcomp, widgets, paths): # called by qtvcp.py def initialized__(self): - if linuxcnc.version.rsplit('.', 1)[0] != LCNCVER: + if '.'.join(linuxcnc.version.split('.')[:2]) != LCNCVER: msg0 = _translate('HandlerClass', 'LinuxCNC version should be') msg1 = _translate('HandlerClass', 'The detected version is') - STATUS.emit('error', linuxcnc.OPERATOR_ERROR, f'{msg0} {LCNCVER}\n{msg1} {linuxcnc.version.rsplit(".", 1)[0]}') + STATUS.emit('error', linuxcnc.OPERATOR_ERROR, f'{msg0} {LCNCVER}\n{msg1} {linuxcnc.version.split(".")[:2]}') quit() ucFile = os.path.join(self.PATHS.CONFIGPATH, 'qtplasmac_custom.py') if os.path.isfile(ucFile):