7bedfd
%if 0%{?fedora}
7bedfd
%global with_python3 1
7bedfd
%endif
7bedfd
7bedfd
%global srcname idna
7bedfd
7bedfd
Name:           python-%{srcname}
7bedfd
Version:        2.4
7bedfd
Release:        1%{?dist}
7bedfd
Summary:        Internationalized Domain Names in Applications (IDNA)
7bedfd
7bedfd
License:        BSD and Python and Unicode
7bedfd
URL:            https://github.com/kjd/idna
7bedfd
Source0:        https://pypi.python.org/packages/source/i/%{srcname}/%{srcname}-%{version}.tar.gz
7bedfd
BuildArch:      noarch
7bedfd
7bedfd
BuildRequires:  python2-devel
7bedfd
BuildRequires:  python-setuptools
7bedfd
%if 0%{?with_python3}
7bedfd
BuildRequires:  python3-devel
7bedfd
BuildRequires:  python3-setuptools
7bedfd
%endif # with_python3
7bedfd
7bedfd
%description
7bedfd
A library to support the Internationalised Domain Names in Applications (IDNA)
7bedfd
protocol as specified in RFC 5891 <http://tools.ietf.org/html/rfc5891>.  This
7bedfd
version of the protocol is often referred to as "IDNA2008" and can produce
7bedfd
different results from the earlier standard from 2003.
7bedfd
7bedfd
The library is also intended to act as a suitable drop-in replacement for the
7bedfd
"encodings.idna" module that comes with the Python standard library but
7bedfd
currently only supports the older 2003 specification.
7bedfd
7bedfd
%if 0%{?with_python3}
7bedfd
%package -n python3-%{srcname}
7bedfd
Summary:        Internationalized Domain Names in Applications (IDNA)
7bedfd
7bedfd
%description -n python3-%{srcname}
7bedfd
A library to support the Internationalised Domain Names in Applications (IDNA)
7bedfd
protocol as specified in RFC 5891 <http://tools.ietf.org/html/rfc5891>.  This
7bedfd
version of the protocol is often referred to as "IDNA2008" and can produce
7bedfd
different results from the earlier standard from 2003.
7bedfd
7bedfd
The library is also intended to act as a suitable drop-in replacement for the
7bedfd
"encodings.idna" module that comes with the Python standard library but
7bedfd
currently only supports the older 2003 specification.
7bedfd
%endif # with_python3
7bedfd
7bedfd
%prep
7bedfd
%setup -q -n %{srcname}-%{version}
7bedfd
# Remove bundled egg-info
7bedfd
rm -rf %{srcname}.egg-info
7bedfd
7bedfd
%if 0%{?with_python3}
7bedfd
rm -rf %{py3dir}
7bedfd
cp -a . %{py3dir}
7bedfd
%endif # with_python3
7bedfd
7bedfd
7bedfd
7bedfd
%build
7bedfd
%{__python2} setup.py build
7bedfd
7bedfd
%if 0%{?with_python3}
7bedfd
pushd %{py3dir}
7bedfd
# Set LANG when building with python 3 due to
7bedfd
# https://github.com/kjd/idna/pull/4
7bedfd
LANG=en_US.UTF-8 %{__python3} setup.py build
7bedfd
popd
7bedfd
%endif # with_python3
7bedfd
7bedfd
%install
7bedfd
%if 0%{?with_python3}
7bedfd
pushd %{py3dir}
7bedfd
# Set LANG when building with python 3 due to
7bedfd
# https://github.com/kjd/idna/pull/4
7bedfd
LANG=en_US.UTF-8 %{__python3} setup.py install --skip-build --root %{buildroot}
7bedfd
popd
7bedfd
%endif # with_python3
7bedfd
7bedfd
%{__python2} setup.py install --skip-build --root %{buildroot}
7bedfd
7bedfd
%check
7bedfd
%{__python2} setup.py test
7bedfd
7bedfd
%if 0%{?with_python3}
7bedfd
pushd %{py3dir}
7bedfd
# Set LANG when building with python 3 due to
7bedfd
# https://github.com/kjd/idna/pull/4
7bedfd
LANG=en_US.UTF-8 %{__python3} setup.py test
7bedfd
popd
7bedfd
%endif # with_python3
7bedfd
7bedfd
7bedfd
%files
7bedfd
%doc README.rst HISTORY.rst LICENSE.rst
7bedfd
%{python2_sitelib}/%{srcname}
7bedfd
%{python2_sitelib}/%{srcname}-%{version}-py%{python2_version}.egg-info
7bedfd
7bedfd
%if 0%{?with_python3}
7bedfd
%files -n python3-%{srcname}
7bedfd
%doc README.rst HISTORY.rst LICENSE.rst
7bedfd
%{python3_sitelib}/%{srcname}
7bedfd
%{python3_sitelib}/%{srcname}-%{version}-py%{python3_version}.egg-info
7bedfd
%endif # with_python3
7bedfd
7bedfd
%changelog
7bedfd
* Wed Mar 01 2017 Paul Wouters <pwouters@redhat.com> - 2.4-1
7bedfd
- Resolves: rhbz#1425154 (2.3 broke API and upstream released 2.4)
7bedfd
7bedfd
* Tue Feb 28 2017 Paul Wouters <pwouters@redhat.com> - 2.3-1
7bedfd
- Resolves: rhbz#1425154 Rebase python-idna (more memfixes)
7bedfd
7bedfd
* Thu Feb 23 2017 Paul Wouters <pwouters@redhat.com> - 2.2-1
7bedfd
- Resolves: rhbz#1425154 Rebase python-idna to >= 2.1 for freeipa performance issue
7bedfd
7bedfd
* Thu Apr 07 2016 Paul Wouters <pwouters@redhat.com> - 2.0-1
7bedfd
- Resolves: rhbz#1297583 New package: python-idna