Track cfg version numbers with major-minor, sorta

We now have a (format) version and a setting version. Ideally we'd like major-minor version numbers in our profiles. However, introducing major-minor version numbers requires substantial changes to the version upgrade manager to compare version numbers, find a path towards the current version, or even keeping track of the current version. Therefore we just collapse the two version numbers into one: Multiply the major version number by a million and you'll never exceed it in the minor versioning. The only problem is that we now have to update the versioning for all of our three upgrade plug-ins, because they all need to know locally how to find the version number of their file types (because the upgrade manager has no knowledge of the file types) and they have no access to each other because a plug-in may be disabled.

Contributes to issue CURA-3427.
This commit is contained in:
Ghostkeeper 2017-05-11 17:31:37 +02:00
parent 639e86ca59
commit 0a84a181c4
No known key found for this signature in database
GPG key ID: C5F96EE2BC0F7E75
6 changed files with 22 additions and 16 deletions

View file

@ -144,4 +144,6 @@ class VersionUpgrade22to24(VersionUpgrade):
def getCfgVersion(self, serialised):
parser = configparser.ConfigParser(interpolation = None)
parser.read_string(serialised)
return int(parser.get("general", "version")) #Explicitly give an exception when this fails. That means that the file format is not recognised.
format_version = int(parser.get("general", "version")) #Explicitly give an exception when this fails. That means that the file format is not recognised.
setting_version = int(parser.get("general", "version", fallback = 0))
return format_version * 1000000 + setting_version