From a186ca8a03234e537e0979b82076cf6916588bd5 Mon Sep 17 00:00:00 2001
From: Chandan Kumar <chkumar246@gmail.com>
Date: Fri, 4 Sep 2015 02:04:37 +0530
Subject: [PATCH] Added python2 and python 3 subpackage

- Added python2 and python3 subpackage
- Bumped to latest version 3.4.0.3
---
 python-singledispatch.spec | 90 +++++++++++++++++++++++++++++++++++++---------
 1 file changed, 73 insertions(+), 17 deletions(-)

diff --git a/python-singledispatch.spec b/python-singledispatch.spec
index c6bb864..be5d563 100644
--- a/python-singledispatch.spec
+++ b/python-singledispatch.spec
@@ -1,34 +1,68 @@
-# Created by pyp2rpm-1.0.1
 %global pypi_name singledispatch
-%{!?__python2:%global __python2 %{__python}}
+%{!?upstream_version: %global upstream_version %{version}%{?milestone}}
+
+%if 0%{?fedora}
+%global with_python3 1
+%endif
 
 Name:           python-%{pypi_name}
-Version:        3.4.0.2
-Release:        4%{?dist}
+Version:        3.4.0.3
+Release:        1%{?dist}
 Summary:        This library brings functools.singledispatch from Python 3.4 to Python 2.6-3.3
 
 License:        MIT
 URL:            http://docs.python.org/3/library/functools.html#functools.singledispatch
 Source0:        https://pypi.python.org/packages/source/s/%{pypi_name}/%{pypi_name}-%{version}.tar.gz
 BuildArch:      noarch
- 
+
+%description
+PEP 443 proposed to expose a mechanism in the functools standard library
+module in Python 3.4 that provides a simple form of generic programming 
+known as single-dispatch generic functions.
+
+This library is a backport of this functionality to Python 2.6 - 3.3.
+
+%package -n python2-%{pypi_name}
+Summary:        This library brings functools.singledispatch from Python 3.4 to Python 2.6-3.3
+%{?python_provide:%python_provide python2-%{pypi_name}}
+# python_provide does not exist in CBS Cloud buildroot
+Provides:       python-%{pypi_name} = %{upstream_version}
+Obsoletes:      python-%{pypi_name} < %{upstream_version}
+
 BuildRequires:  python2-devel
 BuildRequires:  python-setuptools
 BuildRequires:  python-six
- 
+
 Requires:       python-six
-%if 0%{?rhel} == 6
-Requires:       python-ordereddict
-BuildRequires:  python-ordereddict
-%endif
 
+%description -n python2-%{pypi_name}
+PEP 443 proposed to expose a mechanism in the functools standard library
+module in Python 3.4 that provides a simple form of generic programming 
+known as single-dispatch generic functions.
 
-%description
+This library is a backport of this functionality to Python 2.6 - 3.3.
+
+# python3 packaging stuff
+%if 0%{?with_python3}
+%package -n python3-%{pypi_name}
+Summary:        This library brings functools.singledispatch from Python 3.4 to Python 2.6-3.3
+%{?python_provide:%python_provide python3-%{pypi_name}}
+
+BuildRequires:  python3-devel
+BuildRequires:  python3-setuptools
+BuildRequires:  python3-six
+
+Requires:       python3-six
+%endif
+
+%if 0%{?with_python3}
+%description -n python3-%{pypi_name}
 PEP 443 proposed to expose a mechanism in the functools standard library
 module in Python 3.4 that provides a simple form of generic programming 
 known as single-dispatch generic functions.
 
 This library is a backport of this functionality to Python 2.6 - 3.3.
+%endif
 
 %prep
 %setup -q -n %{pypi_name}-%{version}
@@ -39,25 +73,47 @@ rm -rf %{pypi_name}.egg-info
 sed -i '1d' singledispatch.py
 sed -i '1d' singledispatch_helpers.py
 
-
-
 %build
 %{__python2} setup.py build
 
+%if 0%{?with_python3}
+%{__python3} setup.py build
+%endif
 
 %install
 %{__python2} setup.py install --skip-build --root %{buildroot}
 
+%if 0%{?with_python3}
+%{__python3} setup.py install --skip-build --root %{buildroot}
+%endif
+
 %check
 %{__python2} setup.py test
 
-%files
+%if 0%{?with_python3}
+%{__python3} setup.py test
+%endif
+
+%files -n python2-%{pypi_name}
 %doc README.rst
-%{python_sitelib}/%{pypi_name}-%{version}-py?.?.egg-info
-%{python_sitelib}/%{pypi_name}.py*
-%{python_sitelib}/%{pypi_name}_helpers.py*
+%{python2_sitelib}/%{pypi_name}-%{version}-py?.?.egg-info
+%{python2_sitelib}/%{pypi_name}.py*
+%{python2_sitelib}/%{pypi_name}_helpers.py*
+
+%if 0%{?with_python3}
+%files -n python3-%{pypi_name}
+%doc README.rst
+%{python3_sitelib}/%{pypi_name}-%{version}-py?.?.egg-info
+%{python3_sitelib}/%{pypi_name}.py*
+%{python3_sitelib}/%{pypi_name}_helpers.py*
+%{python3_sitelib}/__pycache__/*
+%endif
 
 %changelog
+* Fri Sep 04 2015 Chandan Kumar <chkumar246@gmail.com> - 3.4.0.3-1
+- Added python2 and python3 subpackage
+- updated the package to 3.4.0.3
+
 * Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.4.0.2-4
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
 
-- 
2.4.0

