1

I'm trying to get my build-process to build from a non-standard build directory. Project stored in c:\users\user\onedrive\dev\project. And these are my build-options in setup.py:

build_options = {
    'packages': ["pyfiglet"],
    'excludes': ["scipy", "PIL", "tkinter", "test"],
    # use this temp dir, so onedrive does not go crazy and lock files!
    'build_exe': f"c:/Temp/{DESCRIPTION.replace(' ','_')}-build", 
}

But now I struggle to define the bdist_msi_options block:

bdist_msi_options = {
    'upgrade_code': '{1}',
    'add_to_path': False,
    'install_icon': 'icon.ico',
    'skip_build': True, # so I can sign the exe before MSI'ing
    'initial_target_dir': r'[ProgramFilesFolder]\{0}\{1}'.format(
        COMPANY, DESCRIPTION),
}

I don't see any option to define that the MSI-build would take the pre-built .exe from c:\temp\.

And finally the main():

executables = [
    Executable(
        SCRIPT_FILE, # something.py
        base='Console',
        target_name=OUT_FILENAME,
        copyright=COPYRIGHT,
        icon="icon.ico",
        shortcut_name=DESCRIPTION,
        shortcut_dir="DesktopFolder",
    )
]

setup(name='HeightStorage',
      version=cfg.version,
      description=LONG_DESCRIPTION,
      options={
          'build_exe': build_options,
          'bdist_msi': bdist_msi_options,
      },
      executables=executables)

Any hints are appreciated.

jpeg
  • 2,372
  • 4
  • 18
  • 31
gilu
  • 197
  • 2
  • 9
  • Does [this answer](https://stackoverflow.com/a/57254132/8516269) help you? There is an option `bdist_dir` which might be what you are looking for. – jpeg May 20 '22 at 12:46
  • @jpeg, no unfortunately not. I've read that post before. But cx_freeze returns `error: error in setup script: command 'bdist_msi' has no such option 'bdist-dir'`. Also, no mention of 'bdist-dir' in the documentation: https://cx-freeze.readthedocs.io/en/6.4/search.html?q=bdist-dir&check_keywords=yes&area=default. – gilu May 20 '22 at 13:02
  • And, I just don't know how to implement these options... :-\ – gilu May 20 '22 at 13:08
  • 1
    Have you tried with `'bdist_dir'` (with underscore instead of hyphen)? I used to use this option with an earlier version of cx_Freeze, probably 5.1.1. – jpeg May 20 '22 at 13:41

1 Answers1

1

Try to set the build directory in the build options as well and to use the bdist_dir option of the bdist_msi options:

build_dir = f"c:/Temp/{DESCRIPTION.replace(' ','_')}-build"  # or whatever you like
bdist_dir = build_dir  # define here a new directory if you want to keep build_dir
build_options = {
    ...
    'build_exe': build_dir,
}
bdist_msi_options = {
    ...
    'bdist_dir': bdist_dir,    
}
setup(
    ...
    options={
        'build': {'build_exe': build_dir},
        'build_exe': build_options,
        'bdist_msi': bdist_msi_options,
    },
    ...
}
jpeg
  • 2,372
  • 4
  • 18
  • 31