[Distutils] --post-install on win32

Cory Dodt corydodt@yahoo.com
Wed Jan 8 12:24:06 2003


I have been working with the --post-install option to bdist_wininst and
have noticed the following behavior, which appears to be a bug or possibly
a misdesign.  The consequence of this behavior is at the end, it will take
some explaining to get there...

I'm going to use the following terms:

pre-build time: the moment you issue the command
                C:\...\>setup.py bdist_wininst --install-script=x
build time: while build_* is happening
post-install time: after you've run the bdist_wininst installer and gone
through the wizard; the very last page of the wizard, when it runs the
post-install script.
post-install-arg: what you gave as an argument to --install-script=...

The argument to --install-script at pre-build time has to match an entry
in setup_args['scripts'], that is, if you have
  { ... 'scripts': ['my-postinstall.py'] }
You have to provide --install-script=my-postinstall.py but if you have
  { ... 'scripts': ['win32/my-postinstall.py'] }
You have to provide --install-script=win32\my-postinstall.py

If they don't match, bdist_wininst gives up with the error "install_script
'my-postinstall.py' not found in scripts".

At install time, the basename part of <post-install-arg> gets copied to
C:\python22\scripts, regardless of where it was found at pre-build-time,
so you always have C:\python22\scripts\my-postinstall.py.

But at post-install time, the installer looks for
C:\python22\scripts\<post-install-arg>.  That is:

--install-script=<argument>                           where it searches
---------------------------                           -----------------
my-postinstall.py                 C:\python22\scripts\my-postinstall.py
win32\my-postinstall.py     C:\python22\scripts\win32\my-postinstall.py
(I have verified this with filemon.exe.)

But C:\python22\scripts\win32\my-postinstall.py doesn't exist in the
post-installation filesystem, because all scripts were copied into
c:\python22\scripts, as I already mentioned.  In consequence, you have to
keep your post-install script in the same directory setup.py is in, or the
installer won't be able to find it.

As a workaround for this behavior, I keep my postinstall script where I
want to but have setup.py copy it to '.' at pre-build time.  This is a
kludge, and I'm wondering if there's a better way, or if I may be seeing
behavior that the distutils masters didn't intend.


__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com