From 569b43b026cf3b34a9089bf984e665ff0bfdd474 Mon Sep 17 00:00:00 2001 From: Paul Howarth Date: Tue, 8 Dec 2015 15:31:46 +0000 Subject: [PATCH] Fix FTBFS (Debian Bug #804430) --- python-rsa.spec | 27 +++++++++++++++++-------- rsa-3.1.4-debian-804430.patch | 38 +++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+), 8 deletions(-) create mode 100644 rsa-3.1.4-debian-804430.patch diff --git a/python-rsa.spec b/python-rsa.spec index 5ebc84d..26eb386 100644 --- a/python-rsa.spec +++ b/python-rsa.spec @@ -8,37 +8,44 @@ Name: python-rsa Version: 3.1.4 -Release: 2%{?dist} +Release: 3%{?dist} Summary: Pure-Python RSA implementation License: ASL 2.0 URL: http://stuvel.eu/rsa Source0: https://pypi.python.org/packages/source/r/rsa/%{pkgname}-%{version}.tar.gz - +Patch0: rsa-3.1.4-debian-804430.patch BuildArch: noarch + BuildRequires: python2-devel BuildRequires: python-setuptools BuildRequires: python-pyasn1 >= 0.1.3 BuildRequires: python-unittest2 Requires: python-pyasn1 >= 0.1.3 -%if %with python3 -BuildRequires: python3-devel -BuildRequires: python3-setuptools -BuildRequires: python3-pyasn1 >= 0.1.3 -%endif %description Pure-Python RSA implementation. +%if %with python3 %package -n python3-rsa Summary: Pure-Python RSA implementation +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pyasn1 >= 0.1.3 +BuildRequires: python3-unittest2 Requires: python3-pyasn1 >= 0.1.3 %description -n python3-rsa Pure-Python RSA implementation for Python 3. +%endif %prep %setup -q -n %{pkgname}-%{version} + +# Fix FTBFS (Debian Bug #804430) +%patch0 + +# Get rid of upstream's egg-info, we'll use our own rm -rf %{pkgname}-*.egg-info %if %with python3 @@ -73,7 +80,7 @@ pushd %{py3dir} popd %endif -%{__python2} setup.py test +%{__python2} run_tests.py %files %if 0%{?_licensedir:1} @@ -100,6 +107,10 @@ popd %endif %changelog +* Tue Dec 8 2015 Paul Howarth - 3.1.4-3 +- Fix FTBFS (Debian Bug #804430) +- Run the tests for both python2 and python3 + * Tue Nov 10 2015 Fedora Release Engineering - 3.1.4-2 - Rebuilt for https://fedoraproject.org/wiki/Changes/python3.5 diff --git a/rsa-3.1.4-debian-804430.patch b/rsa-3.1.4-debian-804430.patch new file mode 100644 index 0000000..1c1aec6 --- /dev/null +++ b/rsa-3.1.4-debian-804430.patch @@ -0,0 +1,38 @@ +--- rsa/_version133.py ++++ rsa/_version133.py +@@ -18,7 +18,12 @@ __version__ = '1.3.3' + # NOTE: Python's modulo can return negative numbers. We compensate for + # this behaviour using the abs() function + +-from cPickle import dumps, loads ++try: ++ import cPickle as pickle ++except: ++ import pickle ++from pickle import dumps, loads ++ + import base64 + import math + import os +--- tests/constants.py ++++ tests/constants.py +@@ -3,7 +3,7 @@ + from rsa._compat import have_python3 + + if have_python3: +- from py3kconstants import * ++ from tests.py3kconstants import * + else: + from py2kconstants import * + +--- tests/test_strings.py ++++ tests/test_strings.py +@@ -6,7 +6,7 @@ import unittest2 + + import rsa + +-from constants import unicode_string ++from tests.constants import unicode_string + + class StringTest(unittest2.TestCase): +