Skip to content

Commit

Permalink
[AUTOPATCHER-CORE] Upgrade python-werkzeug to 3.0.1 3.0 package upgra…
Browse files Browse the repository at this point in the history
…de (#7851)

Co-authored-by: Saul Paredes <[email protected]>
  • Loading branch information
CBL-Mariner-Bot and Redent0r committed Apr 9, 2024
1 parent 9d87e6d commit 6deae8d
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 15 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
From b88042cfb32866a00d39b678bb224eb55ecf53c1 Mon Sep 17 00:00:00 2001
From: Lumir Balhar <[email protected]>
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

6 changes: 3 additions & 3 deletions SPECS/python-werkzeug/python-werkzeug.signatures.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"Signatures": {
"werkzeug-2.2.3.tar.gz": "8b5729f88b3e18b8fbb5a722e374bf00a1d9b77da447e846e2c64b8108c0522a"
}
"Signatures": {
"werkzeug-3.0.1.tar.gz": "d5aed0e7fe61a83cf385c94f7cf7f6c43a7affa7f81ef7b07bd632834756f4dc"
}
}
53 changes: 43 additions & 10 deletions SPECS/python-werkzeug/python-werkzeug.spec
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
%global srcname werkzeug
%global modname werkzeug

Summary: The Swiss Army knife of Python web development
Name: python-werkzeug
Version: 2.2.3
Version: 3.0.1
Release: 1%{?dist}
License: BSD
Vendor: Microsoft Corporation
Distribution: Azure Linux
Group: Development/Languages/Python
URL: https://github.com/pallets/werkzeug
Source0: https://github.com/pallets/werkzeug/archive/%{version}.tar.gz#/werkzeug-%{version}.tar.gz
# Fixes PYTHONPATH handling in tests
# Upstream: https://github.com/pallets/werkzeug/pull/2172
Patch0: preserve-any-existing-PYTHONPATH-in-tests.patch
BuildArch: noarch

%description
Expand All @@ -19,36 +25,63 @@ BuildRequires: python3-devel
BuildRequires: python3-libs
BuildRequires: python3-setuptools
BuildRequires: python3-xml
BuildRequires: python3-flit-core
BuildRequires: python3-pip
Requires: python3
%if 0%{?with_check}
BuildRequires: curl-devel
BuildRequires: openssl-devel
BuildRequires: python3-pip
BuildRequires: python3-requests
%endif

%description -n python3-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.

%package -n python3-werkzeug-doc
Summary: Documentation for python3-werkzeug
Requires: python3-werkzeug = %{version}-%{release}

%description -n python3-werkzeug-doc
Documentation and examples for python3-werkzeug.

%generate_buildrequires
%if 0%{?with_check}
# -t picks test.txt by default which contains too tight pins
%pyproject_buildrequires requirements/tests.in requirements/docs.in
%else
%pyproject_buildrequires -r requirements/docs.in
%endif

%prep
%autosetup -n werkzeug-%{version} -p1
%autosetup -p1 -n %{srcname}-%{version}

%build
%py3_build
%pyproject_wheel

%install
%py3_install
%pyproject_install
%pyproject_save_files %{modname}

%check
pip3 install pytest hypothesis
LANG=en_US.UTF-8 PYTHONPATH=./ python3 setup.py test
pip3 install --ignore-installed -r requirements/tests.txt
pip3 install markupsafe
%py3_check_import %{modname}
%if 0%{?with_check}
# deselect the test_exclude_patterns test case as it's failing
# when we set PYTHONPATH: https://github.com/pallets/werkzeug/issues/2404
%pytest -Wdefault --deselect tests/test_serving.py::test_exclude_patterns
%endif

%files -n python3-werkzeug
%defattr(-,root,root)
%files -n python3-%{modname} -f %{pyproject_files}
%license LICENSE.rst
%{python3_sitelib}/*
%doc CHANGES.rst README.rst
%files -n python3-werkzeug-doc

%changelog
* Thu Apr 04 2024 CBL-Mariner Servicing Account <[email protected]> - 3.0.1-1
- Auto-upgrade to 3.0.1 - 3.0 package upgrade
- Import build, install and check section from Fedora 40 (license: MIT).

* Tue Mar 14 2023 Rakshaa Viswanathan <[email protected]> - 2.2.3-1
- Updated to version 2.2.3 for CVE-2023-23934 adn CVE-2023-25577
- Remove patch for CVE-2023-25577
Expand Down
4 changes: 2 additions & 2 deletions cgmanifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -24863,8 +24863,8 @@
"type": "other",
"other": {
"name": "python-werkzeug",
"version": "2.2.3",
"downloadUrl": "https://github.com/pallets/werkzeug/archive/2.2.3.tar.gz"
"version": "3.0.1",
"downloadUrl": "https://github.com/pallets/werkzeug/archive/3.0.1.tar.gz"
}
}
},
Expand Down

0 comments on commit 6deae8d

Please sign in to comment.