I want to package my Python application using cx_freeze and include an independent third-party application such that the third-party application's folder is located at the installation directory.
The issue is that cx_freeze does not only copy the folder to the installation directory but also collects the DLLs and copies them again to the lib directory. Consequently, the DLLs in the original folder have duplicates in the lib folder.
So far, I've tried adding the folder to options["build_exe"]["include_files"] which results in the described issue and I've tried ignoring the DLLs by including the third-party application folder to options["build_exe"]["bin_path_excludes"] which neither copies the DLLs to the packaged third-party application nor the lib folder.
I was not able to recreate the issue with a minimum working example as I do not know how cx_freeze collects the dependencies, but I included a basic cx_freeze project anyway.
Are there other approaches to include an independent folder in the MSI installer?
Project structure
.
├── main.py # just an empty file
├── setup.py
└── third-party-app
└── mypackage.dll # just an empty file (I've tried with a nonempty file)
setup.py
# setup.py
from cx_Freeze import setup, Executable
includefiles = [("third-party-app", "bin")] # Copy to 'bin' folder
setup(
name="myproject",
options={
"build_exe": {
"include_files": includefiles,
# "bin_path_excludes": "third-party-app" # using this, the DLL is not included at all
}
},
executables=[
Executable(
script="main.py",
base=None,
)
],
)
Requirements
# requirements.txt
cx-Freeze==6.15.5