1

I am using cx_Freeze to compile a python script into a .msi install file. Upon reading this very helpful thread, I have been able to generate a shortcut to the compiled exe program during the install process. Additionally, I would like to display some kind of message to the user during the installation process. Is it possible to configure cx_Freeze accordingly? If not, how else could one go about it?

The relevant (simplified) bit of my code is:

from cx_Freeze import setup, Executable

options = {'optimize': 2}
executables = [Executable('program.py', base='Win32GUI', targetName='program.exe',
                          shortcutName='program', shortcutDir='ProgramMenuFolder')]
  
setup(name='program', options=options, executables=executables)
jpeg
  • 2,372
  • 4
  • 18
  • 31

1 Answers1

1

The command

python path_to_setup_script.py bdist_msi

used to let cx_Freeze create a .msi installer can be customized using corresponding bdist_msi options in the setup() call:

setup(..., options={..., 'bdist_msi': bdist_msi_options, ...}, ...)

See the corresponding section of the cx_Freeze documentation for a list of the available options with an example, and also Available bdist_msi options when creating MSI with cx_Freeze.

In particular, the data option can be used to add new data to the MSI installer database tables. For example, a Shortcut table can be added to let the installer create a desktop shortcut as described in the thread you've already linked, Use cx-freeze to create an msi that adds a shortcut to the desktop, or a program menu shortcut as described here. Further examples are sketched here.

But, if you need to modify tables already defined in the cx_Freeze code, which is probably the case if you want to modify the text of existing dialogs, you'll probably need to overload this code. In this case, it is probably easier to let cx_Freeze create an executable only (build command) and to use an additional tool, such as for example the script-based tool NSIS (Nullsoft Scriptable Install System), to generate a more customizable installer afterwards.

jpeg
  • 2,372
  • 4
  • 18
  • 31