%global pypiname tld

Name:           python-%{pypiname}
Version:        0.7.9
Release:        1%{?dist}
Summary:        Extract the top level domain from the URL given

License:        MPL GPLv2 LGPLv2
URL:            https://github.com/barseghyanartur/tld
Source0:        https://files.pythonhosted.org/packages/source/t/%{pypiname}/%{pypiname}-%{version}.tar.gz

BuildArch:      noarch

BuildRequires:  python2-devel
BuildRequires:  python2-six
BuildRequires:  python3-devel
BuildRequires:  python3-six

%description
Extract the top level domain (TLD) from the URL given. List
of TLD names is taken from Mozilla.

%package -n python2-%{pypiname}

Summary:        Extract the top level domain from the URL given

Requires:       python3-six

%{?python_provide:%python_provide python2-%{pypiname}}

%description -n python2-%{pypiname}
Extract the top level domain (TLD) from the URL given. List
of TLD names is taken from Mozilla.

%package -n python3-%{pypiname}

Summary:        Extract the top level domain from the URL given

Requires:       python3-six

%{?python_provide:%python_provide python3-%{pypiname}}

%description -n python3-%{pypiname}
Extract the top level domain (TLD) from the URL given. List
of TLD names is taken from Mozilla.

%prep
%setup -q -n %{pypiname}-%{version}

%build
%py2_build
%py3_build

%install
%py2_install
%py3_install

# Please see:
# https://github.com/barseghyanartur/tld/pull/22
%files -n python2-%{pypiname}
%{python2_sitelib}/*

%files -n python3-%{pypiname}
%{python3_sitelib}/*
%{_bindir}/*

%changelog
* Mon Dec 25 2017 williamjmorenor@gmail.com - 0.7.9-1
- Initial packaging