README.rst 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. This example shows how to package a program that uses the PyGI-bindings of Gtk (or PyGObject). Python 3.4.3 64-bit will be used together with 64-bit dependencies.
  2. The example program conists of a window with a matplotlib-plot and a button that triggers the window to close.
  3. Requirements
  4. ------------
  5. This example needs 7zip in order to work. You can install it for example on
  6. Debian-style distributions using:
  7. ::
  8. sudo apt-get install p7zip
  9. Building the program
  10. --------------------
  11. A shell script can be used to download some of the dependencies:
  12. ::
  13. sh 1_download.sh
  14. The numpy 64-bit wheel can be downloaded here (numpy‑1.9.2+mkl‑cp34‑none‑win_amd64.whl):
  15. http://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy
  16. Rename it to numpy.whl before starting the second script.
  17. The next script will copy all the dependencies into the ``pynsist_pkgs`` folder.
  18. ::
  19. sh 2_extract.sh
  20. After that, the example can be built using this command:
  21. ::
  22. python3 -m nsist installer.cfg
  23. Installer.cfg
  24. -------------
  25. The example uses 64-bit Python 3.4 and 64-bit dependencies. This is expressed in the
  26. ``installer.cfg``-file like this:
  27. ::
  28. version=3.4.3
  29. bitness=64
  30. The include section requires the Python packages numpy, matplotlib (which are taken from the ``pynsist_pkgs`` folder). In addition the packages six, dateutil and pyparsing are required. From the pygi-bindings the top level packages cairo, dbus, gi, gnome and pygtkcompat have to be listed here (They are also in the top level of the ``pynsist_pkgs`` directory). The ``gnome``-folder contains the dependencies ATK, Base, GDK, GDKPixbuf, GTK, JPEG, Pango, WebP and TIFF.
  31. ::
  32. [Include]
  33. packages=gi
  34. cairo
  35. dbus
  36. gnome
  37. pygtkcompat
  38. numpy
  39. matplotlib
  40. six
  41. dateutil
  42. pyparsing
  43. glib-schemas
  44. ------------
  45. When the pygi-aio bundle is installed on a Windows-machine, the installer performs some post-installation compiling steps. After extracting the libraries from the bundle, compiling can be carried out on Linux, as long as the operating system used for packaging and the targeted operating system have the same bitness. For different bitnesses, use a virtual machine with desired bitness, install the bundle, and copy the compiled files back into your build directory.
  46. An example are the glib-schemas which are required for the GtkFileChooserDialog to work properly. The script ``2_extract.sh`` will automatically call the following command to compile the glib-schemas:
  47. ::
  48. glib-compile-schemas pynsist_pkgs/gnome/share/glib-2.0/schemas/
  49. Note: If your application uses glib-schemas (e.g. default-settings stored in gsettings) you will need to place the schemas for your application into that folder and recompile it before packaging it with Pynsist.
  50. See also:
  51. - https://github.com/takluyver/pynsist/issues/43
  52. - https://sourceforge.net/p/pygobjectwin32/tickets/12/