I often use cx_freeze to package my python source with all the dependencies and subsequently create a msi installation package through the distutils bdist_msi extension
The only issues happens when I try to reinstall a newly created msi windows installer without uninstalling the previous version. The uninstaller keeps record of all the previously uninstalled version of the software and that blots registry and uninstaller information.
Is it possible to detect a previously installed version of my software and uninstall it automatically without installing a new version?
I am aware of NSIS, and how with its python bindings to create installers, the above issue I mentioned could easily be resolved through it. Unfortunately, at this moment, I am not looking anything beyond what Python provides i.e. distutils.
In cx_Freeze, bdist_msi
has an option upgrade-code
, which the docs describe as:
define the upgrade code for the package that is created; this is used to force removal of any packages created with the same upgrade code prior to the installation of this one
To specify it, I think you'd have to pass it to the setup()
call something like this:
options = {"bdist_msi": {"upgrade-code":"..."}}
(I always forget whether it should be -
or _
in the option names to use them like this, so if that's wrong, try it as upgrade_code
)
Microsoft say that the upgrade code should be a GUID (a randomly generated code).