File rpm-python.spec of Package rpm

# spec file for package rpm-python (Version
# Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany.
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via

# norootforbuild

Name:           rpm-python
BuildRequires:  libbz2-devel libelf-devel libselinux-devel lzma-alpha-devel ncurses-devel python-devel zlib-devel
License:        GPL v2 or later
Group:          System/Packages
Summary:        Python Bindings for Manipulating RPM Packages
Release:        20.<RELEASE2>
Requires:       rpm = %{version}
Source99:       rpm.spec
%{expand:%(sed -n -e '/^Source:/,/^BuildRoot:/p' <%_sourcedir/rpm.spec)}

The rpm-python package contains a module that permits applications
written in the Python programming language to use the interface
supplied by RPM Package Manager libraries.

This package should be installed if you want to develop Python programs
that will manipulate RPM packages and databases.

    Erik Troan <>
    Marc Ewing <>

%{expand:%(sed -n -e '/^%%prep/,/^%%install/p' <%_sourcedir/rpm.spec | sed -e '1d' -e '$d')}

mkdir -p $RPM_BUILD_ROOT/usr/lib
# only installing in python/ does not work because rpm links against
# installed libs at install time
make DESTDIR="$RPM_BUILD_ROOT" install
find "%{buildroot}" -not -type d -and -not -path %{buildroot}%{_libdir}/python%{py_ver}/site-packages/rpm/\* -print0 | xargs -0 rm
pushd $RPM_BUILD_ROOT/%py_sitedir/rpm
rm -f _rpmmodule.a
python %py_libdir/ *.py
python -O %py_libdir/ *.py