1

I am having trouble finding documentation on what are the available options for the bdist_msi command when creating an MSI with a cx_Freeze setup script.

I have seen the following options being used in other SO posts related to this topic:

bdist_msi_options = {'data': '','add_to_path':'','initial_target_dir':'','upgrade_code':'',}

setup(
    options = {
        "bdist_msi": bdist_msi_options,
    },
    executables = [
        Executable(
            "test.py",
            )
        ]
)

The windows installer docs mentions some of the options scattered throughout. The cx_Freeze docs documents two options (including upgrade_code) mentioning that they are available along with the standard set of options. Where can I find this list of standard set of options as mentioned?

kenlukas
  • 3,616
  • 9
  • 25
  • 36
Rahul
  • 177
  • 3
  • 9

1 Answers1

2

You can have a look at the source code in cx_Freeze/windist.py to see a list of the expected options:

class bdist_msi(distutils.command.bdist_msi.bdist_msi):
    user_options = distutils.command.bdist_msi.bdist_msi.user_options + [
        ('add-to-path=', None, 'add target dir to PATH environment variable'),
        ('upgrade-code=', None, 'upgrade code to use'),
        ('initial-target-dir=', None, 'initial target directory'),
        ('target-name=', None, 'name of the file to create'),
        ('directories=', None, 'list of 3-tuples of directories to create'),
        ('environment-variables=', None, 'list of environment variables'),
        ('data=', None, 'dictionary of data indexed by table name'),
        ('product-code=', None, 'product code to use'),
        ('install-icon=', None, 'icon path to add/remove programs ')
    ]

As you see:

  1. cx_Freeze adds more options than mentioned in the documentation
  2. cx_Freeze's bdist_msi class is derived from the homonym class of the standard module distutils, which itself expects the "standard set of options" you mention in your question, which you can read in path_to_python\Lib\distutils\command\bdist_msi.py:
class bdist_msi(Command):

    description = "create a Microsoft Installer (.msi) binary distribution"

    user_options = [('bdist-dir=', None,
                     "temporary directory for creating the distribution"),
                    ('plat-name=', 'p',
                     "platform name to embed in generated filenames "
                     "(default: %s)" % get_platform()),
                    ('keep-temp', 'k',
                     "keep the pseudo-installation tree around after " +
                     "creating the distribution archive"),
                    ('target-version=', None,
                     "require a specific python version" +
                     " on the target system"),
                    ('no-target-compile', 'c',
                     "do not compile .py to .pyc on the target system"),
                    ('no-target-optimize', 'o',
                     "do not compile .py to .pyo (optimized)"
                     "on the target system"),
                    ('dist-dir=', 'd',
                     "directory to put final built distributions in"),
                    ('skip-build', None,
                     "skip rebuilding everything (for testing/debugging)"),
                    ('install-script=', None,
                     "basename of installation script to be run after"
                     "installation or before deinstallation"),
                    ('pre-install-script=', None,
                     "Fully qualified filename of a script to be run before "
                     "any files are installed.  This script need not be in the "
                     "distribution"),
                   ]

You'll have to look at the implementation of these options in the source code to understand how they can be used. You'll notice that some of them are not implemented or only partially.

The data option can be used for example to let the installer add a shortcut on the desktop or in the program menu as described in Use cx-freeze to create an msi that adds a shortcut to the desktop and here.

jpeg
  • 2,372
  • 4
  • 18
  • 31