From b53ae135cccc4acb10396478a67f062bf5db6f3f Mon Sep 17 00:00:00 2001 From: Lubomir Rintel Date: Fri, 25 Jul 2014 21:35:31 +0200 Subject: [PATCH] Add Python 3 subpackage --- python-rsa.spec | 69 +++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 61 insertions(+), 8 deletions(-) diff --git a/python-rsa.spec b/python-rsa.spec index d4cfa4e..39ef1b7 100644 --- a/python-rsa.spec +++ b/python-rsa.spec @@ -1,8 +1,14 @@ %global pkgname rsa +%if 0%{?fedora} > 12 +%bcond_without python3 +%else +%bcond_with python3 +%endif + Name: python-rsa Version: 3.1.1 -Release: 5%{?dist} +Release: 6%{?dist} Summary: Pure-Python RSA implementation License: ASL 2.0 @@ -14,9 +20,20 @@ BuildRequires: python2-devel BuildRequires: python-setuptools BuildRequires: python-pyasn1 BuildRequires: python-unittest2 +%if %with python3 +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pyasn1 +%endif %description -Pure-Python RSA implementation +Pure-Python RSA implementation. + +%package -n python3-rsa +Summary: Pure-Python RSA implementation + +%description -n python3-rsa +Pure-Python RSA implementation for Python 3. %prep %setup -q -n %{pkgname}-%{version} @@ -24,22 +41,58 @@ rm -rf %{pkgname}-*.egg-info sed -i "/from distribute_setup import use_setuptools/d" setup.py sed -i "/use_setuptools('0.6.10')/d" setup.py +%if %with python3 +rm -rf %{py3dir} +cp -a . %{py3dir} +%endif + %build -%{__python} setup.py build +%if %with python3 +pushd %{py3dir} +%{__python3} setup.py build +popd +%endif + +%{__python2} setup.py build %install -%{__python} setup.py install -O1 --skip-build --root %{buildroot} +%if %with python3 +pushd %{py3dir} +%{__python3} setup.py install --skip-build --root %{buildroot} +for B in %{buildroot}%{_bindir}/pyrsa-* + do mv $B $(echo $B |sed 's/pyrsa-/python3-pyrsa/'); done +popd +%endif + +%{__python2} setup.py install -O1 --skip-build --root %{buildroot} %check -%{__python} setup.py test +%if %with python3 +pushd %{py3dir} +%{__python3} setup.py test +popd +%endif + +%{__python2} setup.py test %files %doc LICENSE -%{_bindir}/* -%{python_sitelib}/rsa -%{python_sitelib}/rsa-*.egg-info +%{_bindir}/pyrsa* +%{python2_sitelib}/rsa +%{python2_sitelib}/rsa-*.egg-info + +%if %with python3 +%files -n python3-rsa +%doc LICENSE +%{_bindir}/python3-pyrsa* +%{python3_sitelib}/rsa +%{python3_sitelib}/rsa-*.egg-info +%endif %changelog +* Fri Jul 25 2014 Lubomir Rintel - 3.1.1-6 +- Add Python 3 subpackage + * Sat Jun 07 2014 Fedora Release Engineering - 3.1.1-5 - Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild