bkabrda pushed to python-versiontools (master). "Introduce python3 supbackage. Patch by Adam Miller."
notifications at fedoraproject.org
notifications at fedoraproject.org
Mon Jun 1 09:45:55 UTC 2015
From 1a7c27366442c1339ed5b99de75f3260ff3cd5b4 Mon Sep 17 00:00:00 2001
From: Slavek Kabrda <bkabrda at redhat.com>
Date: Mon, 1 Jun 2015 11:45:17 +0200
Subject: Introduce python3 supbackage. Patch by Adam Miller.
diff --git a/python-versiontools.spec b/python-versiontools.spec
index e52bbd2..ef5859f 100644
--- a/python-versiontools.spec
+++ b/python-versiontools.spec
@@ -1,25 +1,48 @@
+%if 0%{?fedora}
+%global with_python3 1
+%endif #fedora
+
%global pypi_name versiontools
Name: python-versiontools
Version: 1.9.1
-Release: 6%{?dist}
+Release: 7%{?dist}
Summary: Smart replacement for plain tuple used in __version__
License: LGPLv3
URL: https://launchpad.net/versiontools
Source0: http://pypi.python.org/packages/source/v/versiontools/versiontools-1.9.1.tar.gz
+# Update tests for python 3.4
+Patch0: versiontools-1.9.1-py34-tests.patch
+
BuildArch: noarch
BuildRequires: python-devel
BuildRequires: python-setuptools
BuildRequires: python-sphinx
BuildRequires: python-nose
+%if 0%{?with_python3}
+BuildRequires: python3-devel
+BuildRequires: python3-setuptools
+BuildRequires: python3-sphinx
+BuildRequires: python3-nose
+%endif # with_python3
+
%description
-Smart replacement for plain tuple used in __version__
+%{summary}
+
+%if 0%{?with_python3}
+%package -n python3-%{pypi_name}
+Summary: Smart replacement for plain tuple used in __version__
+
+%description -n python3-%{pypi_name}
+%{summary}
+%endif # with_python3
%prep
%setup -q -n %{pypi_name}-%{version}
+%patch0 -p0
# remove bundled egg-info
rm -rf %{pypi_name}.egg-info
# generate html docs
@@ -27,26 +50,58 @@ sphinx-build doc html
# remove the sphinx-build leftovers
rm -rf html/.{doctrees,buildinfo}
+%if 0%{?with_python3}
+rm -rf %{py3dir}
+cp -a . %{py3dir}
+pushd %{py3dir}
+find %{py3dir} -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python3}|'
+popd
+%endif # with_python3
%build
%{__python} setup.py build
+%if 0%{?with_python3}
+pushd %{py3dir}
+%{__python3} setup.py build
+popd
+%endif # with_python3
%install
%{__python} setup.py install -O1 --skip-build --root %{buildroot}
+%if 0%{?with_python3}
+pushd %{py3dir}
+%{__python3} setup.py install -O1 --skip-build --root %{buildroot}
+popd
+%endif # with_python3
%check
-%{__python} setup.py nosetests
+PYTHONPATH="${PWD}" %{__python} setup.py nosetests
+
+%if 0%{?with_python3}
+pushd %{py3dir}
+PYTHONPATH="${PWD}" %{__python3} setup.py nosetests
+popd
+%endif # with_python3
-
%files
%doc html
-%{python_sitelib}/%{pypi_name}
-%{python_sitelib}/%{pypi_name}-%{version}-py?.?.egg-info
+%{python2_sitelib}/%{pypi_name}
+%{python2_sitelib}/%{pypi_name}-%{version}-py2*.egg-info
+
+%if 0%{?with_python3}
+%files -n python3-%{pypi_name}
+%doc html
+%{python3_sitelib}/%{pypi_name}
+%{python3_sitelib}/%{pypi_name}-%{version}-py3*.egg-info
+%endif # with_python3
%changelog
+* Wed May 27 2015 Adam Miller <maxamillion at fedoraproject.org> - 1.9.1-7
+- Update package to provide python3 version as well
+
* Sun Jun 08 2014 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 1.9.1-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
diff --git a/versiontools-1.9.1-py34-tests.patch b/versiontools-1.9.1-py34-tests.patch
new file mode 100644
index 0000000..9e15458
--- /dev/null
+++ b/versiontools-1.9.1-py34-tests.patch
@@ -0,0 +1,26 @@
+--- versiontools/tests.py.orig 2015-05-27 16:53:42.497134369 -0500
++++ versiontools/tests.py 2015-05-27 17:04:26.721049909 -0500
+@@ -23,7 +23,7 @@
+ from unittest import TestCase
+
+ from versiontools import Version
+-from versiontools.setuptools_hooks import version as handle_version
++from versiontools.setuptools_hooks import version as handle_version
+
+
+ class VersionFormattingTests(TestCase):
+@@ -134,8 +134,12 @@
+ except Exception:
+ e = sys.exc_info()[1]
+ self.assertTrue(isinstance(e, DistutilsSetupError))
+- self.assertEqual(str(e), "Unable to import 'nonexisting': "
+- "No module named nonexisting")
++ if sys.version_info[:1] < (3,):
++ self.assertEqual(str(e), "Unable to import 'nonexisting': "
++ "No module named nonexisting")
++ else:
++ self.assertEqual(str(e), "Unable to import 'nonexisting': "
++ "No module named 'nonexisting'")
+
+ def test_not_found(self):
+ version = ':versiontools:versiontools:__nonexisting__'
--
cgit v0.10.2
http://pkgs.fedoraproject.org/cgit/python-versiontools.git/commit/?h=master&id=1a7c27366442c1339ed5b99de75f3260ff3cd5b4
More information about the scm-commits
mailing list