Aeva/nw-converter

standalone windows exe distribution script

Aeva opened this issue · 3 comments

Aeva commented

Create a script that generates a stand-alone windows exe file for the gui tool, using pyinstaller.

Actionable things:

  • working proof of concept build
  • create some error logging layer
  • only include necessary gir files as binaries
  • create a build batch file
  • windows icon for resulting exe
  • windowless build?
  • some kind of readme explaining the hacks needed to get the build script running >_<
Aeva commented

With some experimentation, I was able to get the gui to run on windows. However, the "pyinstaller" build was not successful. It did complain that it could not find "C:/Python27/share/gir-1.0.", and there is indeed no "share" directory.

The steps I've taken so far were:

  1. install 32bit python 2.7
  2. install pillow
  3. install the "all in one" windows python-gobject" bundle. Make sure that "gtk" is included for install.

From there, you can run the converter_gui.py script from this project, and the basic functionality seems to work ok. I only tested the png exporter, though.

Also note, pillow must be installed from the commandline, via easy_install or pip, so it is definitely necessary to bundle an exe, as I expect most users interested in this would not know how to do this :/

Also note, with the above it takes almost a minute for the program to start O_O wtf

Aeva commented

Some more progress. There is a bug in pyinstaller with regards to the gobject introspection stuff. It can be worked around by copying c:/python27/lib/site-packages/gnome/share to c:/python27/.

Second problem, is that this needs to be built with freeze, so do something like pyinstaller -F converter_gui.py.

The resulting program will still crash, unfortunately. Its hard to get the command output, but I got a screenshot D: The relevant error in the traceback is: gi.RepositoryError: Typelib file for namespace 'GdkPixbuf', version '2.0' not found

Getting warmer :O

Aeva commented

Ok, got it to build after some helter skelter work-arounds:

  • you need to modify your python directory on windows (copy c:/python27/lib/site-packages/gnome/shared to c:/python27/shared)
  • after generating the exe file, you also need to copy the glade file and the svg files into the dist dir, or the exe will crash.