diff --git a/python-loguru.changes b/python-loguru.changes index cefd77f..ce0400d 100644 --- a/python-loguru.changes +++ b/python-loguru.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Sat Jan 28 16:10:06 UTC 2023 - Dirk Müller + +- add python311.patch to fix build with python 3.11 + ------------------------------------------------------------------- Fri Aug 5 11:11:57 UTC 2022 - Ben Greiner diff --git a/python-loguru.spec b/python-loguru.spec index 952cee5..712b7c3 100644 --- a/python-loguru.spec +++ b/python-loguru.spec @@ -1,7 +1,7 @@ # # spec file for package python-loguru # -# Copyright (c) 2022 SUSE LLC +# Copyright (c) 2023 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -18,6 +18,7 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} %define skip_python2 1 +%define skip_python36 1 Name: python-loguru Version: 0.6.0 Release: 0 @@ -28,15 +29,13 @@ URL: https://github.com/Delgan/loguru Source: https://files.pythonhosted.org/packages/source/l/loguru/loguru-%{version}.tar.gz # PATCH-FIX-UPSTREAM loguru-fix-repr-tests.patch https://github.com/Delgan/loguru/commit/4fe21f6 -- Fix "repr()" tests failing on Python 3.11 and Python 3.10.6 Patch1: loguru-fix-repr-tests.patch -BuildRequires: %{python_module aiocontextvars if %python-base < 3.7} +# PATCH-FIX-UPSTREAM https://github.com/Delgan/loguru/commit/5b77724ca75aa8f4b1c8866e0b786c3cbe30ca99 +Patch2: python311.patch BuildRequires: %{python_module colorama} BuildRequires: %{python_module pytest} BuildRequires: %{python_module setuptools} BuildRequires: fdupes BuildRequires: python-rpm-macros -%if 0%{?python_version_nodots} < 37 -Requires: python-aiocontextvars -%endif Recommends: python-colorama BuildArch: noarch diff --git a/python311.patch b/python311.patch new file mode 100644 index 0000000..9e29c3d --- /dev/null +++ b/python311.patch @@ -0,0 +1,62 @@ +From 5b77724ca75aa8f4b1c8866e0b786c3cbe30ca99 Mon Sep 17 00:00:00 2001 +From: Delgan +Date: Sat, 28 May 2022 16:09:23 +0200 +Subject: [PATCH] Fix failing tests on Python 3.11 (#654) + +--- + .github/workflows/tests.yml | 1 + + CHANGELOG.rst | 1 + + README.rst | 6 +++--- + tests/test_filesink_rotation.py | 4 ++-- + tests/test_interception.py | 11 ++++++----- + 5 files changed, 13 insertions(+), 10 deletions(-) + +Index: loguru-0.6.0/tests/test_filesink_rotation.py +=================================================================== +--- loguru-0.6.0.orig/tests/test_filesink_rotation.py ++++ loguru-0.6.0/tests/test_filesink_rotation.py +@@ -49,8 +49,8 @@ def monkeypatch_filesystem(monkeypatch): + return self._timestamp + return getattr(self._wrapped, name) + +- def patched_stat(filepath): +- stat = __stat__(filepath) ++ def patched_stat(filepath, *args, **kwargs): ++ stat = __stat__(filepath, *args, **kwargs) + wrapped = StatWrapper(stat, filesystem.get(os.path.abspath(filepath))) + return wrapped + +Index: loguru-0.6.0/tests/test_interception.py +=================================================================== +--- loguru-0.6.0.orig/tests/test_interception.py ++++ loguru-0.6.0/tests/test_interception.py +@@ -1,4 +1,5 @@ + import logging ++import sys + + from loguru import logger + +@@ -14,7 +15,7 @@ class InterceptHandler(logging.Handler): + level = record.levelno + + # Find caller from where originated the logged message +- frame, depth = logging.currentframe(), 2 ++ frame, depth = sys._getframe(6), 6 + while frame.f_code.co_filename == logging.__file__: + frame = frame.f_back + depth += 1 +@@ -30,7 +31,7 @@ def test_formatting(writer): + + expected = ( + "tests.test_interception - test_interception.py - test_formatting - DEBUG - " +- "10 - 38 - test_interception - This is the message\n" ++ "10 - 39 - test_interception - This is the message\n" + ) + + with make_logging_logger("tests", InterceptHandler()) as logging_logger: +@@ -157,4 +158,4 @@ def test_using_logging_function(writer): + logging.warning("ABC") + + result = writer.read() +- assert result == "test_using_logging_function 157 test_interception test_interception.py ABC\n" ++ assert result == "test_using_logging_function 158 test_interception test_interception.py ABC\n"