%global pypi_name requests

%{?scl:%global python3_pkgversion %{nil}}
%{?scl:%scl_package python-%{pypi_name}}
%{!?scl:%global pkg_name %{name}}

Name:           %{?scl_prefix}python%{python3_pkgversion}-%{pypi_name}
Version:        2.21.0
Release:        1%{?dist}
Summary:        Python HTTP for Humans

Group:          Development/Libraries
License:        ASL 2.0
URL:            https://pypi.io/project/%{pypi_name}
Source0:        https://pypi.io/packages/source/%(echo "%{pypi_name}" | cut -c 1)/%{pypi_name}/%{pypi_name}-%{version}.tar.gz

BuildArch:      noarch
BuildRequires:  %{?scl_prefix_python}python%{python3_pkgversion}-devel
BuildRequires:  %{?scl_prefix_python}python%{python3_pkgversion}-setuptools
%{?scl:BuildRequires: %{scl}-build %{scl}-runtime}

Requires:       %{?scl_prefix}python%{python3_pkgversion}-chardet >= 3.0.2
Requires:       %{?scl_prefix}python%{python3_pkgversion}-chardet < 3.1.0
Requires:       %{?scl_prefix}python%{python3_pkgversion}-idna >= 2.5
Requires:       %{?scl_prefix}python%{python3_pkgversion}-idna < 2.9
Requires:       %{?scl_prefix}python%{python3_pkgversion}-urllib3 >= 1.21.1
Requires:       %{?scl_prefix}python%{python3_pkgversion}-urllib3 < 1.25
Requires:       %{?scl_prefix}python%{python3_pkgversion}-certifi >= 2017.4.17
%{?scl:Requires: %{scl}-runtime}

%description
Most existing Python modules for sending HTTP requests are extremely verbose and
cumbersome. Python’s built-in urllib2 module provides most of the HTTP
capabilities you should need, but the API is thoroughly broken. This library is
designed to make HTTP requests easy for developers.

%prep
%setup -q -n %{pypi_name}-%{version}
rm -rf %{pypi_name}.egg-info

%build
%{?scl:scl enable %{scl} "}
%{__python3} setup.py build
%{?scl:"}

%install
%{?scl:scl enable %{scl} "}
%{__python3} \
  setup.py \
  install \
  -O1 \
  --skip-build \
  --root %{buildroot} \
  --install-purelib %{python3_sitelib}
%{?scl:"}

%files
%license LICENSE
%doc HISTORY.md
%doc README.md
%{python3_sitelib}/%{pypi_name}
%{python3_sitelib}/%{pypi_name}-%{version}-py?.?.egg-info

%changelog
* Tue Dec 11 2018 Daniel Uvehag <daniel.uvehag@gmail.com> - 2.21.0-1
- Initial package.