python38-urllib3/python38-urllib3.spec
2021-07-19 17:31:27 +03:00

95 lines
2.8 KiB
RPMSpec

%global __provides_exclude ^(python3egg|python3dist)
%global __requires_exclude ^(python3egg|python3dist)
%global srcname urllib3
# When bootstrapping Python, we cannot test this yet
%bcond_with tests
Name: python-%{srcname}
Version: 1.25.7
Release: 1
Summary: Python HTTP library with thread-safe connection pooling and file post
Group: Development/Python
License: MIT
URL: https://github.com/urllib3/urllib3
Source0: %{url}/archive/%{version}/%{srcname}-%{version}.tar.gz
# Unbundle ssl_match_hostname since we depend on it
Source1: ssl_match_hostname_py3.py
BuildArch: noarch
%description
Python HTTP module with connection pooling and file POST abilities.
%package -n python38-%{srcname}
Summary: Python3 HTTP library with thread-safe connection pooling and file post
Group: Development/Python
BuildRequires: python38-devel
BuildRequires: python38-setuptools
%if %{with tests}
BuildRequires: python3-nose
BuildRequires: python3-mock
BuildRequires: python3-six
BuildRequires: python3-pysocks
BuildRequires: python3-pytest
BuildRequires: python3-tornado
BuildRequires: python3-trustme
BuildRequires: python3-idna
%endif
Requires: ca-certificates
Requires: python38-idna
Requires: python38-six
Requires: python38-pysocks
%description -n python38-%{srcname}
Python3 HTTP module with connection pooling and file POST abilities.
%prep
%setup -qn %{srcname}-%{version}
# Drop the dummyserver tests in koji. They fail there in real builds, but not
# in scratch builds (weird).
rm -rf test/with_dummyserver/
# Don't run the Google App Engine tests
rm -rf test/appengine/
# Lots of these tests started failing, even for old versions, so it has something
# to do with Fedora in particular. They don't fail in upstream build infrastructure
rm -rf test/contrib/
# Tests for Python built without SSL, but Fedora builds with SSL. These tests
# fail when combined with the unbundling of backports-ssl_match_hostname
rm -f test/test_no_ssl.py
%build
%py38_build
%install
%py38_install
# Unbundle the Python 3 build
rm -rf %{buildroot}/%{python38_sitelib}/urllib3/packages/six.py*
rm -rf %{buildroot}/%{python38_sitelib}/urllib3/packages/__pycache__/six*
rm -rf %{buildroot}/%{python38_sitelib}/urllib3/packages/ssl_match_hostname/
mkdir -p %{buildroot}/%{python38_sitelib}/urllib3/packages/
cp -a %{SOURCE1} %{buildroot}/%{python38_sitelib}/urllib3/packages/ssl_match_hostname.py
ln -s %{python38_sitelib}/six.py %{buildroot}/%{python38_sitelib}/urllib3/packages/six.py
%if %{with tests}
%check
pushd test
PYTHONPATH=%{buildroot}%{python38_sitelib}:%{python38_sitelib} %{__python38} -m pytest -v
popd
%endif
%files -n python38-%{srcname}
%doc LICENSE.txt CHANGES.rst README.rst CONTRIBUTORS.txt
%{python38_sitelib}/urllib3/
%{python38_sitelib}/urllib3-*.egg-info/