Re: Correlating rpm-python version with python version

Paul Nasrat <pauln-xGvoirzvwgBWk0Htik3J/[email protected]> Sun, 7 Mar 2004 17:41:28 +0000
Newsgroups gmane.linux.redhat.rpm.python
Message-ID <[email protected]>
On Sun, Mar 07, 2004 at 08:32:03AM -0800, Brad Smith wrote:
> Hello, all. 
> 
> Appologies if this is an inappropriate forum for this question. My webhost is

All rpm-python questions welcome here :)

> running python 2.2.2 and doesn't have rpm-python installed for that version
> (though they do for python 1.x). I was hoping I could save the trouble of
> convincing an admin to install the package by just adding the appropriate
> version of rpmmodule.so into my modules path. I grabbed the rpm for the
> distro they're running (rh7.3), but when my app runs, I get the following:
> 
>  RuntimeWarning: Python C API version mismatch for module rpm: This Python
>  has API version 1011, module rpm has version 1007.  import rpm

You probably want to rebuild rpm-python against 2.2 on your machine - you
should be able to do this by grabbing src.rpm for your rpm version.  This will
ensure that it is happily linked against rpmlib.  Extract rpm sources using
rpmbuild -bp or rpm2cpio 

./configure --with-python=2.2 --prefix=/usr
make
cd python
mkdir tmp 
make DESTDIR=$(pwd)/tmp install
cd tmp/usr/lib/python2.2/site-packages

To test

python2
import rpm

pop rpmmodule.so somewhere more useful :)

Should leave you with rpmmodule.so you can use.[0]
  
> I'm guessing this is because rh7.3 comes with python 1.x and so the
> rpm-python package I got was designed for it instead of 2.2.2. So the
> question arises: how can I determine which version of the rpm-python package
> I need?

It's not quite that simple atm.  I need to look at the legacy and future
issues...

> A related question: Is there any central download source for rpm-python
> packages? I've googled and the best I've come up with is rpmfind.net.

rpm-python is currently part of rpm - getting srpms from distro/rawhide or CVS
is authoritative.  Also can be found various releases at ftp.rpm.org - but for
your case grabbing rpm --qf '%{SOURCERPM}\n' rpm, is what you want.

Paul