[Python-Dev] distutils extra sources

Martin v. Loewis martin@loewis.home.cs.tu-berlin.de
Sun, 15 Oct 2000 18:43:23 +0200


> Can you recommend how to include this in the source distribution for
> the final release?

Even though I was not asked, I still answer :-) I think having the
source code for the installer is essential, just so that people won't
get frightened by the potential for a Trojan Horse in front of the
gates (or, rather, the windows?-)

I'd put the installer (i.e. all of distutils/misc except for
get_metadata.py) into Tools/wininst.  (I'd actually preferred to see
the wininst sources in distutils in a different directory as well).

In case you need some descripting text as well, here's my proposal.
In Tools/README, maybe it would be

wininst    Sources for Windows installer of distutils.command.bdist_wininst.

For Tools/wininst/README, see the text below.

One complication is that invoking bdist_wininst as a program will
regenerate the module, but it expects the installer binary in
../../misc/wininst.exe; I'm not sure whether it is worth the effort to
change that for the Python distribution.

Regards,
Martin

THE WINDOWS INSTALLER
=====================

The distutils support the command bdist_wininst, which will produce a
windows auto-installing executable using the information in the setup
function. The executable consists of a user interface program,
concatenated with a zip archive of the distributed files. This
directory contains the sources of the user interface program. The
bdist_wininst command itself does not need the sources, instead, it
has an embedded copy of the installer binary file. If the installer
program is modified, bdist_wininst.py must be updated by invoking it
as a program (i.e. "python bdist_wininst.py")

Building the installer
----------------------

To build the installer, you need a copy of Microsoft Visual C++
version 6; the project file is wininst.dsp. You may also use the
executable compressor UPX, which is available from
http://upx.tsx.org. UPX must be installed into c:\util. Using UPX is
not strictly required - it just reduces the size of the installation
program itself.

Using the bdist_wininst command
-------------------------------
To create an binary distribution of your package for Windows, simply
invoke "python setup.py bdist_wininst" in your package directory. If
your package does not contain C modules, you may invoke this command
on any system; if it does contain C modules, bdist_wininst will need
the C compiler used to build Python (typically MSVC++). It will not
need MSVC++ or UPX to build the setup program.

To build the ZIP file contained in the installer, bdist_wininst will
first try an external zip program (zip.exe) that understands the -rq
option, such as Info-ZIP
(http://www.info-zip.org/pub/infozip/Zip.html). If no such program is
found, it will next try the zipfile module, which is available if
Python was build with zlib support.