Difference between revisions of "Create an .exe file from the TASTE GUI for Windows sources"
m (1 revision imported) |
|
(No difference)
|
Latest revision as of 21:01, 4 August 2017
Requirements
There are lots of alternatives to package a python script to a stand-alone executable. For example: PyInstaller, py2exe, cx_Freeze all offer cross-platform solutions.
To package the Windows TASTE GUI, which uses PySide bindings for Qt to a stand-alone .exe file PyInstaller is used.
The following packages are needed:
- Python interpreter for Windows, Python 2.7.3 Windows Installer. Available from http://www.python.org/download.
- Pyside Binaries for Windows. Available from http://qt-project.org/wiki/PySide_Binaries_Windows. Make sure you download and install the version that matches your Qt library version and your Python interpreter version.
- setuptools. Available from http://pypi.python.org/pypi/setuptools.
- Python for Windows extensions (PyWin32) only if you are using python 2.6 or above. Available from: http://sourceforge.net/projects/pywin32.
All five tools should be installed following the order in which the are presented. These tools can be easily installed as they are bundled as executables.
Finally, you will also need the TASTE GUI python sources to build the executable. In order to get the sources you need an SVN client for windows (Download and install slik subversion).
How to
Download the PyInstaller zip file from http://www.pyinstaller.org/.
Next, extract the directory of the zip file. Then, press Shift + right mouse button in the directory and select Open command window here.
Download the taste GUI code:
C:\PyInstaller>svn export https://tecsvn.estec.esa.int/svn/taste/trunk/misc/experiments/win-gui-draft/tags/debug_release/ tasteGUI
Note: To ease the procedure make sure to add your Python install path to your PATH variable. E.g.: On a Windows 7 machine go to Control Panel\System, on the left pane click on Advanced system settings, then click the Environment Variables... button, select the PATH variable and click the Edit... button. Now add your Python install path at the end of Variable value:. If you installed python in C:\Python27 Variable value: should look something like this:
C:\Whatever\dirs\before;C:\Python27
Type the following to configure the PyInstaller setup:
C:\PyInstaller> python Configure.py
This will only have to be run once unless you change your python version.
Next, create a spec file for the project:
C:\PyInstaller> python Makespec.py -w --icon=tasteGUI\images\logo-taste-48.ico tasteGUI\tasteGUI.py
This command will create a spec file tasteGUI\tasteGUI.spec that will produce a single directory deployment (use the -F to deploy a single file) that uses the Windows subsystem executable (-w) and uses the icon specified.
Finally, build the project to a stand-alone executable:
C:\PyInstaller> python Build.py tasteGUI\tasteGUI.spec
The final generated directory will be placed in the dist directory under .\tasteGUI.
Note: If you want to generate the executable and associated *.dlls with the minimum size possible download UPX from http://upx.sourceforge.net/, install it and make sure you add it to your path before you run configure the PyInstaller setup. Then, add the -X option when generating the spec file:
C:\PyInstaller> python Makespec.py -X -w --icon=tasteGUI\images\logo-taste-48.ico tasteGUI\tasteGUI.py
Next step is to extract Ellidiss tools to .\tasteGUI\dist\tasteGUI and rename the TASTE-win32 directory to taste. Then you need to copy ocarina_components.aadl file to the taste directory. For now, the way to get ocarina_components.aadl would be by copying it from the TASTE virtual machine from the path:
/home/assert/tool-inst/share/ocarina/AADLv2/ocarina_components.aadl
Finally, create a directory called doc and place there the taste documentation in .pdf format as taste-documentation-current.pdf (http://download.tuxfamily.org/taste/snapshots/doc/taste-documentation-current.pdf).
Now the .\tasteGUI\dist\tasteGUI folder can by compressed and distributed or an installer can be created (Create an installer for TASTE GUI for Windows).