Convert to pyproject macros

This commit is contained in:
Carl George 2022-02-07 22:24:35 -06:00
parent 5f893c890d
commit 4f6203ae78
2 changed files with 34 additions and 88 deletions

View File

@ -1,45 +0,0 @@
From 0684b61c1d4feaaf5ac3c2d50375cf504214a48d Mon Sep 17 00:00:00 2001
From: Petr Viktorin <encukou@gmail.com>
Date: Wed, 19 Jun 2019 18:09:17 +0200
Subject: [PATCH] gen.with_timeout: Don't log CancelledError after timeout
See also: commit a237a995a1d54ad6e07c1ecdf5103ff8f45073b5
---
tornado/gen.py | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/tornado/gen.py b/tornado/gen.py
index 51f2a4f03..33cc887e5 100644
--- a/tornado/gen.py
+++ b/tornado/gen.py
@@ -557,8 +557,9 @@ def with_timeout(
an absolute time relative to `.IOLoop.time`)
If the wrapped `.Future` fails after it has timed out, the exception
- will be logged unless it is of a type contained in ``quiet_exceptions``
- (which may be an exception type or a sequence of types).
+ will be logged unless it is either of a type contained in
+ ``quiet_exceptions`` (which may be an exception type or a sequence of
+ types), or a `CancelledError`.
The wrapped `.Future` is not canceled when the timeout expires,
permitting it to be reused. `asyncio.wait_for` is similar to this
@@ -573,6 +574,9 @@ def with_timeout(
.. versionchanged:: 4.4
Added support for yieldable objects other than `.Future`.
+ .. versionchanged:: 6.1
+ Do not log CancelledError after timeout.
+
"""
# It's tempting to optimize this by cancelling the input future on timeout
# instead of creating a new one, but A) we can't know if we are the only
@@ -587,6 +591,8 @@ def with_timeout(
def error_callback(future: Future) -> None:
try:
future.result()
+ except asyncio.CancelledError:
+ pass
except Exception as e:
if not isinstance(e, quiet_exceptions):
app_log.error(

View File

@ -1,12 +1,21 @@
%global srcname tornado
%global common_description %{expand:
Tornado is an open source version of the scalable, non-blocking web
server and tools.
The framework is distinct from most mainstream web server frameworks
(and certainly most Python frameworks) because it is non-blocking and
reasonably fast. Because it is non-blocking and uses epoll, it can
handle thousands of simultaneous standing connections, which means it is
ideal for real-time web services.}
Name: python-%{srcname}
Version: 6.1.0
Release: 5%{?dist}
Release: 6%{?dist}
Summary: Scalable, non-blocking web server and tools
License: ASL 2.0
URL: http://www.tornadoweb.org
URL: https://www.tornadoweb.org
Source0: https://github.com/tornadoweb/tornado/archive/v%{version}/%{srcname}-%{version}.tar.gz
# Do not turn DeprecationWarning in tornado module into Exception
@ -14,70 +23,52 @@ Source0: https://github.com/tornadoweb/tornado/archive/v%{version}/%{srcn
Patch1: Do-not-turn-DeprecationWarning-into-Exception.patch
BuildRequires: gcc
BuildRequires: python3-devel
BuildRequires: python%{python3_pkgversion}-setuptools
BuildRequires: python%{python3_pkgversion}-devel
%description %{common_description}
%description
Tornado is an open source version of the scalable, non-blocking web
server and tools.
%package -n python3-%{srcname}
Summary: %{summary}
The framework is distinct from most mainstream web server frameworks
(and certainly most Python frameworks) because it is non-blocking and
reasonably fast. Because it is non-blocking and uses epoll, it can
handle thousands of simultaneous standing connections, which means it is
ideal for real-time web services.
%package -n python%{python3_pkgversion}-%{srcname}
Summary: Scalable, non-blocking web server and tools
%{?python_provide:%python_provide python%{python3_pkgversion}-%{srcname}}
Requires: python%{python3_pkgversion}-pycurl
%description -n python%{python3_pkgversion}-%{srcname}
Tornado is an open source version of the scalable, non-blocking web
server and tools.
The framework is distinct from most mainstream web server frameworks
(and certainly most Python frameworks) because it is non-blocking and
reasonably fast. Because it is non-blocking and uses epoll, it can
handle thousands of simultaneous standing connections, which means it is
ideal for real-time web services.
%description -n python3-%{srcname} %{common_description}
%package doc
Summary: Examples for %{name}
Obsoletes: python%{python3_pkgversion}-%{srcname}-doc < 4.2.1-3
Provides: python%{python3_pkgversion}-%{srcname}-doc = %{version}-%{release}
%description doc
Tornado is an open source version of the scalable, non-blocking web
server and and tools. This package contains some example applications.
%description doc %{common_description}
%prep
This package contains some example applications.
%prep
%autosetup -p1 -n %{srcname}-%{version}
# Remove shebang from files
%{__sed} -i.orig -e '/^#!\//, 1d' *py tornado/*.py tornado/*/*.py
%generate_buildrequires
%pyproject_buildrequires -e py3
%build
%py3_build
%pyproject_wheel
%install
%py3_install
%pyproject_install
%pyproject_save_files %{srcname}
%check
export ASYNC_TEST_TIMEOUT=10
%{__python3} -m tornado.test.runtests --verbose
# Skip the same timing-related tests that upstream skips when run in Travis CI.
# https://github.com/tornadoweb/tornado/commit/abc5780a06a1edd0177a399a4dd4f39497cb0c57
export TRAVIS=true
%tox
%files -n python%{python3_pkgversion}-%{srcname}
%license LICENSE
%files -n python3-%{srcname} -f %{pyproject_files}
%doc README.rst
%{python3_sitearch}/%{srcname}/
%{python3_sitearch}/%{srcname}-*.egg-info/
%files doc
%license LICENSE
%doc demos
%changelog
* Tue Feb 08 2022 Carl George <carl@george.computer> - 6.1.0-6
- Convert to pyproject macros
* Fri Jan 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 6.1.0-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild