Python rpm

Материал из noname.com.ua
Перейти к навигацииПерейти к поиску

RPM для python 2.7

Надо собрать рпм-ку питон 2.7 для центос 6.2 Как выяснилось есть грабли. За основу взял туту (http://blog.milford.io/2012/01/building-and-installing-python-2-7-rpms-on-centos-5-7/) но слегка поправил.

Зависимости для сборки

sudo yum -y install rpmdevtools tk-devel tcl-devel expat-devel db4-devel \

                   gdbm-devel sqlite-devel bzip2-devel openssl-devel \
                   ncurses-devel readline-devel


Собрать дерево каталого

rpmdev-setuptree

Взять спеку

wget https://raw.github.com/nmilford/specfiles/master/python-2.7/python27-2.7.2.spec \

    -O ~/rpmbuild/SPECS/python27-2.7.2.spec 

wget http://www.python.org/ftp/python/2.7.2/Python-2.7.2.tar.bz2 \

    -O ~/rpmbuild/SOURCES/Python-2.7.2.tar.bz2


сбилдить рпм (FYI, the QA_RPATHS variable tells the rpmbuild to skip some file path errors).

QA_RPATHS=$[ 0x0001|0x0010 ] rpmbuild -bb ~/rpmbuild/SPECS/python-2.7.2.spec

Install the RPMs.

sudo rpm -Uvh ~/rpmbuild/RPMS/x86_64/python27*.rpm

Now on to the the setuptools.

Grab my spec file.

wget https://raw.github.com/nmilford/specfiles/master/python-2.7/python27-setuptools-0.6c11.spec \

    -O ~/rpmbuild/SPECS/python27-setuptools-0.6c11.spec 

Grab the source.

wget http://pypi.python.org/packages/source/s/setuptools/setuptools-0.6c11.tar.gz \

    -O ~/rpmbuild/SOURCES/setuptools-0.6c11.tar.gz

Build the RPMs.

rpmbuild -bb ~/rpmbuild/SPECS/python27-setuptools-0.6c11.spec

Install the RPMs.

sudo rpm -Uvh ~/rpmbuild/RPMS/noarch/python27-setuptools-0.6c11-milford.noarch.rpm

Now, we’ll install MySQL-python as an example.

Grab the mysql-dev package

yum -y install mysql-devel

Grab, build and install the MySQL-python package.

curl http://superb-sea2.dl.sourceforge.net/project/mysql-python/mysql-python/1.2.3/MySQL-python-1.2.3.tar.gz | tar zxv cd MySQL-python-1.2.3 python2.7 setup.py build python2.7 setup.py install

Like with the previous Python 2.6 article, note how I called the script explicitly using the following python binary: /usr/bin/python2.7

Now we’re good to give it the old test thus:

python2.7 -c "import MySQLdb"

If it doesn’t puke out some error message, you’re all set.

Happy pythoning.