%define python_sitearch %(python -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)") %define python_sitearch64 %(python_64 -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)") Summary: Cryptography library for Python Name: python-crypto Version: 2.0.1 Release: 1 License: Public Domain Group: Development/Libraries # FIXME: In the near future, new releases will be at http://www.dlitz.net/software/pycrypto/ URL: http://www.amk.ca/python/code/crypto.html Source0: http://www.amk.ca/files/python/crypto/pycrypto-2.0.1.tar.gz # patch taken from # http://gitweb2.dlitz.net/?p=crypto/pycrypto-2.x.git;a=commitdiff;h=d1c4875e1f220652fe7ff8358f56dee3b2aba31b Patch0: %{name}-fix_buffer_overflow.patch # Python 2.6 compatibility: Use Hash.MD5 instead of Python "md5" module in the HMAC... # http://gitweb.pycrypto.org/?p=crypto/pycrypto-2.x.git;a=commitdiff;h=84b793416b52311643bfd456a4544444afbfb5da Patch1: python-crypto-hmac_md5.patch # Python 2.6 compatibility: When possible, use hashlib instead of the deprecated 'md5... # http://gitweb.pycrypto.org/?p=crypto/pycrypto-2.x.git;a=commitdiff;h=d2311689910240e425741a546576129f4c9735e2 Patch2: python-crypto-use_hashlib_when_possible.patch Provides: pycrypto = %{version}-%{release} BuildRequires: python >= 2.6, python-devel >= 2.6 BuildRequires: gmp-devel >= 4.1 BuildRequires: perl >= 5.8.8 Requires: python >= 2.6 BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot %description Python-crypto is a collection of both secure hash functions (such as MD5 and SHA), and various encryption algorithms (AES, DES, IDEA, RSA, ElGamal, etc.). %prep %setup -q -n pycrypto-%{version} export PATH=/opt/freeware/bin:$PATH %patch0 -b .patch0 -p1 %patch1 -b .patch1 -p1 %patch2 -b .patch2 -p1 mkdir ../32bit mv * ../32bit mv ../32bit . mkdir 64bit cp -r 32bit/* 64bit/ %build export CC="xlc_r" cd 64bit export OBJECT_MODE=64 python_64 setup.py build cd ../32bit export OBJECT_MODE=32 python setup.py build %install [ "${RPM_BUILD_ROOT}" != "/" ] && rm -rf ${RPM_BUILD_ROOT} cd 64bit python_64 setup.py install -O1 --skip-build --root ${RPM_BUILD_ROOT} cd ../32bit python setup.py install -O1 --skip-build --root ${RPM_BUILD_ROOT} # fix path to python find ${RPM_BUILD_ROOT}%{python_sitearch} -name "*.py" | xargs /opt/freeware/bin/perl -pi -e "s:/usr/local/bin/python:/opt/freeware/bin/python:" find ${RPM_BUILD_ROOT}%{python_sitearch64} -name "*.py" | xargs /opt/freeware/bin/perl -pi -e "s:/usr/local/bin/python:/opt/freeware/bin/python_64:" %clean [ "${RPM_BUILD_ROOT}" != "/" ] && rm -rf ${RPM_BUILD_ROOT} %files %defattr(-,root,system,-) %doc 32bit/README 32bit/TODO 32bit/ACKS 32bit/ChangeLog 32bit/LICENSE 32bit/Doc %{python_sitearch}/* %{python_sitearch64}/* %changelog * Wed Sep 02 2009 Michael Perzl - 2.0.1-1 - first version for AIX V5.1 and higher