The MSI Upgrade Code is a unique code for managing your application. If this is not specified, you will have to manually reinstall the package with each upgrade.
Run the following command in the Python interpreter.
import uuid str(uuid.uuid3(uuid.NAMESPACE_DNS, 'appname.orgname.org')).upper()
This will generate a unique ID such as '3F2504E0-4F89-11D3-9A0C-0305E82C3301', so make a note of it.
setup.py
#Application information
name = 'memopad'
version = '1.0.0'
author = 'example'
author_email = '[email protected]'
url = 'http://example.xxx'
description = 'Text Editor'
#Specify the GUID here (basically it should not be changed)
upgrade_code = '{3F2504E0-4F89-11D3-9A0C-0305E82C3301}'
#For 64-bit Windows, switch the installation folder
# ProgramFiles(64)Folder seems to be replaced with the actual directory on the msi side
programfiles_dir = 'ProgramFiles64Folder' if distutils.util.get_platform() == 'win-amd64' else 'ProgramFilesFolder'
#Options to use with the build command on Windows
build_exe_options = {
'packages': ['os'],
'excludes': ['tkinter'], #Exclude tkinter as it is not used
'includes': ['PySide.QtCore', 'PySide.QtGui', 'gui', 'commands'],
'include_files': ['img/', 'lang/', 'license/'],
'include_msvcr': True, #Since it uses PySide, it cannot be started unless Microsoft's C runtime is included.
'compressed' : True
}
# bdist_Options to use with the msi command
bdist_msi_options = {
'upgrade_code': upgrade_code,
'add_to_path': False,
'initial_target_dir': '[%s]\%s\%s' % (programfiles_dir, author, name)
}
options = {
'build_exe': build_exe_options,
'bdist_msi': bdist_msi_options
}
#exe information
base = 'Win32GUI' if sys.platform == 'win32' else None
icon = 'img/app_icon.ico'
mainexe = Executable(
'main.py',
targetName = 'Memopad.exe',
base = base,
icon = icon,
copyDependentFiles = True
)
setup(
name=name,
version=version,
author=author,
author_email=author_email,
url=url,
description=description,
options=options,
executables=[mainexe]
)
If you build it as it is, it will not pass the validation check of Orca (Microsoft's MSI editor), so modify'cx_Freeze / windist.py'in site-packages. Add the following tuple to the props list on line 230:
windist.py
('SecureCustomProperties', 'REMOVEOLDVERSION;REMOVENEWVERSION')
python setup.py bdist_msi
Just run.
The exe and msi are created.
Please note that if you change the UpgradeCode, it will not be considered as the same package and you will not be able to manage the package properly.
Also, be aware that you may get a warning during installation without a digital signature.
Open the Orca-generated MSI and look at the Property table. If the GUID specified earlier is displayed in the UpgradeCode property, there should be no problem.
distutils setup script — cx_Freeze 5.0 documentation Developer Course-Windows Installer
Recommended Posts