%{!?dotests: %define dotests 1} %define name python3-urllib3 %define srcname urllib3 %define version 1.25.7 %define release 1 %global __tar /opt/freeware/bin/tar %define is_python %(test -e /opt/freeware/bin/python3_32 && echo 1 || echo 0) %if %{is_python} %define python_sitelib %(python3_32 -c "from distutils.sysconfig import get_python_lib; print (get_python_lib(1))") %endif %define _libdir64 %{_prefix}/lib %define is_python_64 %(test -e /usr/bin/python3_64 && echo 1 || echo 0) %if %{is_python_64} %define python_sitelib64 %(python3 -c "from distutils.sysconfig import get_python_lib; print (get_python_lib(1))") %endif Summary: HTTP library with thread-safe connection pooling, file post, and more Name: %{name} Version: %{version} Release: %{release} Source0: %{srcname}-%{version}.tar.gz License: MIT Group: Development/Libraries BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot Prefix: %{_prefix} BuildArch: noarch Url: https://pypi.org/ Requires: python3 >= 3.7.3 BuildRequires: python3-pytest >= 5.3.1, python3-py >= 1.8.0, python3-pluggy >= 0.13.0 # to run test cases pip install trustme package %description Highlights - Re-use the same socket connection for multiple requests (HTTPConnectionPool and HTTPSConnectionPool) (with optional client-side certificate verification). - File posting (encode_multipart_formdata). - Built-in redirection and retries (optional). - Supports gzip and deflate decoding. - Thread-safe and sanity-safe. - Works with AppEngine, gevent, and eventlib. - Tested on Python 2.6+ and Python 3.3+, 100% unit test coverage. - Small and easy to understand codebase perfect for extending and building upon. For a more comprehensive solution, have a look at Requests which is also powered by urllib3. %prep %setup -q -n %{srcname}-%{version} %build python3 setup.py build %install [ -d "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT python3 setup.py install --skip-build --root ${RPM_BUILD_ROOT} %check skiplist='not test_select_interrupt_exception and not test_selector_error and not timeout and not test_request_host_header_ignores_fqdn_dot and not test_dotted_fqdn and not TestImportWithou tSSL' case $(uname -m) in ppc*) skiplist="$skiplist and not test_select_timing and not test_select_multiple_interrupts_with_event and not test_interrupt_wait_for_read_with_event and not test_select_interrupt_with_event";; esac # the certificate validation is much stricter in new openssl so skip # tests which would not validate it skiplist="$skiplist and not test_client_no_intermediate" export PYTHONDONTWRITEBYTECODE=1 export LANG="en_US.UTF8" (python3 -m pytest -k "${skiplist}" || true) %clean [ "${RPM_BUILD_ROOT}" != "/" ] && rm -rf ${RPM_BUILD_ROOT} %files %defattr(-,root,system,-) %{python_sitelib}/* %changelog * Sat Nov 16 2019 Baanu Tumma - 1.25.7-1 - First version for AIX, built using python3