14
0
forked from pool/python-loguru
2023-01-28 16:11:50 +00:00
committed by Git OBS Bridge
parent aed181b600
commit 222f142b7a
3 changed files with 71 additions and 5 deletions

View File

@@ -1,3 +1,8 @@
-------------------------------------------------------------------
Sat Jan 28 16:10:06 UTC 2023 - Dirk Müller <dmueller@suse.com>
- add python311.patch to fix build with python 3.11
------------------------------------------------------------------- -------------------------------------------------------------------
Fri Aug 5 11:11:57 UTC 2022 - Ben Greiner <code@bnavigator.de> Fri Aug 5 11:11:57 UTC 2022 - Ben Greiner <code@bnavigator.de>

View File

@@ -1,7 +1,7 @@
# #
# spec file for package python-loguru # 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 # All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed # remain the property of their copyright owners, unless otherwise agreed
@@ -18,6 +18,7 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}} %{?!python_module:%define python_module() python-%{**} python3-%{**}}
%define skip_python2 1 %define skip_python2 1
%define skip_python36 1
Name: python-loguru Name: python-loguru
Version: 0.6.0 Version: 0.6.0
Release: 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 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 # 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 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 colorama}
BuildRequires: %{python_module pytest} BuildRequires: %{python_module pytest}
BuildRequires: %{python_module setuptools} BuildRequires: %{python_module setuptools}
BuildRequires: fdupes BuildRequires: fdupes
BuildRequires: python-rpm-macros BuildRequires: python-rpm-macros
%if 0%{?python_version_nodots} < 37
Requires: python-aiocontextvars
%endif
Recommends: python-colorama Recommends: python-colorama
BuildArch: noarch BuildArch: noarch

62
python311.patch Normal file
View File

@@ -0,0 +1,62 @@
From 5b77724ca75aa8f4b1c8866e0b786c3cbe30ca99 Mon Sep 17 00:00:00 2001
From: Delgan <delgan.py@gmail.com>
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"