1
0

README.rst 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. **This example does not currently work**: Pynsist 2 requires Python 3.5 or above,
  2. but PyGI is only available for Python 3.4 at most (as of October 2017).
  3. Hopefully it will be possible again in the future.
  4. This example shows how to package a program that uses the PyGI-bindings of Gtk (or PyGObject).
  5. Python 3.4.3 64-bit will be used together with 64-bit dependencies.
  6. The example program consists of a window with a matplotlib-plot and a button that triggers the window to close.
  7. Requirements
  8. ------------
  9. This example needs 7zip in order to work. You can install it for example on
  10. Debian-style distributions using:
  11. ::
  12. sudo apt-get install p7zip
  13. Building the program
  14. --------------------
  15. A shell script can be used to download the PyGI Windows installer:
  16. ::
  17. sh 1_download.sh
  18. The next script will extract the necessary GTK components into the
  19. ``pynsist_pkgs`` folder.
  20. ::
  21. sh 2_extract.sh
  22. After that, the example can be built using this command:
  23. ::
  24. python3 -m nsist installer.cfg
  25. Installer.cfg
  26. -------------
  27. The example uses 64-bit Python 3.4 and 64-bit dependencies. This is expressed in the
  28. ``installer.cfg``-file like this:
  29. ::
  30. version=3.4.3
  31. bitness=64
  32. 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.
  33. ::
  34. [Include]
  35. packages=gi
  36. cairo
  37. dbus
  38. gnome
  39. pygtkcompat
  40. numpy
  41. matplotlib
  42. six
  43. dateutil
  44. pyparsing
  45. glib-schemas
  46. ------------
  47. 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.
  48. 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:
  49. ::
  50. glib-compile-schemas pynsist_pkgs/gnome/share/glib-2.0/schemas/
  51. 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.
  52. See also:
  53. - https://github.com/takluyver/pynsist/issues/43
  54. - https://sourceforge.net/p/pygobjectwin32/tickets/12/