diff --git a/.python-werkzeug.metadata b/.python-werkzeug.metadata index 16a5f88..c083db8 100644 --- a/.python-werkzeug.metadata +++ b/.python-werkzeug.metadata @@ -1,2 +1 @@ -fe5c3e287ae54cfefc25fd3eec800599b8026b49 SOURCES/Werkzeug-0.12.2.tar.gz -d17d2797ce629f561c025229c30ab0622b2ab2d8 SOURCES/werkzeug-sphinx-theme.tar.gz +b3f2c40825f22d2a249abd7d411a5d67830307ad SOURCES/Werkzeug-2.2.3.tar.gz diff --git a/SOURCES/0001-ProxyFix-supports-IPv6.patch b/SOURCES/0001-ProxyFix-supports-IPv6.patch new file mode 100644 index 0000000..1fbd71a --- /dev/null +++ b/SOURCES/0001-ProxyFix-supports-IPv6.patch @@ -0,0 +1,72 @@ +From 18872bf5807c96e78dc25b420fac54ac7c09e4a8 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Harald=20Jens=C3=A5s?= +Date: Mon, 18 Oct 2021 20:09:29 +0200 +Subject: [PATCH] ProxyFix supports IPv6 + +--- + src/werkzeug/middleware/proxy_fix.py | 14 +++++++------- + tests/middleware/test_proxy_fix.py | 18 ++++++++++++++++++ + 2 files changed, 25 insertions(+), 7 deletions(-) + +diff --git a/src/werkzeug/middleware/proxy_fix.py b/src/werkzeug/middleware/proxy_fix.py +index e90b1b34..4cef7cc8 100644 +--- a/src/werkzeug/middleware/proxy_fix.py ++++ b/src/werkzeug/middleware/proxy_fix.py +@@ -163,18 +163,18 @@ class ProxyFix: + + x_host = self._get_real_value(self.x_host, environ_get("HTTP_X_FORWARDED_HOST")) + if x_host: +- environ["HTTP_HOST"] = x_host +- parts = x_host.split(":", 1) +- environ["SERVER_NAME"] = parts[0] +- if len(parts) == 2: +- environ["SERVER_PORT"] = parts[1] ++ environ["HTTP_HOST"] = environ["SERVER_NAME"] = x_host ++ # "]" to check for IPv6 address without port ++ if ":" in x_host and not x_host.endswith("]"): ++ environ["SERVER_NAME"], environ["SERVER_PORT"] = x_host.rsplit(":", 1) + + x_port = self._get_real_value(self.x_port, environ_get("HTTP_X_FORWARDED_PORT")) + if x_port: + host = environ.get("HTTP_HOST") + if host: +- parts = host.split(":", 1) +- host = parts[0] if len(parts) == 2 else host ++ # "]" to check for IPv6 address without port ++ if ":" in host and not host.endswith("]"): ++ host = host.rsplit(":", 1)[0] + environ["HTTP_HOST"] = f"{host}:{x_port}" + environ["SERVER_PORT"] = x_port + +diff --git a/tests/middleware/test_proxy_fix.py b/tests/middleware/test_proxy_fix.py +index 8fc1310d..abbc05c3 100644 +--- a/tests/middleware/test_proxy_fix.py ++++ b/tests/middleware/test_proxy_fix.py +@@ -138,6 +138,24 @@ from werkzeug.wrappers import Request + "http://spam/eggs/", + id="prefix < for", + ), ++ pytest.param( ++ {"x_host": 1}, ++ {"HTTP_HOST": "spam", "HTTP_X_FORWARDED_HOST": "[2001:db8::a]"}, ++ "http://[2001:db8::a]/", ++ id="ipv6 host", ++ ), ++ pytest.param( ++ {"x_port": 1}, ++ {"HTTP_HOST": "[2001:db8::a]", "HTTP_X_FORWARDED_PORT": "8080"}, ++ "http://[2001:db8::a]:8080/", ++ id="ipv6 port, host without port", ++ ), ++ pytest.param( ++ {"x_port": 1}, ++ {"HTTP_HOST": "[2001:db8::a]:9000", "HTTP_X_FORWARDED_PORT": "8080"}, ++ "http://[2001:db8::a]:8080/", ++ id="ipv6 - port, host with port", ++ ), + ), + ) + def test_proxy_fix(kwargs, base, url_root): +-- +2.34.1 + diff --git a/SOURCES/fix_tests.patch b/SOURCES/fix_tests.patch new file mode 100644 index 0000000..7f025fa --- /dev/null +++ b/SOURCES/fix_tests.patch @@ -0,0 +1,21 @@ +--- tests/test_datastructures.py.orig 2021-05-11 07:09:47.475789063 +0000 ++++ tests/test_datastructures.py 2021-05-11 07:10:04.505789063 +0000 +@@ -1235,6 +1235,7 @@ + for name in ("fileno", "writable", "readable", "seekable"): + assert hasattr(file_storage, name) + ++ @pytest.mark.filterwarnings("ignore::pytest.PytestUnraisableExceptionWarning") + def test_save_to_pathlib_dst(self, tmp_path): + src = tmp_path / "src.txt" + src.write_text(u"test") +--- tests/test_formparser.py.orig 2021-05-11 07:09:58.941789063 +0000 ++++ tests/test_formparser.py 2021-05-11 07:10:04.505789063 +0000 +@@ -239,7 +239,7 @@ + stream, _, _ = parser.parse_from_environ({"wsgi.input": ""}) + assert stream is not None + +- ++@pytest.mark.filterwarnings("ignore::pytest.PytestUnraisableExceptionWarning") + class TestMultiPart(object): + def test_basic(self): + resources = join(dirname(__file__), "multipart") diff --git a/SOURCES/preserve-any-existing-PYTHONPATH-in-tests.patch b/SOURCES/preserve-any-existing-PYTHONPATH-in-tests.patch new file mode 100644 index 0000000..f70e6fc --- /dev/null +++ b/SOURCES/preserve-any-existing-PYTHONPATH-in-tests.patch @@ -0,0 +1,34 @@ +From b88042cfb32866a00d39b678bb224eb55ecf53c1 Mon Sep 17 00:00:00 2001 +From: Lumir Balhar +Date: Tue, 22 Jun 2021 22:10:17 +0200 +Subject: [PATCH] Preserve any existing PYTHONPATH in tests + +--- + tests/conftest.py | 10 ++++++++-- + 1 file changed, 8 insertions(+), 2 deletions(-) + +diff --git a/tests/conftest.py b/tests/conftest.py +index 4ad1ff23..7200d286 100644 +--- a/tests/conftest.py ++++ b/tests/conftest.py +@@ -118,9 +118,15 @@ def dev_server(xprocess, request, tmp_path): + class Starter(ProcessStarter): + args = [sys.executable, run_path, name, json.dumps(kwargs)] + # Extend the existing env, otherwise Windows and CI fails. +- # Modules will be imported from tmp_path for the reloader. ++ # Modules will be imported from tmp_path for the reloader ++ # but any existing PYTHONPATH is preserved. + # Unbuffered output so the logs update immediately. +- env = {**os.environ, "PYTHONPATH": str(tmp_path), "PYTHONUNBUFFERED": "1"} ++ original_python_path = os.getenv("PYTHONPATH") ++ if original_python_path: ++ new_python_path = os.pathsep.join((original_python_path, str(tmp_path))) ++ else: ++ new_python_path = str(tmp_path) ++ env = {**os.environ, "PYTHONPATH": new_python_path, "PYTHONUNBUFFERED": "1"} + + @cached_property + def pattern(self): +-- +2.31.1 + diff --git a/SOURCES/py310-deprecations.patch b/SOURCES/py310-deprecations.patch new file mode 100644 index 0000000..56a0166 --- /dev/null +++ b/SOURCES/py310-deprecations.patch @@ -0,0 +1,103 @@ +From 584f3cff7d5cb8a588189ae1137b814cf5c47e05 Mon Sep 17 00:00:00 2001 +From: David Lord +Date: Wed, 19 May 2021 20:01:58 -0700 +Subject: [PATCH] address deprecation warnings from Python 3.10b1 + +--- + tests/conftest.py | 5 ++++- + tests/test_local.py | 34 +++++++++++++++++++++++++--------- + 2 files changed, 29 insertions(+), 10 deletions(-) + +diff --git a/tests/conftest.py b/tests/conftest.py +index 3b5cbd71c..4ad1ff23e 100644 +--- a/tests/conftest.py ++++ b/tests/conftest.py +@@ -66,7 +66,10 @@ def connect(self, **kwargs): + + if protocol == "https": + if "context" not in kwargs: +- kwargs["context"] = ssl.SSLContext() ++ context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT) ++ context.check_hostname = False ++ context.verify_mode = ssl.CERT_NONE ++ kwargs["context"] = context + + return http.client.HTTPSConnection(self.addr, **kwargs) + +diff --git a/tests/test_local.py b/tests/test_local.py +index 537fc32fb..b5c392890 100644 +--- a/tests/test_local.py ++++ b/tests/test_local.py +@@ -12,6 +12,18 @@ + from werkzeug import local + + ++if sys.version_info < (3, 7): ++ ++ def run_async(coro): ++ return asyncio.get_event_loop().run_until_complete(coro) ++ ++ ++else: ++ ++ def run_async(coro): ++ return asyncio.run(coro) ++ ++ + def test_basic_local(): + ns = local.Local() + ns.foo = 0 +@@ -55,9 +67,11 @@ async def value_setter(idx): + await asyncio.sleep(0.02) + values.append(ns.foo) + +- loop = asyncio.get_event_loop() +- futures = [asyncio.ensure_future(value_setter(idx)) for idx in [1, 2, 3]] +- loop.run_until_complete(asyncio.gather(*futures)) ++ async def main(): ++ futures = [asyncio.ensure_future(value_setter(i)) for i in [1, 2, 3]] ++ await asyncio.gather(*futures) ++ ++ run_async(main()) + assert sorted(values) == [1, 2, 3] + + def delfoo(): +@@ -118,9 +132,11 @@ async def task(): + ls.push(1) + assert len(ls._local.stack) == 2 + +- loop = asyncio.get_event_loop() +- futures = [asyncio.ensure_future(task()) for _ in range(3)] +- loop.run_until_complete(asyncio.gather(*futures)) ++ async def main(): ++ futures = [asyncio.ensure_future(task()) for _ in range(3)] ++ await asyncio.gather(*futures) ++ ++ run_async(main()) + + + @pytest.mark.skipif( +@@ -571,7 +587,7 @@ async def get(): + async def main(): + return await p + +- out = asyncio.get_event_loop().run_until_complete(main()) ++ out = run_async(main()) + assert out == 1 + + +@@ -599,7 +615,7 @@ async def main(): + + return out + +- out = asyncio.get_event_loop().run_until_complete(main()) ++ out = run_async(main()) + assert out == [2, 1, 0] + + +@@ -623,4 +639,4 @@ async def main(): + assert p.value == 2 + return True + +- assert asyncio.get_event_loop().run_until_complete(main()) ++ assert run_async(main()) diff --git a/SPECS/python-werkzeug.spec b/SPECS/python-werkzeug.spec index f69c994..5dc37c2 100644 --- a/SPECS/python-werkzeug.spec +++ b/SPECS/python-werkzeug.spec @@ -1,148 +1,202 @@ %global srcname Werkzeug +%global modname werkzeug -%if 0%{?rhel} > 7 -# Disable python2 build by default -%bcond_with python2 -%else -%bcond_without python2 -%endif +Name: python-%{modname} +Version: 2.2.3 +Release: 1%{?dist} +Summary: Comprehensive WSGI web application library -Name: python-werkzeug -Version: 0.12.2 -Release: 4%{?dist} -Summary: The Swiss Army knife of Python web development - -Group: Development/Libraries License: BSD -URL: http://werkzeug.pocoo.org/ -Source0: https://files.pythonhosted.org/packages/source/W/Werkzeug/%{srcname}-%{version}.tar.gz -# Pypi version of werkzeug is missing _themes folder needed to build werkzeug sphinx docs -# See https://github.com/mitsuhiko/werkzeug/issues/761 -Source1: werkzeug-sphinx-theme.tar.gz +URL: https://werkzeug.palletsprojects.com +Source0: %{pypi_source} + +# Fixes PYTHONPATH handling in tests +# Upstream: https://github.com/pallets/werkzeug/pull/2172 +Patch0: preserve-any-existing-PYTHONPATH-in-tests.patch BuildArch: noarch -%global _description\ -Werkzeug\ -========\ -\ -Werkzeug started as simple collection of various utilities for WSGI\ -applications and has become one of the most advanced WSGI utility\ -modules. It includes a powerful debugger, full featured request and\ -response objects, HTTP utilities to handle entity tags, cache control\ -headers, HTTP dates, cookie handling, file uploads, a powerful URL\ -routing system and a bunch of community contributed addon modules.\ -\ -Werkzeug is unicode aware and doesn't enforce a specific template\ -engine, database adapter or anything else. It doesn't even enforce\ -a specific way of handling requests and leaves all that up to the\ -developer. It's most useful for end user applications which should work\ -on as many server environments as possible (such as blogs, wikis,\ -bulletin boards, etc.).\ +%global _description %{expand: +Werkzeug +======== + +Werkzeug started as simple collection of various utilities for WSGI +applications and has become one of the most advanced WSGI utility +modules. It includes a powerful debugger, full featured request and +response objects, HTTP utilities to handle entity tags, cache control +headers, HTTP dates, cookie handling, file uploads, a powerful URL +routing system and a bunch of community contributed addon modules. + +Werkzeug is unicode aware and doesn't enforce a specific template +engine, database adapter or anything else. It doesn't even enforce +a specific way of handling requests and leaves all that up to the +developer. It's most useful for end user applications which should work +on as many server environments as possible (such as blogs, wikis, +bulletin boards, etc.).} + +%description %{_description} + +%package -n python3-%{modname} +Summary: %{summary} +%{?python_provide:%python_provide python3-%{modname}} +BuildRequires: make +BuildRequires: python3-devel +BuildRequires: python3dist(setuptools) +# For tests +BuildRequires: python3dist(pytest) +BuildRequires: python3dist(pytest-timeout) +BuildRequires: python3dist(pytest-xprocess) +BuildRequires: python3dist(requests) +BuildRequires: python3dist(requests-unixsocket) +BuildRequires: python3dist(cryptography) +BuildRequires: python3dist(greenlet) +# Not available in CBS +#BuildRequires: python3dist(watchdog) +BuildRequires: python3dist(ephemeral-port-reserve) + +%description -n python3-%{modname} %{_description} + +%package -n python3-werkzeug-doc +Summary: Documentation for python3-werkzeug +%{?python_provide:%python_provide python3-werkzeug-doc} +BuildRequires: python3dist(sphinx) +BuildRequires: python3dist(pallets-sphinx-themes) +BuildRequires: python3dist(sphinx-issues) +BuildRequires: python3dist(sphinxcontrib-log-cabinet) +Requires: python3-werkzeug = %{version}-%{release} +%description -n python3-werkzeug-doc +Documentation and examples for python3-werkzeug. -%description %_description -%if %{with python2} -%package -n python2-werkzeug -Summary: %summary +%prep +%autosetup -p1 -n %{srcname}-%{version} +find examples/ -type f -name '*.png' -executable -print -exec chmod -x "{}" + -BuildRequires: python2-devel -BuildRequires: python2-setuptools +%build +%py3_build +pushd docs +make PYTHONPATH=../src/ SPHINXBUILD=sphinx-build-3 html +rm -v _build/html/.buildinfo +popd -%{?python_provide:%python_provide python2-werkzeug} +%install +%py3_install -%description -n python2-werkzeug %_description -%endif # with python2 +%check +# deselect the test_exclude_patterns test case as it's failing +# when we set PYTHONPATH: https://github.com/pallets/werkzeug/issues/2404 +%pytest --deselect tests/test_serving.py::test_exclude_patterns -k "not test_reloader_sys_path" +%files -n python3-%{modname} +%license LICENSE.rst +%doc CHANGES.rst README.rst +%{python3_sitelib}/%{srcname}-*.egg-info/ +%{python3_sitelib}/%{modname}/ -%package -n python3-werkzeug -Summary: %summary +%files -n python3-werkzeug-doc +%doc docs/_build/html examples -BuildRequires: python3-devel -BuildRequires: python3-setuptools +%changelog +* Mon Feb 20 2023 Frantisek Zatloukal - 2.2.3-1 +- Update to 2.2.3 (fixes RHBZ#2169828) -%{?python_provide:%python_provide python3-werkzeug} +* Fri Jan 20 2023 Fedora Release Engineering - 2.2.2-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild -%description -n python3-werkzeug %_description +* Tue Aug 09 2022 Frantisek Zatloukal - 2.2.2-1 +- Update to 2.2.2 (fixes RHBZ#2116571) +* Thu Jul 28 2022 Frantisek Zatloukal - 2.2.1-1 +- Update to 2.2.1 (fixes RHBZ#2069345) -%package -n python-werkzeug-doc -Summary: Documentation for python3-werkzeug +* Fri Jul 22 2022 Fedora Release Engineering - 2.0.3-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild -BuildRequires: python3-sphinx +* Tue Jun 14 2022 Python Maint - 2.0.3-2 +- Rebuilt for Python 3.11 -Requires: python3-werkzeug = %{version}-%{release} +* Mon Feb 21 2022 Frantisek Zatloukal - 2.0.3-1 +- Update to 2.0.3 -%description -n python-werkzeug-doc -Documentation and examples for python-werkzeug. +* Fri Jan 21 2022 Fedora Release Engineering - 2.0.2-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild +* Wed Nov 10 2021 Frantisek Zatloukal - 2.0.2-1 +- Update to 2.0.2 -%prep -%setup -q -n %{srcname}-%{version} -%{__sed} -i 's/\r//' LICENSE -%{__sed} -i '1d' tests/multipart/test_collect.py -tar -xf %{SOURCE1} +* Fri Jul 23 2021 Fedora Release Engineering - 2.0.1-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild -rm -rf %{py3dir} -cp -a . %{py3dir} -find %{py3dir} -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python3}|' +* Tue Jun 22 2021 Lumír Balhar - 2.0.1-1 +- Update to 2.0.1 +Resolves: rhbz#1795102 +* Thu Jun 03 2021 Python Maint - 1.0.1-6 +- Rebuilt for Python 3.10 -%build -%if %{with python2} -%py2_build -find examples/ -name '*.py' -executable | xargs chmod -x -find examples/ -name '*.png' -executable | xargs chmod -x -%endif # with python2 +* Thu May 13 2021 Miro Hrončok - 1.0.1-5 +- Workaround failing tests with pytest 6.2+ +- Fixes: rhbz#1928083 -pushd %{py3dir} -%py3_build -find examples/ -name '*.py' -executable | xargs chmod -x -find examples/ -name '*.png' -executable | xargs chmod -x -popd +* Wed Jan 27 2021 Fedora Release Engineering - 1.0.1-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild -pushd docs -# Add a symlink to the dir with the Python module so that __version__ can be -# obtained therefrom. -ln -s ../werkzeug werkzeug -make SPHINXBUILD=sphinx-build-3 html -popd +* Wed Jul 29 2020 Fedora Release Engineering - 1.0.1-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild +* Sat May 23 2020 Miro Hrončok - 1.0.1-2 +- Rebuilt for Python 3.9 -%install -%if %{with python2} -%py2_install -%endif # with python2 +* Wed Apr 08 2020 Igor Raits - 1.0.1-1 +- Update to 1.0.1 -pushd %{py3dir} -%py3_install -popd -%{__rm} -rf docs/_build/html/.buildinfo -%{__rm} -rf examples/cupoftee/db.pyc - -%if %{with python2} -%files -n python2-werkzeug -%license LICENSE -%doc AUTHORS PKG-INFO CHANGES -%{python2_sitelib}/* -%endif # with python2 - -%files -n python3-werkzeug -%license LICENSE -%doc AUTHORS PKG-INFO CHANGES -%{python3_sitelib}/* - -%files -n python-werkzeug-doc -%doc docs/_build/html examples +* Thu Jan 30 2020 Fedora Release Engineering - 0.16.0-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild +* Tue Jan 07 2020 Lumír Balhar - 0.16.0-1 +- New upstream version 0.16.0 (#1690599) -%changelog -* Fri Jun 22 2018 Charalampos Stratakis - 0.12.2-4 -- Use python3-sphinx for the docs +* Wed Sep 18 2019 Miro Hrončok - 0.14.1-12 +- Subpackage python2-werkzeug has been removed + See https://fedoraproject.org/wiki/Changes/Mass_Python_2_Package_Removal + +* Sat Aug 17 2019 Miro Hrončok - 0.14.1-11 +- Rebuilt for Python 3.8 + +* Mon Jul 29 2019 Petr Viktorin - 0.14.1-10 +- Remove non-essential Python 2 test dependencies + https://fedoraproject.org/wiki/Changes/F31_Mass_Python_2_Package_Removal#Removing_Requirements +- Use system Python interpreter in tests + +* Fri Jul 26 2019 Fedora Release Engineering - 0.14.1-9 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild + +* Wed Apr 03 2019 Miro Hrončok - 0.14.1-8 +- Remove python2-werkzeug-doc + https://fedoraproject.org/wiki/Changes/Sphinx2 + +* Sun Feb 17 2019 Elliott Sales de Andrade - 0.14.1-7 +- Backport fix to tests using 'python' command + +* Sat Feb 02 2019 Fedora Release Engineering - 0.14.1-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild + +* Mon Jul 16 2018 Miro Hrončok - 0.14.1-5 +- Make sure we ship Python 3 docs in the Python 3 docs package + +* Sat Jul 14 2018 Fedora Release Engineering - 0.14.1-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild + +* Mon Jun 18 2018 Miro Hrončok - 0.14.1-3 +- Rebuilt for Python 3.7 + +* Tue Jun 05 2018 Miro Hrončok - 0.14.1-2 +- Don't BR watchdog, it is not needed -* Fri Jun 22 2018 Charalampos Stratakis - 0.12.2-3 -- Conditionalize the python2 subpackage +* Wed May 09 2018 Adam Williamson - 0.14.1-1 +- Update to 0.14.1 (needed by httpbin) +- Run tests during build * Fri Feb 09 2018 Fedora Release Engineering - 0.12.2-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild