%global pypi_name tldextract %if 0%{?rhel} && 0%{?rhel} <= 7 %bcond_with python3 %else %bcond_without python3 %endif Name: python-%{pypi_name} Version: 2.2.0 Release: 1%{?dist} Summary: Accurately separate the TLD from the registered domain and subdomains of a URL License: BSD URL: https://pypi.python.org/pypi/tldextract Source0: https://files.pythonhosted.org/packages/source/t/%{pypi_name}/%{pypi_name}-%{version}.tar.gz BuildArch: noarch BuildRequires: python2-devel BuildRequires: python2-pytest BuildRequires: python2-requests-file BuildRequires: python2-responses %if 0%{?rhel} && 0%{?rhel} <= 7 # EL7 has unversioned names for these packages BuildRequires: python-idna BuildRequires: python-requests BuildRequires: python-setuptools %else BuildRequires: python2-idna BuildRequires: python2-requests BuildRequires: python2-setuptools %endif %if %{with python3} BuildRequires: python3-devel BuildRequires: python3-idna BuildRequires: python3-pytest BuildRequires: python3-requests BuildRequires: python3-requests-file BuildRequires: python3-responses BuildRequires: python3-setuptools %endif %description Accurately separate the TLD from the registered domain and subdomains of a URL, using the Public Suffix List. By default, this includes the public ICANN TLDs and their exceptions. You can optionally support the Public Suffix List's private domains as well. %package -n python2-%{pypi_name} Summary: %{summary} %{?python_provide:%python_provide python2-%{pypi_name}} Requires: python2-requests-file %if 0%{?rhel} && 0%{?rhel} <= 7 # EL7 has unversioned names for these packages Requires: python-idna Requires: python-requests Requires: python-setuptools %else Requires: python2-idna Requires: python2-requests Requires: python2-setuptools %endif %description -n python2-%{pypi_name} Accurately separate the TLD from the registered domain and subdomains of a URL, using the Public Suffix List. By default, this includes the public ICANN TLDs and their exceptions. You can optionally support the Public Suffix List's private domains as well. This is the Python 2 version of the package. %if %{with python3} %package -n python3-%{pypi_name} Summary: %{summary} %{?python_provide:%python_provide python3-%{pypi_name}} Requires: python3-idna Requires: python3-requests Requires: python3-requests-file Requires: python3-setuptools %description -n python3-%{pypi_name} Accurately separate the TLD from the registered domain and subdomains of a URL, using the Public Suffix List. By default, this includes the public ICANN TLDs and their exceptions. You can optionally support the Public Suffix List's private domains as well. This is the Python 3 version of the package. %endif %prep %autosetup -n %{pypi_name}-%{version} # Remove bundled egg-info rm -rf %{pypi_name}.egg-info %build %py2_build %if %{with python3} %py3_build %endif %install %py2_install %if %{with python3} %py3_install %endif %check %{__python2} setup.py test %if %{with python3} %{__python3} setup.py test %endif %files -n python2-%{pypi_name} %license LICENSE %doc README.md %{python2_sitelib}/tldextract %{python2_sitelib}/tldextract-%{version}-py?.?.egg-info %if ! %{with python3} %{_bindir}/tldextract %endif %if %{with python3} %files -n python3-%{pypi_name} %license LICENSE %doc README.md %{python3_sitelib}/tldextract %{python3_sitelib}/tldextract-%{version}-py?.?.egg-info %{_bindir}/tldextract %endif %changelog * Thu Feb 15 2018 Eli Young - 2.2.0-1 - Initial package