python-urllib3/python-urllib3.spec

242 lines
7.6 KiB
RPMSpec
Raw Normal View History

2019-09-27 18:36:54 +02:00
%define module urllib3
2012-04-27 05:20:09 +04:00
2024-01-27 18:56:34 +00:00
Summary: Python HTTP library
2017-01-17 13:15:48 +10:00
Name: python-%{module}
2024-01-27 18:56:34 +00:00
Version: 1.26.18
2018-09-10 13:16:56 +03:00
Release: 1
2017-01-17 13:15:48 +10:00
License: MIT
Group: Development/Python
2024-01-27 18:56:34 +00:00
URL: https://urllib3.readthedocs.io
#Source0: https://files.pythonhosted.org/packages/cb/cf/871177f1fc795c6c10787bc0e1f27bb6cf7b81dbde399fd35860472cecbc/urllib3-1.26.4.tar.gz
Source0: https://github.com/urllib3/urllib3/archive/%{version}/%{name}-%{version}.tar.gz
2017-01-17 13:15:48 +10:00
Source1: ssl_match_hostname_py3.py
BuildArch: noarch
2024-01-27 18:56:34 +00:00
BuildRequires: python-setuptools
BuildRequires: python-six
BuildRequires: pkgconfig(python)
# For unittests
BuildRequires: python-mock
BuildRequires: python-nose
BuildRequires: python-tornado
Requires: python-six
Requires: rootcerts
%description
The urllib3 module is a powerful, sanity-friendly HTTP client for Python. It
offers some features that are missing from the Python standard libraries
(urllib and urllib2):
* Thread safety.
* Connection pooling.
* Client-side SSL/TLS verification.
* File uploads with multipart encoding.
* Helpers for retrying requests and dealing with HTTP redirects.
* Support for gzip and deflate encoding.
* Proxy support for HTTP and SOCKS.
The Python standard libraries have little to do with each other. They were
designed to be independent and standalone, each solving a different scope of
problems, and urllib3 follows in a similar vein.
This package contains the python2 files.
2024-01-27 18:56:34 +00:00
%files
%doc CHANGES.rst README.rst
%{py_puresitedir}/*
#----------------------------------------------------------------------------
%package -n python3-%{module}
Summary: Python 3 HTTP library
Group: Development/Python
2024-01-27 18:56:34 +00:00
BuildRequires: python3-setuptools
BuildRequires: python3-six
BuildRequires: pkgconfig(python3)
2019-09-27 18:36:54 +02:00
# For unittests
2024-01-27 18:56:34 +00:00
BuildRequires: python3-mock
BuildRequires: python3-nose
BuildRequires: python3-tornado
Requires: python3-six
2017-01-17 13:15:48 +10:00
Requires: rootcerts
2012-04-27 05:20:09 +04:00
2024-01-27 18:56:34 +00:00
%description -n python3-%{module}
2019-09-27 18:36:54 +02:00
The urllib3 module is a powerful, sanity-friendly HTTP client for Python. It
offers some features that are missing from the Python standard libraries
(urllib and urllib2):
* Thread safety.
* Connection pooling.
* Client-side SSL/TLS verification.
* File uploads with multipart encoding.
* Helpers for retrying requests and dealing with HTTP redirects.
* Support for gzip and deflate encoding.
* Proxy support for HTTP and SOCKS.
The Python standard libraries have little to do with each other. They were
designed to be independent and standalone, each solving a different scope of
problems, and urllib3 follows in a similar vein.
This package contains the python3 files.
2012-04-27 05:20:09 +04:00
2024-01-27 18:56:34 +00:00
%files -n python3-%{module}
%doc CHANGES.rst README.rst
%{py3_puresitedir}/*
2017-01-17 13:15:48 +10:00
#----------------------------------------------------------------------------
2024-01-27 18:56:34 +00:00
%package -n python38-%{module}
2019-09-27 18:36:54 +02:00
Summary: Python 3 HTTP library
2017-01-17 13:15:48 +10:00
Group: Development/Python
2024-01-27 18:56:34 +00:00
BuildRequires: python38-setuptools
BuildRequires: python38-six
BuildRequires: python38-devel
2017-01-17 13:15:48 +10:00
# For unittests
2024-01-27 18:56:34 +00:00
BuildRequires: python38-mock
BuildRequires: python38-nose
BuildRequires: python38-tornado
Requires: python38-six
2017-01-17 13:15:48 +10:00
Requires: rootcerts
2015-10-12 10:55:37 +03:00
2024-01-27 18:56:34 +00:00
%description -n python38-%{module}
2019-09-27 18:36:54 +02:00
The urllib3 module is a powerful, sanity-friendly HTTP client for Python. It
offers some features that are missing from the Python standard libraries
(urllib and urllib2):
* Thread safety.
* Connection pooling.
* Client-side SSL/TLS verification.
* File uploads with multipart encoding.
* Helpers for retrying requests and dealing with HTTP redirects.
* Support for gzip and deflate encoding.
* Proxy support for HTTP and SOCKS.
The Python standard libraries have little to do with each other. They were
designed to be independent and standalone, each solving a different scope of
problems, and urllib3 follows in a similar vein.
This package contains the python3 files.
2015-10-12 10:55:37 +03:00
2024-01-27 18:56:34 +00:00
%files -n python38-%{module}
%doc CHANGES.rst README.rst
%{py38_puresitedir}/*
2017-01-17 13:15:48 +10:00
#----------------------------------------------------------------------------
2012-04-27 05:20:09 +04:00
%prep
%setup -q -n %{module}-%{version}
2019-09-27 18:36:54 +02:00
#apply_patches
2012-04-27 05:20:09 +04:00
2019-09-27 18:36:54 +02:00
# Prepare python3 dirs
2015-10-12 10:55:37 +03:00
cp -a . %{py3dir}
2024-01-27 18:56:34 +00:00
cp -a . %{py38dir}
2019-09-27 18:36:54 +02:00
2015-10-12 10:55:37 +03:00
%build
2019-09-27 18:36:54 +02:00
# Build first the python2 stuff...
2024-01-27 18:56:34 +00:00
#{__python2} setup.py build
2019-09-27 18:36:54 +02:00
# ... next the python3 stuff
2024-01-27 18:56:34 +00:00
%py_build
2015-10-12 10:55:37 +03:00
pushd %{py3dir}
2024-01-27 18:56:34 +00:00
# {__python3} setup.py build
%py3_build
2015-10-12 10:55:37 +03:00
popd
2024-01-27 18:56:34 +00:00
pushd %{py38dir}
%py38_build
popd
2019-09-27 18:36:54 +02:00
2012-04-27 05:20:09 +04:00
%install
2019-09-27 18:36:54 +02:00
################
# Install first the python2 stuff...
2024-01-27 18:56:34 +00:00
#{__python2} setup.py install --skip-build --root %{buildroot}
%py_install
2015-10-12 10:55:37 +03:00
rm -rf %{buildroot}/%{py_puresitedir}/urllib3/packages/six.py*
rm -rf %{buildroot}/%{py_puresitedir}/urllib3/packages/ssl_match_hostname/
mkdir -p %{buildroot}/%{py_puresitedir}/urllib3/packages/
ln -s ../../six.py %{buildroot}/%{py_puresitedir}/urllib3/packages/six.py
ln -s ../../six.pyc %{buildroot}/%{py_puresitedir}/urllib3/packages/six.pyc
ln -s ../../six.pyo %{buildroot}/%{py_puresitedir}/urllib3/packages/six.pyo
ln -s ../../backports/ssl_match_hostname %{buildroot}/%{py_puresitedir}/urllib3/packages/ssl_match_hostname
# dummyserver is part of the unittest framework
rm -rf %{buildroot}%{py_puresitedir}/dummyserver
2019-09-27 18:36:54 +02:00
###############
# ... next the python3 stuff
2015-10-12 10:55:37 +03:00
pushd %{py3dir}
2024-01-27 18:56:34 +00:00
# {__python3} setup.py install --skip-build --root %{buildroot}
%py3_install
2015-10-12 10:55:37 +03:00
2019-09-27 18:36:54 +02:00
rm -rf %{buildroot}/%{py3_puresitedir}/urllib3/packages/six.py*
rm -rf %{buildroot}/%{py3_puresitedir}/urllib3/packages/ssl_match_hostname/
2015-10-12 10:55:37 +03:00
2019-09-27 18:36:54 +02:00
mkdir -p %{buildroot}/%{py3_puresitedir}/urllib3/packages/
ln -s ../../six.py %{buildroot}/%{py3_puresitedir}/urllib3/packages/six.py
ln -s ../../six.pyc %{buildroot}/%{py3_puresitedir}/urllib3/packages/six.pyc
ln -s ../../six.pyo %{buildroot}/%{py3_puresitedir}/urllib3/packages/six.pyo
cp %{SOURCE1} %{buildroot}/%{py3_puresitedir}/urllib3/packages/ssl_match_hostname.py
2015-10-12 10:55:37 +03:00
2019-09-27 18:36:54 +02:00
# dummyserver is part of the unittest framework
rm -rf %{buildroot}%{py3_puresitedir}/dummyserver
2015-10-12 10:55:37 +03:00
popd
2012-04-27 05:20:09 +04:00
2024-01-27 18:56:34 +00:00
pushd %{py38dir}
# {__python38} setup.py install --skip-build --root %{buildroot}
%py38_install
rm -rf %{buildroot}/%{py38_puresitedir}/urllib3/packages/six.py*
rm -rf %{buildroot}/%{py38_puresitedir}/urllib3/packages/ssl_match_hostname/
mkdir -p %{buildroot}/%{py38_puresitedir}/urllib3/packages/
ln -s ../../six.py %{buildroot}/%{py38_puresitedir}/urllib3/packages/six.py
ln -s ../../six.pyc %{buildroot}/%{py38_puresitedir}/urllib3/packages/six.pyc
ln -s ../../six.pyo %{buildroot}/%{py38_puresitedir}/urllib3/packages/six.pyo
cp %{SOURCE1} %{buildroot}/%{py38_puresitedir}/urllib3/packages/ssl_match_hostname.py
# dummyserver is part of the unittest framework
rm -rf %{buildroot}%{py38_puresitedir}/dummyserver
popd
%pretrans -p <lua>
path = "%{py_puresitedir}/urllib3/packages/ssl_match_hostname"
st = posix.stat(path)
if st and st.type == "directory" then
status = os.rename(path, path .. ".rpmmoved")
if not status then
suffix = 0
while not status do
suffix = suffix + 1
status = os.rename(path .. ".rpmmoved", path .. ".rpmmoved." .. suffix)
end
os.rename(path, path .. ".rpmmoved")
end
end
%pretrans -p <lua> -n python3-%{module}
path = "%{py3_puresitedir}/urllib3/packages/ssl_match_hostname"
st = posix.stat(path)
if st and st.type == "directory" then
status = os.rename(path, path .. ".rpmmoved")
if not status then
suffix = 0
while not status do
suffix = suffix + 1
status = os.rename(path .. ".rpmmoved", path .. ".rpmmoved." .. suffix)
end
os.rename(path, path .. ".rpmmoved")
end
end
2024-01-27 18:56:34 +00:00
%pretrans -p <lua> -n python38-%{module}
path = "%{py38_puresitedir}/urllib3/packages/ssl_match_hostname"
st = posix.stat(path)
if st and st.type == "directory" then
status = os.rename(path, path .. ".rpmmoved")
if not status then
suffix = 0
while not status do
suffix = suffix + 1
status = os.rename(path .. ".rpmmoved", path .. ".rpmmoved." .. suffix)
end
os.rename(path, path .. ".rpmmoved")
end
end