The RPM format is used by many of popular Linux distributions, including Red Hat, SuSE, and Mandrake. If one of these (or any of the other RPM-based Linux distributions) is your usual environment, creating RPM packages for other users of that same distribution is trivial. Depending on the complexity of your module distribution and differences between Linux distributions, you may also be able to create RPMs that work on different RPM-based distributions.
The usual way to create an RPM of your module distribution is to run the
bdist_rpm
command:
python setup.py bdist_rpm
bdist
command with the --format option:
python setup.py bdist --formats=rpm
bdist_*
commands
and their options:
python setup.py bdist_rpm --packager="John Doe <jdoe@python.net>" \ bdist_wininst --target_version="2.0"
Creating RPM packages is driven by a .spec file, much as using
the Distutils is driven by the setup script. To make your life easier,
the bdist_rpm
command normally creates a .spec file
based on the information you supply in the setup script, on the command
line, and in any Distutils configuration files. Various options and
section in the .spec file are derived from options in the setup
script as follows:
RPM .spec file option or section | Distutils setup script option |
---|---|
Name | name |
Summary (in preamble) | description |
Version | version |
Vendor | author and author_email, or
& maintainer and maintainer_email |
Copyright | licence |
Url | url |
%description (section) | long_description |
Additionally, there many options in .spec files that don't have
corresponding options in the setup script. Most of these are handled
through options to the bdist_rpm
command as follows:
RPM .spec file option or section | bdist_rpm option |
default value |
---|---|---|
Release | release | ``1'' |
Group | group | ``Development/Libraries'' |
Vendor | vendor | (see above) |
Packager | packager | (none) |
Provides | provides | (none) |
Requires | requires | (none) |
Conflicts | conflicts | (none) |
Obsoletes | obsoletes | (none) |
Distribution | distribution_name | (none) |
BuildRequires | build_requires | (none) |
Icon | icon | (none) |
There are three steps to building a binary RPM package, all of which are handled automatically by the Distutils:
If you wish, you can separate these three steps. You can use the
--spec-only option to make bdist_rpm
just
create the .spec file and exit; in this case, the .spec
file will be written to the ``distribution directory''--normally
dist/, but customizable with the --dist-dir
option. (Normally, the .spec file winds up deep in the ``build
tree,'' in a temporary directory created by bdist_rpm
.)
** this isn't implemented yet--is it needed?! ** You can also specify a custom .spec file with the --spec-file option; used in conjunctin with --spec-only, this gives you an opportunity to customize the .spec file manually:
> python setup.py bdist_rpm --spec-only # ...edit dist/FooBar-1.0.spec > python setup.py bdist_rpm --spec-file=dist/FooBar-1.0.spec
bdist_rpm
command with one that writes whatever else you want
to the .spec file; see section