%global srcname urllib3 %bcond_without tests Name: python-%{srcname} Version: 1.25.9 Release: 5 Summary: Sanity-friendly HTTP client for Python License: MIT URL: https://urllib3.readthedocs.io Source0: https://github.com/urllib3/urllib3/archive/%{version}/urllib3-%{version}.tar.gz Source1: ssl_match_hostname_py3.py BuildArch: noarch Patch0000: set-RECENT_DATE-not-be-older-than-2-years.patch Patch6000: backport-CVE-2021-33503.patch Patch6001: backport-Change-TARPIT_HOST-to-detect-isolated-network.patch Patch6002: backport-Do-not-insert-None-into-ConnectionPool-if-it-was-empty.patch %global _description \ HTTP library with thread-safe connection pooling, file post support,\ sanity friendly, and more. %description Python %_description %package -n python2-%{srcname} Summary: Sanity-friendly HTTP client for python2 %{?python_provide:%python_provide python2-urllib3} Requires: ca-certificates python2-six python2-backports-ssl_match_hostname Requires: python2-ipaddress python2-pysocks BuildRequires: python2-devel %if %{with tests} BuildRequires: python2-nose python2-coverage python2-mock python2-six python-trustme BuildRequires: python2-pysocks python2-pytest python2-tornado python2-backports-ssl_match_hostname %endif %description -n python2-urllib3 Python2 %_description %package -n python3-%{srcname} Summary: Python3 HTTP library with thread-safe connection pooling and file post BuildRequires: python3-devel %if %{with tests} BuildRequires: python3-nose python3-mock python3-six BuildRequires: python3-pysocks python3-pytest python3-tornado %endif Requires: ca-certificates python3-six python3-pysocks %description -n python3-urllib3 Python3 %_description %prep %autosetup -n %{srcname}-%{version} -p1 recent_date=$(date --date "7 month ago" +"%Y, %_m, %_d") sed -i "s/^RECENT_DATE = datetime.date(.*)/RECENT_DATE = datetime.date($recent_date)/" src/urllib3/connection.py #Failure use case circumvention rm -rf test/with_dummyserver/ rm -rf test/appengine/ rm -rf test/contrib/ rm -rf test/test_no_ssl.py %build %py2_build %py3_build %install %py2_install %py3_install rm -rf %{buildroot}%{python2_sitelib}/urllib3/packages/six.py* rm -rf %{buildroot}%{python2_sitelib}/urllib3/packages/ssl_match_hostname/ mkdir -p %{buildroot}/%{python2_sitelib}/urllib3/packages/ ln -s %{python2_sitelib}/six.py %{buildroot}/%{python2_sitelib}/urllib3/packages/six.py ln -s %{python2_sitelib}/six.pyc %{buildroot}/%{python2_sitelib}/urllib3/packages/six.pyc ln -s %{python2_sitelib}/six.pyo %{buildroot}/%{python2_sitelib}/urllib3/packages/six.pyo ln -s %{python2_sitelib}/backports/ssl_match_hostname %{buildroot}/%{python2_sitelib}/urllib3/packages/ssl_match_hostname rm -rf %{buildroot}%{python3_sitelib}/urllib3/packages/six.py* rm -rf %{buildroot}%{python3_sitelib}/urllib3/packages/__pycache__/six* rm -rf %{buildroot}%{python3_sitelib}/urllib3/packages/ssl_match_hostname/ mkdir -p %{buildroot}/%{python3_sitelib}/urllib3/packages/ cp -a %{SOURCE1} %{buildroot}/%{python3_sitelib}/urllib3/packages/ssl_match_hostname.py ln -s %{python3_sitelib}/six.py %{buildroot}/%{python3_sitelib}/urllib3/packages/six.py ln -s %{python3_sitelib}/__pycache__/six.cpython-%{python3_version_nodots}.opt-1.pyc %{buildroot}/%{python3_sitelib}/urllib3/packages/__pycache__/ ln -s %{python3_sitelib}/__pycache__/six.cpython-%{python3_version_nodots}.pyc %{buildroot}/%{python3_sitelib}/urllib3/packages/__pycache__/ %if %{with tests} %check #we don't have python2-trustme,so we don't need check python2 #PYTHONPATH=%{buildroot}%{python2_sitelib}:%{python2_sitelib} %{__python2} -m pytest -v PYTHONPATH=%{buildroot}%{python3_sitelib}:%{python3_sitelib} %{__python3} -m pytest -v %endif %files -n python2-urllib3 %defattr(-,root,root) %license LICENSE.txt %doc CHANGES.rst README.rst CONTRIBUTORS.txt %{python2_sitelib}/urllib3/ %{python2_sitelib}/urllib3-*.egg-info %files -n python3-urllib3 %defattr(-,root,root) %license LICENSE.txt %doc CHANGES.rst README.rst CONTRIBUTORS.txt %{python3_sitelib}/urllib3/ %{python3_sitelib}/urllib3-*.egg-info %changelog * Thu Jan 5 2023 chenhaixing - 1.25.9-5 - Type:bugfix - CVE:NA - SUG:NA - DESC:modify RECENT_DATE in python-urllib3.spec to adapt time change * Sat Dec 04 2021 chxssg - 1.25.9-4 - Type:bugfix - CVE:NA - SUG:NA - DESC:do not insert none into connectionpool when it is empty * Mon Jul 05 2021 zhanzhimin - 1.25.9-3 - fix CVE-2021-33503 * Mon May 24 2021 sunguoshuai - 1.25.9-2 - fix check error by set RECENT_DATE * Wed Nov 25 2020 leiju - 1.25.9-1 - upgrade to 1.25.9 * Sat Oct 26 2019 openEuler Buildteam - 1.24.3-2 - optimize spec file. * Mon Sep 16 2019 openEuler Buildteam - 1.24.3-1 - Package init