Saturday, June 11, 2011

Building RPMs for Python3.1

While it's been a long time since the first stable version Python 3 was released, it's not yet available on several operating systems. Looking for a repository with Python 3 rpms, I found IUS Community, but I had some problems with it, and I thought on building my own rpms.

The process for building an rpm from a source tarball is pretty easy (if you know the steps). The only problem in this case, is that the .spec file delivered with Python is not updated, so the process fails.

I did required changes to the .spec file, and I uploaded it to: (NOTE, that is necessary to edit the exact version of Python you're building in line 37. Version in uploaded file is 3.1.3, but it could be changes to 3.1.3, 3.1.4rc1,...).

Next, you can find the steps for creating a RPM package for Python 3.1 on a CentOS 5 (using my custom .spec file):

# Install required software
yum install rpm-build gcc expat-devel db4-devel gdbm-devel sqlite-devel ncurses-devel readline-devel zlib-devel openssl-devel

# Download Python source
cd /usr/src/redhat/SOURCES/

# Download .spec (rpm specifications file)
cd /usr/src/redhat/SPECS/

# Generate RPMs (and SRPMs)
rpmbuild -ba /usr/src/redhat/SPECS/python-3.1.spec

Compiling Python and creating the RPM will take a while, but after this process, you'll have the RPMs at:


No comments:

Post a Comment