%bcond_with dotests %global __tar /opt/freeware/bin/tar %global py_minor 16 %global py_major 3.9 %global python_major python%{py_major} %global pkgname pycrypto %global meta_package python3-%{pkgname} %global python3_sitearch %(%{python_major} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(0))") %global python3_sitearch64 %(%{python_major} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))") Name: %{python_major}-%{pkgname} Version: 2.6.1 Release: 2 Summary: Cryptographic modules for Python License: Public Domain and Python URL: https://pypi.python.org/%{pkgname} Source0: https://files.pythonhosted.org/packages/source/p/%{pkgname}/%{pkgname}-%{version}.tar.gz BuildArch: ppc Patch0: pycrypto-2.6-aix.patch Patch1: python-crypto-2.4-fix-pubkey-size-divisions.patch Patch2: pycrypto-2.6.1-CVE-2013-7459.patch BuildRequires: coreutils >= 9.0-1 BuildRequires: gmp-devel >= 6.2.1 BuildRequires: gmp >= 6.2.1 BuildRequires: %{python_major}-devel >= %{py_major}.%{py_minor} BuildRequires: %{python_major}-setuptools >= 65.2.0 Requires: %{python_major} >= %{py_major}.%{py_minor} %description PyCrypto is a collection of both secure hash functions (such as MD5 and SHA), an d various encryption algorithms (AES, DES, RSA, ElGamal, etc.). The library is available as 32-bit and 64-bit. %package -n %{meta_package} Summary: Meta-package for %{name} Requires: python3 >= %{py_major}.%{py_minor} Requires: %{name} = %{version}-%{release} %description -n %{meta_package} This is a Meta-package for %{name} package. %prep %autosetup -n %{pkgname}-%{version} -p1 mkdir ../32bit mv * ../32bit mv ../32bit . mkdir 64bit cd 32bit && tar cf - . | (cd ../64bit ; tar xpf -) %build export PATH=/opt/freeware/bin:$PATH export ac_cv_func_malloc_0_nonnull=yes cd 64bit export CC="/opt/freeware/bin/gcc -O2 -maix64" export OBJECT_MODE=64 export LDFLAGS="-L%{_libdir64} -L%{_libdir} -Wl,-blibpath:%{_libdir64}:%{_libdir}:/usr/lib:/lib" %{python_major} setup.py build cd ../32bit export CC="/opt/freeware/bin/gcc -O2 -maix32 -D_LARGE_FILES" export OBJECT_MODE=32 export LDFLAGS="-L%{_libdir} -Wl,-blibpath:%{_libdir}:/usr/lib:/lib -Wl,-bmaxdata:0x80000000" %{_libexecdir}/%{python_major}_32 setup.py build %install [ "${RPM_BUILD_ROOT}" != "/" ] && rm -rf ${RPM_BUILD_ROOT} cd 64bit %{python_major} setup.py install --root %{buildroot} cd ../32bit %{_libexecdir}/%{python_major}_32 setup.py install --root %{buildroot} %check %if %{with dotests} #python3 -m venv python_venv #. ./python_venv/bin/activate #pip3 install pytest #pip3 install hypothesis #ulimit -d unlimited #ulimit -n unlimited #ulimit -m unlimited # ulimit -f unlimited #( python runtests.py -m 'full' -v || true ) #deactivate %endif %clean [ "${RPM_BUILD_ROOT}" != "/" ] && rm -rf ${RPM_BUILD_ROOT} %files %defattr(-,root,system,-) %doc ./ACKS ./COPYRIGHT ./ChangeLog ./LEGAL/ ./PKG-INFO ./README ./TODO ./Doc %{python3_sitearch}/* %{python3_sitearch64}/* %files -n %{meta_package} %defattr(-,root,system,-) %changelog * Tue Jan 17 2023 Sangeetha Bandi - 2.11.0-2 - pycrypto for python3.9 * Mon Jan 20 2020 Ashwini Chandrappa - 2.6.1-1 - Build with python3 * Fri Feb 03 2017 Michael Wilson - 2.6.1-1 - New version 2.6.1 and Fedora inspired changes * Fri Feb 03 2017 Michael Wilson - 2.6-2 - Corrections for compiler options and build GCC/XLC * Thu Jul 17 2013 Tristan Delhalle - 2.6-1 - first version for AIX V6.1 and higher