rpm 5.2.1

- Main Page
- Related Pages
- Modules
- Data Structures
- Files

- Data Structures
- Data Fields

Rpm Class Reference
PYTHON API.

START HERE / RPM base module for the Python API. More...

## Detailed Description

START HERE / RPM base module for the Python API.

The rpm base module provides the main starting point for accessing RPM from Python. For most usage, call the TransactionSet method to get a transaction set (rpmts).

For example:

import rpm
ts = rpm.TransactionSet()

The transaction set will open the RPM database as needed, so in most cases, you do not need to explicitly open the database. The transaction set is the workhorse of RPM.

You can open another RPM database, such as one that holds all packages for a given Linux distribution, to provide packages used to solve dependencies. To do this, use the following code:

rpm.addMacro('_dbpath', '/path/to/alternate/database')
solvets = rpm.TransactionSet()
solvets.openDB()
rpm.delMacro('_dbpath')
# Open default database
ts = rpm.TransactionSet()

This code gives you access to two RPM databases through two transaction sets (rpmts): ts is a transaction set associated with the default RPM database and solvets is a transaction set tied to an alternate database, which is very useful for resolving dependencies.

The rpm methods used here are:

- addMacro(macro, value)
  Parameters

    macro | Name of macro to add
    value | Value for the macro

- delMacro(macro)
  Parameters

    macro | Name of macro to delete

The documentation for this class was generated from the following file:

- python/header-py.c