Python – How to fix the require for python(abi) when building python module RPMs for SCL

centos6pythonrpm

I'm currently trying to set up an environment for one of our apps on CentOS 6 using the SCL python33 repository. The app also requires a number of additional python modules, such as numpy, so I'm trying to build those; I'm getting close, but when I build the package, it requires python(abi) => 3.3.

According to the SCL docs, I want to change the Requires, which is obvious enough, and I see a bunch of goo in /etc/rpm/macros.python3.python33 which looks like it should handle that (that's an implicit require, not one that I can just change in the specfile), but I can't figure out how to get those macros to override the various ones in the specfile. Has anyone build RPMs for python modules to add to the python33 SCL, and what steps did you take?

For the record, this is my procedure so far:

setup.py bdist --format=rpm             # to generate the base specfile, numpy.spec
spec2scl numpy.spec                     # to generate the SCLed specfile
(edit specfile to remove %define __os_install_post bloc which doesn't cooperate with SCL)
rpmbuild -ba numpy.py -D 'scl python33' # to try and build the RPM from the specfile

This gets me an RPM, but with the broken require (which needs to be python33-python(abi)).

Best Answer

You may be past this issue, but I wanted to update with the method that worked easily for me.

Here was my situation:

I was building several python27 SCL RPMs from downloaded egg files using a script to do everything - side note: This was how I pulled in all of the dependencies for our Python Django web app and is run from within the Atlassian Bamboo plan to build the web app RPM.

As far as what had worked up to the requirement problem discussed here -

I programmatically replaced the package names with the "python27-python-" prefix, and all of the packaged files picked up the SCL root path of "/opt/rh/python27/root", so all was well ... EXCEPT that they all picked up the requires for python(abi) = 2.7, as yours did for 3.3

Note: Since I replaced the "name" of the package with the SCL version, I saved that out a new setup.py file, which I called:

setupSCL.py

I tried a few incantations of macros, but what solved the requirement issue for me was actually simple.

In my setup.py command line, I just added:

--no-autoreq

To replace that errant auto require, I added back in the SCL version that we both seeked with:

--requires "python27-python"

So my actual command line was:

python setupSCL.py bdist_rpm --no-autoreq --requires "python27-python" &> /dev/null

Boom! Works like a champ

So when I check the requires using yum deplist (in this example for djangorestframework):

I get:

yum deplist /root/rpmbuild/SOURCES/djangorestframework-2.4.4/dist/python27-python-djangorestframework-2.4.4-1.noarch.rpm

Finding dependencies: 
package: python27-python-djangorestframework.noarch 2.4.4-1
  dependency: python27-python
   provider: python27-python.x86_64 2.7.5-7.el6.centos.alt

Hope this helps someone one day ...

Related Topic