I am using cx_freeze to deploy my application. I would like to include a entire directory since including individual files doesn't put them in a folder. How can I include a folder?
Asked
Active
Viewed 2.1k times
1 Answers
34
You have to set up an include files argument for the building options. You can do this in different ways, but I will show a part of my configuration. The thing I describe here is for one specific file and one specific destination. I think you can also set a path like this, but I don't have tested this yet.
Edit: Tested this, so choose the right approach for your project.
buildOptions = dict(include_files = [(absolute_path_to_your_file,'final_filename')]) #single file, absolute path.
buildOptions = dict(include_files = ['your_folder/']) #folder,relative path. Use tuple like in the single file to set a absolute path.
setup(
name = "appname",
version = "1.0",
description = "description",
author = "your name",
options = dict(build_exe = buildOptions),
executables = executables)
Take also a look at this topic. It adressed propably the same question: How can i bundle other files when using cx_freeze?
-
I don't see how to set a path? – PascalVKooten Mar 29 '13 at 19:36
-
2You have to replace the absolute_path_to_your_file to the destination of your source file which you want to include. An absolute path is mostly something like this: "C://your_folder/a_subfolder" on a Windows based system. – Ecno92 Mar 30 '13 at 17:58
-
Do you know of any way to include whole folders? – PascalVKooten Mar 30 '13 at 19:47
-
5I've just tested this for you and its really easy. I will demonstrate this with an relative path. So my folder "testfolder" is in the project folder. use --> include_files = ['testfolder/'], -- and it will work. Now my testfolder including all files in it gets included into the build. You can also do this with in absolute path, but remind that you need to use a tuple for this instead of specifiying a relative path. As you can see this is the working solution to the original answer. – Ecno92 Mar 31 '13 at 11:21