%global python3_pkgversion 3.11 %global github_owner gabrielfalcao %global github_name HTTPretty %global srcname httpretty %if 0%{?fedora} %global run_tests 1 %else # missing deps in epel9 %global run_tests 0 %endif Name: python-httpretty Version: 1.1.4 Release: 2.ac14.py3.11%{?dist} Summary: HTTP request mock tool for Python License: MIT URL: https://github.com/%{github_owner}/%{github_name} Source0: %{pypi_source} # Avoid unnecessary remote access requirement (note: test only actually # does a remote connection after PR #313) Patch1: python-httpretty-fakesock_getpeercert_noconnect.patch # Remote access (these tests were skipped upstream in <= 0.9.7) Patch2: skip-test_passthrough.patch # Remove timeout, which causes some tests to fail in Koji # # Fixes RHBZ#2046877 Patch3: test_response-no-within.patch # https://github.com/gabrielfalcao/HTTPretty/issues/457 Patch4: test_handle_slashes.patch # https://github.com/gabrielfalcao/HTTPretty/pull/479/files # Fixes RHBZ#2261569 Patch5: chunked_requests_handled_by_urllib3.patch BuildArch: noarch %global _description\ Once upon a time a python developer wanted to use a RESTful API, everything was\ fine but until the day he needed to test the code that hits the RESTful API:\ what if the API server is down? What if its content has changed?\ Don't worry, HTTPretty is here for you. %description %_description %package -n python%{python3_pkgversion}-httpretty Summary: HTTP request mock tool for Python 3 Requires: python%{python3_pkgversion}-six BuildRequires: python%{python3_pkgversion}-devel BuildRequires: python%{python3_pkgversion}-setuptools %if %{run_tests} BuildRequires: python%{python3_pkgversion}-httplib2 BuildRequires: python%{python3_pkgversion}-mock BuildRequires: python%{python3_pkgversion}-nose BuildRequires: python%{python3_pkgversion}-requests BuildRequires: python%{python3_pkgversion}-sure BuildRequires: python%{python3_pkgversion}-urllib3 BuildRequires: python%{python3_pkgversion}-tornado BuildRequires: python%{python3_pkgversion}-eventlet BuildRequires: python%{python3_pkgversion}-freezegun BuildRequires: python%{python3_pkgversion}-redis %endif %description -n python%{python3_pkgversion}-httpretty Once upon a time a python developer wanted to use a RESTful API, everything was fine but until the day he needed to test the code that hits the RESTful API: what if the API server is down? What if its content has changed? Don't worry, HTTPretty is here for you. %prep %autosetup -n httpretty-%{version} -p1 # Alternative for building from commit tarball #autosetup -n %%{github_name}-%%{github_commit} -p1 # nose plugins we don't have yet sed -i 's/^with-randomly = 1$//' setup.cfg sed -i 's/^rednose = 1$//' setup.cfg %build %py3_build %install %py3_install %check %if %{run_tests} %{__python3} -m nose -v %endif for b in $(find %{buildroot}%{_bindir}/ -type f) ; do mv "$b" $(sed -re "s|(.*)$|\1-%{python3_pkgversion}|"<<<"$b"); done for m in $(find %{buildroot}%{_mandir}/ -type f) ; do mv "$m" $(sed -re "s|(.*).([1-8])(.*)$|\1-%{python3_pkgversion}.\2\3|"<<<"$m"); done for m in $(find %{buildroot}%{_datadir}/locale/* -type f) ; do mv "$m" $(sed -re "s|(.*).mo$|\1-%{python3_pkgversion}.mo|"<<<"$m"); done for l in $(find %{buildroot}/usr/lib64/lib* -type f -o -type l) ; do mv "$l" $(sed -re "s|(.*).so(.*)$|\1-py%{python3_pkgversion}.so\2|"<<<"$l"); done for p in $(find %{buildroot}/usr/lib64/pkgconfig/* -type f) ; do mv "$p" $(sed -re "s|(.*).pc$|\1-py%{python3_pkgversion}.pc|"<<<"$p"); done %files -n python%{python3_pkgversion}-httpretty %doc README.rst %license COPYING %{python3_sitelib}/httpretty %{python3_sitelib}/httpretty-%{version}-py%{python3_version}.egg-info %changelog * Sat Apr 20 2024 Ding-Yi Chen - 1.1.4-2.ac14.py3.11 - Cut corner packaging