- Large amount of Windows environment Python application wrapping
- Misleading and lack of example of cxfreeze API
But thanks for Stackoverflow, I finally get the solution despite various failure on different problems during the wrapping of my wxPython application.
Here is my situation
I have written a wxpython program, and the program consist of not only .py files but with images and xml files, I want to
- Wrap all these stuffs to one executable program in Ubuntu
- Deploy this program with deb installer
Solutions
- Download and install cxfreeze
- Please let me know but I cannot find relative commands on how to include external files, therefore I use the officially provided py script
http://cx-freeze.readthedocs.org/en/latest/script.html - Follow the below official guide and write the setup script to build the program
http://cx-freeze.readthedocs.org/en/latest/distutils.html - Run python setup.py build and your program will be built
- Follow the file structure to build the deb
- mpstoolbox is the app name, name your own one
- DEBIAN/control, DEBIAN/postinst is files to configure the deb package
- usr/bin/..., this is the installed path, you should make your own path, all the files installed will follow this path structure
- Finally, cd back to the folder (your app name), use dpkg -b yourAppName
- A deb package will be generated
- Use dpkg -i to install
Here comes the MOST important part, my problem
It seems simple to follow the above to build the program, but indeed it doesn't, the guide does not teach you clearly on how to include the required modules to let you bring your program to other Linux machine to run, you need to follow the followings
- binpathincludes parameter is important, please include all system library like /usr/lib, /usr/local/lib, or you may encounter this error libwx_gtk2u import error, ImportError: libwx_gtk2u_adv-2.8 etc. This is deal to the missing of wxPython library, you therefore need to include all required system library when building the app
- About the setup.py, the api is not very clear in cxfreeze, follow stackoverflow's guide, thanks to the bro there, he also suffered from the lack of clearance of the api
http://stackoverflow.com/questions/15486292/cx-freeze-doesnt-find-all-dependencies
One thing here to pay attention to, the "include_files" attribute should be a list of tuples instead of single name only!! Your external files and other required images should also put it here.
- Finally, the following are the sample files
DEBIAN control, postint file programming tutorial
http://www.leaseweblabs.com/2013/06/creating-custom-debian-packages/
Basically, the postint script is just like the bash script you normally write, follow the rules used in bash and it will be run after install
DEBIAN control file format
https://drive.google.com/file/d/0BzjkM5qIfmJmTGNuRkxKamZtaWc/view?usp=sharing
cxfreeze setup.py format
https://drive.google.com/file/d/0BzjkM5qIfmJmWTRLOHdXVU9rdFE/view?usp=sharing
Making the desktop shortcut
http://stackoverflow.com/questions/30185505/running-a-packaged-python-program-in-ubuntu

沒有留言:
張貼留言