Creating Unix RPM packages
It is very easy to create installable RPM packages with
distutils. RPM is one of the two or three standard package
formats in the Unix world (the others are compressed or
gzipped tar archives and Debian packages) and most Linux
distributions support it.
RPM has strong support for dependency checking. This
means you can create a package that cannot be installed
unless certain other packages have been installed first.
You can even demand that those packages are of a certain version
number.
Creating an RPM takes just one command:
boudewijn@maldar:~/doc/pyqt/ch18/kalam > python setup.py bdist_rpm
To ensure a really nice RPM, a few options should be
set. The best place to set these is in the setup.cfg
file:
[bdist_rpm]
release = 1
packager = Boudewijn Rempt <boud@rempt.xs4all.nl>
doc_files = README
COPYING
provides = kalam
requires = python pyqt
distribution_name = SuSE 7.2
Most of the options merely provide some extra meta-data, but
the provides and requires
options are needed by RPM to do its dependency checking. In this
case, Kalam requires both
Python and PyQt to be present, which is
hardly a surprise! You can make these requirements more specific
by also asking for a version number:
requires = python-2.2 pyqt-2.5
RPM is a complicated package format in
itself, and you can customize the installation process
considerably by using .spec file. The book
Maximum RPM (freely available at http://www.rpmdp.org/rpmbook/)
gives detailed information on writing these files. At the moment
distutils writes the file for you, based on the options in
setup.py and
setup.cfg. A future release of distutils
will support using your own .spec
files.