Differences between revisions 2 and 5 (spanning 3 versions)
Revision 2 as of 2006-04-20 11:24:55
Size: 3031
Editor: proxy-atriu
Comment:
Revision 5 as of 2008-02-29 16:13:14
Size: 3591
Comment:
Deletions are marked like this. Additions are marked like this.
Line 68: Line 68:
Once that's done, you'll need to copy the etc, lib and share directories from your GTK+ install
to the dist dir py2exe created. Optionaly, you can clean the share\locale dir to
include only the locales you need for GTK+. Same thing for share\themes (I left
both Default and MS-Windows).
Once that's done, '''you'll need to copy the etc, lib and share directories from your GTK+ install  (''not'' the pygtk install) to the dist dir py2exe created.''' Optionaly,
you can clean the share\locale dir to include only the locales you need for GTK+. Same thing for
share\themes (I left both Default and MS-Windows).   If you are using kiwi, you will also have to copy the ''contents'' of the (''path to python'')/share/kiwi directory
(and (''path to python'')/share/gazpacho, if you used gazpacho) to the dist dir. And you will have
to create an empty 'kiwi' directory in the dist/pixmaps directory that you just copied there.
(note: I have not tested kiwi with the Innosetup installer, but if you try it and it works edit
this page and remove this note :) )
Line 114: Line 120:
  * [http://www.async.com.br/projects/kiwi/ kiwi 1.9.20] ''optional''

create your handytool.py:

import sys
import pygtk
if not sys.platform == 'win32':
    pygtk.require('2.0')
import gtk

from mainwindow import MainWindow

if __name__ == '__main__':
    # enable threading
    gtk.threads_init()
    gtk.threads_enter()

    # create the main window
    myapp = MainWindow()

    # start the program loop
    gtk.main()

    # cleanup
    gtk.threads_leave()

create your setup.py file:

from distutils.core import setup
import py2exe

setup(
    name = 'handytool',
    description = 'Some handy tool',
    version = '1.0',

    windows = [
                  {
                      'script': 'handytool.py',
                      'icon_resources': [(1, "handytool.ico")],
                  }
              ],

    options = {
                  'py2exe': {
                      'packages':'encodings',
                      'includes': 'cairo, pango, pangocairo, atk, gobject',
                  }
              },

    data_files=[
                   'handytool.glade',
                   'readme.txt'
               ]
)

run setup.py py2exe. You'll get a warning:

The following modules appear to be missing
['gdk', 'ltihooks']

Ignore it ;)

Once that's done, you'll need to copy the etc, lib and share directories from your GTK+ install (not the pygtk install) to the dist dir py2exe created. Optionaly, you can clean the share\locale dir to include only the locales you need for GTK+. Same thing for share\themes (I left both Default and MS-Windows).

If you are using kiwi, you will also have to copy the contents of the (path to python)/share/kiwi directory (and (path to python)/share/gazpacho, if you used gazpacho) to the dist dir. And you will have to create an empty 'kiwi' directory in the dist/pixmaps directory that you just copied there. (note: I have not tested kiwi with the Innosetup installer, but if you try it and it works edit this page and remove this note :) )

Note you'll want to set the working directory (Start in:) for any shortcut you create to the application directory containing the executable.

(Optional) an Innosetup .iss file to create an installer for handytool:

[Setup]
AppName=handytool
AppVerName=handytool 1.0
AppPublisher=me
AppPublisherURL=http://www.localhost.me
DefaultDirName={pf}\handytool
DefaultGroupName=handytool
DisableProgramGroupPage=true
OutputBaseFilename=setup
Compression=lzma
SolidCompression=true
AllowUNCPath=false
VersionInfoVersion=1.0
VersionInfoCompany=me inc
VersionInfoDescription=handytool
PrivilegeRequired=admin

[Dirs]
Name: {app}; Flags: uninsalwaysuninstall;

[Files]
Source: dist\*; DestDir: {app}; Flags: ignoreversion recursesubdirs createallsubdirs

[Icons]
Name: {group}\handytool; Filename: {app}\handytool.exe; WorkingDir: {app}

[Run]
Filename: {app}\handytool.exe; Description: {cm:LaunchProgram,handytool}; Flags: nowait postinstall skipifsilent

This Recipe has been tested with:

Py2exeAndPyGTK (last edited 2012-10-05 04:21:07 by 24-217-160-200)