From 0282c82462ad0a994d123b498129ce64d51ea6af Mon Sep 17 00:00:00 2001 From: Michel Alexandre Salim Date: Oct 20 2012 05:27:56 +0000 Subject: Update to 0.9.19 - On Fedora, also build for Python 3.x --- diff --git a/.gitignore b/.gitignore index 61884bb..8d9ed0c 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -/testtools-0.9.16.tar.gz +/testtools-0.9.18.tar.gz diff --git a/python-testtools.spec b/python-testtools.spec index ce01c32..f7ffae1 100644 --- a/python-testtools.spec +++ b/python-testtools.spec @@ -1,5 +1,9 @@ +%if 0%{?fedora} +%global with_python3 1 +%endif + Name: python-testtools -Version: 0.9.16 +Version: 0.9.19 Release: 1%{?dist} Summary: Extensions to the Python unit testing framework @@ -9,15 +13,31 @@ Group: Development/Tools License: MIT URL: https://launchpad.net/testtools Source0: http://pypi.python.org/packages/source/t/testtools/testtools-%{version}.tar.gz +Patch0: testtools-0.9.19-py3.patch BuildArch: noarch BuildRequires: python2-devel +%if 0%{?with_python3} +BuildRequires: python3-devel +%endif BuildRequires: python-sphinx %description testtools is a set of extensions to the Python standard library's unit testing framework. + +%if 0%{?with_python3} +%package -n python3-testtools +Summary: Extensions to the Python unit testing framework + +%description -n python3-testtools +testtools is a set of extensions to the Python standard library's unit testing +framework. + +%endif # with_python3 + + %package doc Summary: Documentation for %{name} Group: Documentation @@ -31,35 +51,78 @@ This package contains HTML documentation for %{name}. %prep %setup -q -n testtools-%{version} +%if 0%{?with_python3} +rm -rf %{py3dir} +cp -a . %{py3dir} + +# make the Python 3 build load the Python 3.x compatibility library directly +pushd %{py3dir} +%patch0 -p1 -b.py3 +popd + +find %{py3dir} -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python3}|' +rm %{py3dir}/testtools/_compat2x.py +rm testtools/_compat3x.py +%endif # with_python3 + %build %{__python} setup.py build + +%if 0%{?with_python3} +pushd %{py3dir} +%{__python3} setup.py build +popd +%endif # with_python3 + make -C doc html %install +# do python3 install first in case python-testtools ever install scripts in +# _bindir -- the one installed last should be Python 2.x's as that's the +# current default +%if 0%{?with_python3} +pushd %{py3dir} +%{__python3} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT +popd +%endif # with_python3 + %{__python} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT + %check %{__python} setup.py test +%if 0%{?with_python3} +pushd %{py3dir} +%{__python3} setup.py test +popd +%endif # with_python3 -%clean -rm -rf $RPM_BUILD_ROOT - %files %defattr(-,root,root,-) %doc LICENSE NEWS README %{python_sitelib}/* +%if 0%{?with_python3} +%files -n python3-testtools +%doc LICENSE NEWS README +%{python3_sitelib}/* +%endif + %files doc %defattr(-,root,root,-) %doc doc/_build/html/* %changelog +* Sat Oct 20 2012 Michel Salim - 0.9.19-1 +- Update to 0.9.19 +- On Fedora, also build for Python 3.x + * Wed Sep 5 2012 Michel Salim - 0.9.16-1 - Update to 0.9.16 - Remove deprecated sections diff --git a/sources b/sources index 8749f9b..b4a6617 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -87043d7dd084a9464fa1b2a9b83a1594 testtools-0.9.16.tar.gz +f0ebf8b7b78723e5649ef7c612f130b5 testtools-0.9.18.tar.gz diff --git a/testtools-0.9.19-py3.patch b/testtools-0.9.19-py3.patch new file mode 100644 index 0000000..e22dd69 --- /dev/null +++ b/testtools-0.9.19-py3.patch @@ -0,0 +1,15 @@ +--- testtools-0.9.19/testtools/compat.py.py3 2012-03-01 19:55:18.000000000 +0700 ++++ testtools-0.9.19/testtools/compat.py 2012-10-20 12:15:22.119810617 +0700 +@@ -32,11 +32,7 @@ + BytesIO = try_imports(['StringIO.StringIO', 'io.BytesIO']) + StringIO = try_imports(['StringIO.StringIO', 'io.StringIO']) + +-try: +- from testtools import _compat2x as _compat +- _compat +-except SyntaxError: +- from testtools import _compat3x as _compat ++from testtools import _compat3x as _compat + + reraise = _compat.reraise +