%if 0%{?fedora} > 12 %global with_python3 1 %else %{!?__python2: %global __python2 /usr/bin/python2} %{!?python2_sitearch: %global python2_sitearch %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")} %endif Name: python-cryptography Version: 0.4 Release: 1%{?dist} Summary: PyCA's cryptography library Group: Development/Libraries License: ASL 2.0 URL: https://cryptography.io/en/latest/ Source0: https://pypi.python.org/packages/source/c/cryptography/cryptography-0.4.tar.gz BuildRequires: openssl-devel BuildRequires: python2-devel python-setuptools python-cffi >= 0.8 python-six %if 0%{?with_python3} BuildRequires: python3-devel python3-setuptools python3-cffi >= 0.8 python3-six %endif Requires: openssl-devel Requires: python-cffi >= 0.8 Requires: python-six >= 1.6.1 %description cryptography is a package designed to expose cryptographic primitives and recipes to Python developers. %if 0%{?with_python3} %package -n python3-cryptography Group: Development/Libraries Summary: PyCA's cryptography library Requires: openssl-devel Requires: python3-cffi >= 0.8 Requires: python3-six >= 1.6.1 %description -n python3-cryptography cryptography is a package designed to expose cryptographic primitives and recipes to Python developers. %endif %prep %setup -q -n cryptography-%{version} %if 0%{?with_python3} rm -rf %{py3dir} cp -a . %{py3dir} find %{py3dir} -name '*.py' | xargs sed -i '1s|^#!/usr/bin/python|#!%{__python3}|' %endif %build %{__python2} setup.py build %if 0%{?with_python3} pushd %{py3dir} %{__python3} setup.py build popd %endif %install %{__python2} setup.py install --skip-build --prefix=%{_prefix} --root %{buildroot} %if 0%{?with_python3} pushd %{py3dir} %{__python3} setup.py install --skip-build --prefix=%{_prefix} --root %{buildroot} popd %endif %files %doc LICENSE README.rst docs %{python_sitearch}/* %if 0%{?with_python3} %files -n python3-cryptography %doc LICENSE README.rst docs %{python3_sitearch}/* %endif %changelog * Sun Jun 29 2014 Terry Chia 0.4-1 - initial version