[packages/python-Crypto] Python 3 support added, tests enabled

jajcus jajcus at pld-linux.org
Wed Oct 30 10:03:17 CET 2013


commit c617610d228a86218a4c72c33af1cf7a19a778f0
Author: Jacek Konieczny <j.konieczny at eggsoft.pl>
Date:   Wed Oct 30 10:02:50 2013 +0100

    Python 3 support added, tests enabled

 python-Crypto.spec | 104 ++++++++++++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 100 insertions(+), 4 deletions(-)
---
diff --git a/python-Crypto.spec b/python-Crypto.spec
index 0498444..3d58da4 100644
--- a/python-Crypto.spec
+++ b/python-Crypto.spec
@@ -1,3 +1,9 @@
+
+# Conditional build:
+%bcond_without	tests	# do not perform "make test"
+%bcond_without	python2 # CPython 2.x module
+%bcond_without	python3 # CPython 3.x module
+
 %define		module	Crypto
 Summary:	PyCrypto - The Python Cryptography Toolkit
 Summary(pl.UTF-8):	Kryptograficzny przybornik dla języka Python
@@ -10,9 +16,17 @@ Group:		Development/Languages/Python
 Source0:	http://ftp.dlitz.net/pub/dlitz/crypto/pycrypto/pycrypto-%{version}.tar.gz
 # Source0-md5:	55a61a054aa66812daf5161a0d5d7eda
 URL:		http://www.dlitz.net/software/pycrypto/
+%if %{with python2}
 BuildRequires:	python
 BuildRequires:	python-devel >= 2.2
 BuildRequires:	python-modules
+%endif
+%if %{with python3}
+BuildRequires:	python3
+BuildRequires:	python3-2to3
+BuildRequires:	python3-devel
+BuildRequires:	python3-modules
+%endif
 BuildRequires:	rpm-pythonprov
 BuildRequires:	rpmbuild(macros) >= 1.219
 BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
@@ -46,27 +60,84 @@ zaimplementowanych dla języka Python. Pakiet zawiera między innymi:
   angielskich, test liczb pierwszych
 - programy demo (aktualnie odrobinę starych)
 
+%package -n python3-%{module}
+Summary:	PyCrypto - The Python Cryptography Toolkit
+Summary(pl.UTF-8):	Kryptograficzny przybornik dla języka Python
+Group:		Development/Languages/Python
+
+%description -n python3-%{module}
+The Toolkit is a collection of cryptographic algorithms and protocols,
+implemented for use from Python. Among the contents of the package:
+- hash functions: MD2, MD4, RIPEMD
+- block encryption algorithms: AES, ARC2, Blowfish, CAST, DES,
+  Triple-DES, IDEA, RC5
+- stream encryption algorithms: ARC4, simple XOR
+- public-key algorithms: RSA, DSA, ElGamal, qNEW
+- protocols: All-or-nothing transforms, chaffing/winnowing
+- miscellaneous: RFC1751 module for converting 128-key keys into a set
+  of English words, primality testing
+- some demo programs (currently all quite old and outdated)
+
+%description -n python3-%{module} -l pl.UTF-8
+Ten przybornik jest zbiorem kryptograficznych algorytmów i protokołów
+zaimplementowanych dla języka Python. Pakiet zawiera między innymi:
+- funkcje haszujące: MD2, MD4, RIPEMD
+- blokowe algorytmy szyfrujące: AES,ARC2, Blowfish, CAST, DES,
+  Triple-DES, IDEA, RC5
+- strumieniowe algorytmu szyfrujące: ARC4, zwykły XOR
+- algorytmy z kluczem publicznym: RSA, DSA,ElGamal, qNEW
+- protokoły: przekształcenia wszystko-albo-nic, chaffing/winnowing
+- inne: RFC1751 moduł do konwersji kluczy 128 bitowych w zbiory słów
+  angielskich, test liczb pierwszych
+- programy demo (aktualnie odrobinę starych)
+
 %prep
 %setup -q -n pycrypto-%{version}
 
 %build
+%if %{with python2}
+# CC/CFLAGS is only for arch packages - remove on noarch packages
 CC="%{__cc}" \
 CFLAGS="%{rpmcflags}" \
-%{__python} setup.py build
+%{__python} setup.py build --build-base build-2 %{?with_tests:test}
+%endif
+
+%if %{with python3}
+# CC/CFLAGS is only for arch packages - remove on noarch packages
+CC="%{__cc}" \
+CFLAGS="%{rpmcflags}" \
+%{__python3} setup.py build --build-base build-3 %{?with_tests:test}
+%endif
 
 %install
 rm -rf $RPM_BUILD_ROOT
-%{__python} setup.py install \
-	--optimize=2 \
-	--root=$RPM_BUILD_ROOT
+
+%if %{with python2}
+%{__python} setup.py \
+	build --build-base build-2 \
+	install --skip-build \
+	--root=$RPM_BUILD_ROOT \
+	--optimize=2
 
 %py_postclean
 
 %{__rm} -r $RPM_BUILD_ROOT%{py_sitedir}/Crypto/SelfTest
+%endif
+
+%if %{with python3}
+%{__python3} setup.py \
+	build --build-base build-3 \
+	install --skip-build \
+	--root=$RPM_BUILD_ROOT \
+	--optimize=2
+
+%{__rm} -r $RPM_BUILD_ROOT%{py3_sitedir}/Crypto/SelfTest
+%endif
 
 %clean
 rm -rf $RPM_BUILD_ROOT
 
+%if %{with python2}
 %files
 %defattr(644,root,root,755)
 %doc ACKS COPYRIGHT ChangeLog README TODO Doc
@@ -87,3 +158,28 @@ rm -rf $RPM_BUILD_ROOT
 %if "%{py_ver}" > "2.4"
 %{py_sitedir}/pycrypto-*.egg-info
 %endif
+%endif
+
+%if %{with python3}
+%files -n python3-%{module}
+%defattr(644,root,root,755)
+%doc ACKS COPYRIGHT ChangeLog README TODO Doc
+%dir %{py3_sitedir}/%{module}
+%{py3_sitedir}/%{module}/*.py
+%{py3_sitedir}/%{module}/__pycache__
+%dir %{py3_sitedir}/%{module}/Cipher
+%dir %{py3_sitedir}/%{module}/Hash
+%dir %{py3_sitedir}/%{module}/Protocol
+%dir %{py3_sitedir}/%{module}/PublicKey
+%dir %{py3_sitedir}/%{module}/Random
+%dir %{py3_sitedir}/%{module}/Random/Fortuna
+%dir %{py3_sitedir}/%{module}/Random/OSRNG
+%dir %{py3_sitedir}/%{module}/Signature
+%dir %{py3_sitedir}/%{module}/Util
+%attr(755,root,root) %{py3_sitedir}/%{module}/*/*.so
+%{py3_sitedir}/%{module}/*/*.py
+%{py3_sitedir}/%{module}/*/__pycache__
+%{py3_sitedir}/%{module}/*/*/*.py
+%{py3_sitedir}/%{module}/*/*/__pycache__
+%{py3_sitedir}/pycrypto-*.egg-info
+%endif
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/python-Crypto.git/commitdiff/c617610d228a86218a4c72c33af1cf7a19a778f0



More information about the pld-cvs-commit mailing list