Tuesday, January 26, 2010

Building a Windows Installer (wininst) for Django

The Django website does not have a Windows installer for Django (at least not for version 1.1). However, you can easily build an installer yourself.

Download django.<version>.tar.gz. Unpack (e.g. using 7-Zip), and run the following command in the directory where setup.py is located (the root of the unpacked project), say Django1.1.1.

python setup.py bdist --format=wininst

This will create the installer Django-<version>.win32.exe the dist directory.

Friday, January 22, 2010

Running Python's Distutil Created Wininst Installers (.exe) from the Commmand Line

I recently created an installer with Inno Setup that was used to launch a bunch of other installers. As such, I needed to, more or less, run those sub-installers from the command line during install and uninstall. The sub-installers were executables generated by Python's distutils using the wininst bdist command (i.e. "wininst" installers for Windows).

Given the wininst installer mypymodule.1.2.exe, to install, execute the command mypymodule.1.2.exe. This places the files Removemypymodule.exe and wininst-mypymodule.log in the root directory of the Python installation. To uninstall execute the command path/to/python/root/Removemypymodule.exe -u path/to/python/root/wininst-mypymodule.log.