Skip to content

Commit

Permalink
Be more tolerant to string in VERSION file
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
dwrobel committed Dec 11, 2023
1 parent cac8b1b commit ec1acd8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions share/qtvcp/screens/qtplasmac/qtplasmac_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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):
Expand Down

0 comments on commit ec1acd8

Please sign in to comment.