Writing a win32 installer in Python?

David Bolen db3l at fitlinxx.com
Mon Sep 25 18:24:18 CEST 2000

jpl at remotejava.NOSPAM.com (Jan Ploski) writes:

> This is certainly a very newbie-ish question, but is it possible to write
> code in Python and then compile it into a win32 executable?

It's not really compiling, but you can use Gordan McMillan's installer
package (at http://www.mcmillan-inc.com/install1.html).

This automatically tracks down the various dependencies of your script
and puts it all together (along with some very nice archive formats
for the various library routines) into an executable that can be run
directly.  You generally end up with the exe, a pyz for python library
files a few standlone files (like exceptions.pyc) and any external
modules (dll/pyd).  That collection of files is all you need to run
your application.

The installer package has a simple installation script (console based
- prompts for a directory and unpacks), but you can combine the
installer with a Windows installation package.  That can be
InstallShield, Wise, or for my purposes, I use the free Inno Setup
(http://www.jrsoftware.org), and you end up with your Python
application looking just like a native installed Windows application,
and being totally self-contained within its installation directory.
Users install/uninstall it just like any other Windows application.

> Specifically, I would like to know whether it makes sense to try to write
> a custom installer in Python for a Java application (some file copying,
> extraction, and manipulation of the Windows registry is needed). I would not
> like to buy nor learn Visual C++ for that purpose. Buying a shrink-wrapped
> installer like InstallAnywhere is an alternative, but I am curious if Python
> could come to rescue. If that's completely unrealistic (i.e. a 5 MB Python
> interpreter needed to get started), let me know. I have no idea.

I'd probably go with an established solution (which doesn't have to
mean commercial) if it were me.  Not because Python couldn't do it -
I'm sure you could - but because there can be a lot of messiness with
Windows installations (locked files, DLL registration, etc...).  Also,
while it wouldn't be 5MB, any Python installation tool would certainly
take at least the 500-600K of the Python DLL and whatever extensions
(such as the win32 registry module) you used.  That contrasts with
about 275K for Inno Setup, for example.  Not much of an issue with
network based installs, but could hurt on a diskette setup.

-- David
 \               David Bolen            \   E-mail: db3l at fitlinxx.com  /
  |             FitLinxx, Inc.            \  Phone: (203) 708-5192    |
 /  860 Canal Street, Stamford, CT  06902   \  Fax: (203) 316-5150     \

More information about the Python-list mailing list