include("site.inc"); $template = new Page; $template->initCommon(); $template->displayHeader(); ?>
This chapter introduces the high-level RPM API for Python programming. You can use this API from Python scripts to perform RPM functionality, just as you can write C programs using the RPM C API covered in Chapter 16.
In general, the Python API is simpler and requires fewer code statements than the corresponding functionality in the C API.
Just about all of your work with the Python API requires a transaction set, which you can get by calling rpm.TransactionSet.
To query the RPM database, call dbMatch on the transaction set object. To install or upgrade packages, call addInstall, check, order, and run on the transaction set.
The next chapter switches to another language for accessing the RPM system: Perl. With the rich set of APIs, you can write your RPM programs in C, Python, Perl, or any language that can call on code written in one of these languages.