%global pypi_name twodict

%global common_desc \
TwoWayOrderedDict is a custom dictionary in which one can get the \
key:value relationship but can also get the value:key relationship. \
It also remembers the order in which the items were inserted and \
supports almost all the features of the built-in dict.

%if 0%{?rhel} >= 7
%global with_python3 1
%endif

Name:           python-%{pypi_name}
Version:        1.2
Release:        2%{?dist}
Summary:        Simple two-way ordered dictionary for Python

License:        Unlicense
URL:			https://pypi.python.org/pypi/python-twodict
Source0:		https://files.pythonhosted.org/packages/source/a/%{pypi_name}/%{pypi_name}-%{version}.tar.gz
BuildArch:      noarch


%description
%{common_desc}

%package -n	python2-%{pypi_name}
Summary:        Simple two-way ordered dictionary for Python
%{?python_provide:%python_provide python2-%{pypi_name}}

BuildRequires:  python2-devel
BuildRequires:	python2-setuptools

%description -n python2-%{pypi_name}
%{common_desc}

%if 0%{?with_python3}
%package -n	python3-%{pypi_name}
Summary:        Simple two-way ordered dictionary for Python
%{?python_provide:%python_provide python3-%{pypi_name}}

BuildRequires:	python3-devel
BuildRequires:	python3-setuptools

%description -n python3-%{pypi_name}
%{common_desc}
%endif

%prep
%autosetup -n %{pypi_name}-%{version}

%build
%py2_build

%if 0%{?with_python3}
%py3_build
%endif

%install
%py2_install

%if 0%{?with_python3}
%py3_install
%endif


%files -n python2-%{pypi_name}
%license LICENSE
%doc README.md
%{python2_sitelib}/%{pypi_name}*
%{python2_sitelib}/%{pypi_name}-%{version}-*.egg-info

%if 0%{?with_python3}
%files -n python3-%{pypi_name}
%license LICENSE
%doc README.md
%{python3_sitelib}/%{pypi_name}*
%{python3_sitelib}/%{pypi_name}-%{version}-*.egg-info
%{python3_sitelib}/__pycache__/%{pypi_name}.*.py*
%endif

%changelog
* Fri Aug 14 2020 Jean-Marc Liger <ligenix@iscp.fr> - 1.2-2
- Rebuild for COPR EL7 and EL8

* Thu Oct 19 2017 d.builder@moens.cc - 1.2-1
- Initial package