distutils/package installers on windows

David Bolen db3l at fitlinxx.com
Mon Feb 18 19:45:46 CET 2002

sameer_ at email.com (sameer) writes:

> sameer_ at email.com (sameer) wrote in message news:<6bd9f01b.0202160255.77244c9e at posting.google.com>...
> > Here's the situation:
> > I have a python package (or two) to be installed on a windows machine
> > (for now) which has python installed.  I am using distutils to create
> > a windows installer which installs my python packages just fine.  Now,
> > I want to also create some shortcuts on the Desktop as well as the
> > Start Menu.  As of now, distutils doesn't allow me to do either of
> > those things.  What are my options here to do either or both of these
> > things.  Can the distutils package be modified easily to provide this
> > kind of support on windows?  Or is there another python package
> > available that would allow me to create the desktop and Start Menu
> > shortcuts?
> it's a pity no one has replied.  I suppose there are no sane options for this.

It might help if you at least waited through a weekend for responses
before declaring failure :-)

Although I do expect there's no trivial solution at the moment -
whether or not that consititutes "sane" is another question.

The binary portion of the windows specific installer is hardcoded into
the distutils package (encoded in the bdist_wininst.py module), and it
doesn't appear that source is available (at least I can't seem to find
it even in the CVS tree) so changing how it behaves doesn't seem easy.
You could replace it outright, but then you'd have to duplicate its
existing functionality as well.

What you might try doing in this case is combining the distutil output
with one of the free Windows installers (like InnoSetup) which do have
plenty of capabilities for handling the additional duties.  The tricky
part of this is knowing the installation location since the distutils
installer is picking that.

You could wrap an InnoSetup install around the existing executable
from distutils (running that as one of the components in a InnoSetup
install), but then you wouldn't necessarily know where to create the
shortcut to.  Perhaps better would be using a simpler output from
distutils (say a simple tar or zip package) to gather the necessary
files, and then incorporate them directly into an InnoSetup install.

It doesn't look like distutils has a simple collect method to gather
the files into a directory tree without using an archive like tar/zip,
but worst case is you unpack the created archive to provide individual
file input to InnoSetup.  You'd need to do some work in InnoSetup to
locate the existing Python installation (if you didn't want the user
to have to manually enter it), but you can access registry keys in the
setup script (or worst case use the InnoSetup Extensions version with

Having some additional hooks created in distutils to execute
post-installation sounds like it could be a useful enhancement.  At
least with that sort of scenario you could write your own shortcut
creating code without modifying the core distutils itself.

-- 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