From 3004f2a6c52f7c906072453897cdeeef0da918f9 Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Sep 15 2022 20:10:49 +0000 Subject: Don't apply werkzeug patches on EPEL 8, drop Python 2 compat EPEL 8 has ancient werkzeug, so don't apply the patches that are only correct for newer versions. Also patch out the version constraint on the werkzeug dep as it's not correct, httpbin actually still works fine with older werkzeug. --- diff --git a/python-httpbin.spec b/python-httpbin.spec index cf8046b..58dd361 100644 --- a/python-httpbin.spec +++ b/python-httpbin.spec @@ -1,7 +1,7 @@ # Not building on EPEL 6 due to incompatibility with Werkzeug < 0.9: # https://github.com/Runscope/httpbin/issue/317 -# Not building on EPEL 7 as brotli is not built for it +# Not building on EPEL 7 as several deps aren't available %global modname httpbin @@ -10,25 +10,14 @@ fantastic for testing POST requests, but doesn't let you control the response. \ This exists to cover all kinds of HTTP scenarios. Additional endpoints are \ being considered. All endpoint responses are JSON-encoded. -# Disable Python 2 builds for Fedora > 29, EPEL > 7 -%if 0%{?fedora} > 29 || 0%{?rhel} > 7 -%bcond_with python2 -%global obsolete2 1 -%else -%bcond_without python2 -%global obsolete2 0 -%endif - # Requirements for tests (BuildRequires) and run (Requires) -# EPEL builds do not provide python2-* # blinker is required by raven[flask], but python-raven package does # not depend on it, so we require it here -%global t_requires python2-brotli python2-flask python2-markupsafe python2-decorator python2-itsdangerous python2-blinker python2-raven python2-six python2-werkzeug -%global t3_requires python3-blinker python3-brotli python3-flask python3-markupsafe python3-decorator python3-itsdangerous python3-raven python3-six python3-werkzeug +%global t_requires python3-blinker python3-brotli python3-flask python3-markupsafe python3-decorator python3-itsdangerous python3-raven python3-six python3-werkzeug Name: python-%{modname} Version: 0.7.0 -Release: 20%{?dist} +Release: 21%{?dist} Summary: HTTP Request & Response Service, written in Python + Flask License: MIT @@ -46,7 +35,7 @@ Patch1: 0001-Use-Google-s-brotli-module-not-the-brotlipy-one.patch # Drop content length == 0 asserts, to support werkzeug>=0.15.1 # From https://github.com/postmanlabs/httpbin/pull/555 Patch2: 0002-Drop-content-length-0-asserts.patch -# Set Response.autocorrect_location_header = False as well as +# Set Response.autocorrect_location_header = False instead of # BaseResponse.autocorrect_location_header = False to support # werkzeug >= 2.0.0 # https://github.com/postmanlabs/httpbin/pull/649 @@ -57,27 +46,12 @@ BuildArch: noarch %description %{desc} -%if 0%{?with_python2} -%package -n python2-%{modname} -Summary: %{summary} -BuildRequires: python2-devel -BuildRequires: python2-setuptools -BuildRequires: %{t_requires} -Requires: %{t_requires} -%{?python_provide:%python_provide python2-%{modname}} - -%description -n python2-%{modname} -%{desc} - -This package provides the Python 2 implementation. -%endif # with python2 - %package -n python3-%{modname} Summary: %{summary} BuildRequires: python3-setuptools BuildRequires: python3-devel -BuildRequires: %{t3_requires} -Requires: %{t3_requires} +BuildRequires: %{t_requires} +Requires: %{t_requires} %{?python_provide:%python_provide python3-%{modname}} %if 0%{?obsolete2} Obsoletes: python2-%{modname} < %{version}-%{release} @@ -90,37 +64,36 @@ This package provides the Python 3 implementation. ################################################################################# %prep -%autosetup -n %{modname}-%{version} -p1 +%setup -q -n %{modname}-%{version} +%patch1 -p1 +# these patches shouldn't be applied on EPEL 7 o 8, where we're using +# ancient werkzeug +%if 0%{?fedora} || 0%{?rhel} > 8 +%patch2 -p1 +%patch3 -p1 +%endif + # no need for this to be executable chmod ugo-x httpbin/templates/forms-post.html +# this requirement is kinda bogus, it was added in +# https://github.com/postmanlabs/httpbin/commit/75c8317 but all that +# commit really does is drop a test assertion which was no longer true +# with newer werkzeug; the package and tests still actually work fine +# with older werkzeug +sed -i -e 's,werkzeug>=0.14.1,werkzeug,g' setup.py + %build -%if 0%{?with_python2} -%py2_build -%endif # with python2 %py3_build %install -%if 0%{?with_python2} -%py2_install -%endif # with python2 %py3_install ################################################################################# %check -%if 0%{?with_python2} -%{__python2} test_httpbin.py -%endif # with python2 %{__python3} test_httpbin.py ################################################################################# -%if 0%{?with_python2} -%files -n python2-%{modname} -%{python2_sitelib}/%{modname}* -%license LICENSE -%doc README.md AUTHORS -%endif # with python2 - %files -n python3-%{modname} %{python3_sitelib}/%{modname}* %license LICENSE @@ -128,6 +101,9 @@ chmod ugo-x httpbin/templates/forms-post.html ################################################################################# %changelog +* Thu Sep 15 2022 Adam Williamson - 0.7.0-21 +- Don't apply patches for modern werkzeug on EPEL 8 + * Fri Jul 22 2022 Fedora Release Engineering - 0.7.0-20 - Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild