Uranium
Application Framework
|
The version upgrade feature upgrades configuration from old versions to versions that are compatible with new versions of the application.
To provide support for upgrading from one version to another, the programmer defines a plug-in in the repository of the application with the following constraints:
./plugins/VersionUpgrade/VersionUpgradeXYtoZW
where X
is the major version number of the old version, Y
the minor version number of the old version, Z
the major version number if the new version and W
the minor version number of the new version.__init__.py
file with a getMetaData()
function that returns a dictionary - let's call it METADATA
. This is the same as all other plug-ins.METADATA
dictionary MUST have a "version_upgrade"
field."version_upgrade"
field SHOULD have one entry for each of the configuration types (see below)."version_upgrade"
field MAY NOT have more than one entry for any configuration type."version_upgrade"
MUST have an entry "from"
and an entry "to"
to list the version number of that configuration type which it can upgrade. This version number MUST coincide with the version numbers in the classes corresponding to the configuration types at the appropriate application versions.__init__.py
file MUST define a class for the plug-in via the register(app)
function (like all plug-ins).upgrade<type>()
functions in UM.VersionUpgrade
for the configuration types which it claims to be able to upgrade in METADATA
.upgrade<type>()
functions MUST accept a string in the form of the old version's file and return a string in the form of the new version's file.The configuration types currently supported are:
For each new minor version of Cura in which any of these configuration types incremented their version number, we MUST include a new version upgrade plug-in to update the configuration of the user. With major version increments, we MAY include an additional plug-in that upgrades the configuration in larger increments, for faster processing.
The version upgrade system will:
./old
directory alongside the normal configuration files.Shortcomings of this system are:
configparser
and reading the general/version
key.