Xantium
Xantium

Reputation: 11605

Adding cx_Freeze msi to path

I have an msi and when installed I want it to add the exe to path.

I have found this:

add_to_path add the target directory to the PATH environment variable; the default value is True if there are any console based executables and False otherwise

From the documentation.

I have tried adding this to the setup script:

setup(  name = "cabbage",
        version = "0.1",
        description = "just a vegetable",
        add_to_path = True, # <-- Just here
        options = {"build_exe": build_exe_options},
        executables = [Executable("spam.py", base=base)])

This returns:

UserWarning: Unknown distribution option: 'add_to_path'

I also tried from the command line:

C:\Users\Simon\Desktop>python setup.py bdist_msi add_to_path=True
invalid command name 'add_to_path=True'

How do I add this option?

Upvotes: 0

Views: 752

Answers (1)

Humsawani
Humsawani

Reputation: 26

Add below lines in your setup.py script to make it work.

  if 'bdist_msi' in sys.argv:

        sys.argv += ['--add-to-path', 'True']

Your code should look like:

 if 'bdist_msi' in sys.argv:

        sys.argv += ['--add-to-path', 'True']


 setup(  name = "cabbage",
    version = "0.1",
    description = "just a vegetable",
    add_to_path = True, # <-- Just here
    options = {"build_exe": build_exe_options},
    executables = [Executable("spam.py", base=base)])

Run command: python setup.py bdist_msi

Upvotes: 1

Related Questions