This what I do and it has been working the las couple of years with
python 2.6 and gtk2:

In the setup.py set the right libraries for pyexe to find the packages:
        
 setup(name='COMYSI Admin',
       # The main script with an icon
       windows = [{'script': 'COMYSIAdmin.pyw',
                   'icon_resources': [(1, 'media/logo_comysi.ico')]}], 
      
       # All the packages that is going to build
       # the relevant for pygtk is [gtk, gtk.keysyms]
       # and don't forget to put the six includes required for gtk.  
       options = {'py2exe' :{'packages': ['comysi', 'comysi.ui', 
                                          'redis', 'num2word', 'gtk',
                                         'gtk.keysyms'],
                            'includes': 'cairo, pango, pangocairo, 
                                         atk, gobject, gio',
                       
                            },
                },
      # end of py2exe options
      # Add subsecuent distutils options.

Now once you have a working setup.py with py2exe and you have
successfully created the `dist` directory with all the requirements, you
need to copy 3 directories from the bundle of gtk for windows, the
relevant folders that you need to copy to your pyexe `dist` directory
are:
   -etc
   -lib
   -share

with this you can add a theme to the application in the share/themes/
and set as default in `etc/gtk-2.0/gtkrc` with one line inside that file
in this form:

gtk-theme-name = "NAME OF THEME"

Most of the content of share/locale/ can be eliminated just pack the
locale that you are interested.

After you have a working `dist` directory, it should be like this:
 dist\
      etc\
      lib\
      share\
      ..*a lot of generated files*..

and you can run the exe right there to check the possible new theme or
just to test it out, but a last step is that you need to package all of
those files to a single installer, I use `Inno setup` for that matter,
this is my working setup file 'setup.iss', which I just need to build it
from `Inno setup`.


[Setup]
AppName=COMYSI Admin
AppVerName=COMYSI Admin 1.5
AppPublisher=Cyrax Software
AppPublisherURL=http://www.cyraxsoft.com
DefaultDirName={pf}\Administración COMYSI
DefaultGroupName=Administración COMYSI
DisableProgramGroupPage=true
OutputBaseFilename=Setup
Compression=lzma
SolidCompression=true
AllowUNCPath=false
VersionInfoVersion=1.5
VersionInfoCompany=CyraxSoftware
VersionInfoDescription=COMYSI Admin

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

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

[Icons]
Name: "{group}\Administrador" ; Filename: {app}\COMYSIAdmin.exe;
WorkingDir: {app}
Name: "{group}\Desinstalar"; Filename: "{uninstallexe}"
Name: "{commondesktop}\Administrador"; Filename: {app}\COMYSIAdmin.exe;
WorkingDir: {app}


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



So the general idea is:
  
   - Run py2exe with the right includes and packages
   - Copy etc,lib,share from the gtk bundle for windows in the dist 
     directory
   - Pack everything with some installer like Inno setup.

Once you have that is very easy to automate the build, you can have a
subset of the required files of the gtk bundle in your project and just
copy them on every pyexe build, at least that what I do.


On Mon, 2011-10-24 at 16:40 +0800, Jason Heeris wrote:
> I'm using Python 2.6 and PyGTK 2.22.6 from the all-in-one installer on
> Windows XP. I'm slowly making progress building a single-file
> executable (via py2exe) for my app, and I've gotten to the point where
> I need to know more about bundling up the GTK resources.
> 
> Specifically, when I run my app as normal (ie. not built into an .exe
> file, just as a loose collection of .py files), it uses the
> native-looking Windows theme, but when I run the built exe I see the
> default GTK theme. I also haven't even considered how my app will fare
> on a "clean" PC (ie. one with no existing Python or GTK installation).
> 
> I have read the FAQ entry for this[1] but it's quite localised and
> probably a bit dated. I know *how* to bundle the resources (the
> "data_files" option to "setup()"), so my starting questions are
> basically:
> 
> 1. Ideally, I'd like to be able to programmatically find the GTK
> runtime rather than hard-coding paths like "C:\GTK\lib", etc (if that
> even is the right path). How do I do this?
> 
> 2. What are the resources I need to include?
> 
> Cheers,
> Jason
> _______________________________________________
> pygtk mailing list   pygtk@daa.com.au
> http://www.daa.com.au/mailman/listinfo/pygtk
> Read the PyGTK FAQ: http://faq.pygtk.org/


_______________________________________________
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/

Reply via email to