Windows distribution suggestions?

dave.brueck at gmail.com dave.brueck at gmail.com
Tue May 17 10:22:39 EDT 2005


>> One tip: make sure your three top-level scripts are as empty as
>> possible: just import some other module and call a function. All
>> your active code is then in some library.zip shared between the
>> three, and you need never change alice.exe, bob.exe, and carol.exe
>
> I think I understand what you're saying and it sounds like a very
> good idea.  Thanks.

To elaborate, this approach has worked well for me when I've needed to
release multiple .exe's together:

First make a "dispatching" module like this (call it run.py)

if __name__ == '__main__':
  app = sys.argv[0].lower()
  if app.find('alice') != -1:
    import alice
    alice.main()
  elif app.find('bob') != -1:
    import bob
    bob.main()
  etc...

Next, use py2exe to create an executable for run.py, and then copy
run.exe to alice.exe, bob.exe, and carol.exe (the resulting .exe's will
be very small). The reasoning behind this is that this way only one
copy of all the DLLs, Python std library, and so forth need to be
included in your release.

And to second everyone else's suggestions: NSIS and InnoSetup are
great, free, and powerful. They have all the features you need to
automatically copy your files to the "proper" location on disk, create
desktop icons, and create an uninstaller entry - you'll just write a
small installation script telling what features you'd like to take
advantage of, but they figure out all the details and combine your
application files into a standalone installer (your app.exe).

It'll take a little work to get this all straightened out the first
time, but after that you can have a single build/release script so it's
painless from then on.

And for updates: the least problematic approach is to just release the
whole thing each time. IIRC, InnoSetup (and probably NSIS) include a
feature where you can detect if your app is running when the user tries
to install an update and you can prompt the user to shut down first.
You'd need to use ctypes or pywin32 to make your app detectable that
way, but it's only 1 or 2 lines of code. But, lemme know if you want to
go the route of updating only portions of the app - I've gone that
route too but it takes more work and has its own set of problems; I
might be able to save you a few headaches.

-Dave




More information about the Python-list mailing list