forked from pool/python-loguru
		
	Accepting request 1278383 from devel:languages:python
Automatic submission by obs-autosubmit OBS-URL: https://build.opensuse.org/request/show/1278383 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-loguru?expand=0&rev=15
This commit is contained in:
		@@ -1,3 +0,0 @@
 | 
			
		||||
version https://git-lfs.github.com/spec/v1
 | 
			
		||||
oid sha256:e671a53522515f34fd406340ee968cb9ecafbc4b36c679da03c18fd8d0bd51ac
 | 
			
		||||
size 145103
 | 
			
		||||
							
								
								
									
										3
									
								
								loguru-0.7.3.tar.gz
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								loguru-0.7.3.tar.gz
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,3 @@
 | 
			
		||||
version https://git-lfs.github.com/spec/v1
 | 
			
		||||
oid sha256:1cad8860aa0ecf9567125381e4430046526246e075224350a6a624addac05f5e
 | 
			
		||||
size 459102
 | 
			
		||||
							
								
								
									
										100
									
								
								py313.patch
									
									
									
									
									
								
							
							
						
						
									
										100
									
								
								py313.patch
									
									
									
									
									
								
							@@ -1,100 +0,0 @@
 | 
			
		||||
From a7a2d72d9e3495ddec9dde2852fa7a932b76d0c4 Mon Sep 17 00:00:00 2001
 | 
			
		||||
From: Dave Hall <dave@etianen.com>
 | 
			
		||||
Date: Sun, 11 Feb 2024 23:34:27 +0000
 | 
			
		||||
Subject: [PATCH 3/5] Fixing `test_pickling` tests for Python 3.13.
 | 
			
		||||
 | 
			
		||||
The `Handler.lock` is substituted for a `nullcontext`, keeping Python 3.13 happy. A no-op stub for `Handler.release` is added, keeping all other Python versions happy.
 | 
			
		||||
---
 | 
			
		||||
 tests/test_pickling.py | 6 ++++--
 | 
			
		||||
 1 file changed, 4 insertions(+), 2 deletions(-)
 | 
			
		||||
 | 
			
		||||
Index: loguru-0.7.2/tests/test_pickling.py
 | 
			
		||||
===================================================================
 | 
			
		||||
--- loguru-0.7.2.orig/tests/test_pickling.py
 | 
			
		||||
+++ loguru-0.7.2/tests/test_pickling.py
 | 
			
		||||
@@ -39,11 +39,18 @@ class StreamHandler:
 | 
			
		||||
         self.stopped = True
 | 
			
		||||
 
 | 
			
		||||
 
 | 
			
		||||
+class MockLock:
 | 
			
		||||
+    def __enter__(self):
 | 
			
		||||
+        pass
 | 
			
		||||
+
 | 
			
		||||
+    def __exit__(self, *excinfo):
 | 
			
		||||
+        pass
 | 
			
		||||
+
 | 
			
		||||
+
 | 
			
		||||
 class StandardHandler(logging.Handler):
 | 
			
		||||
     def __init__(self, level):
 | 
			
		||||
         super().__init__(level)
 | 
			
		||||
         self.written = ""
 | 
			
		||||
-        self.lock = None
 | 
			
		||||
 
 | 
			
		||||
     def emit(self, record):
 | 
			
		||||
         self.written += record.getMessage()
 | 
			
		||||
@@ -51,8 +58,11 @@ class StandardHandler(logging.Handler):
 | 
			
		||||
     def acquire(self):
 | 
			
		||||
         pass
 | 
			
		||||
 
 | 
			
		||||
+    def release(self):
 | 
			
		||||
+        pass
 | 
			
		||||
+
 | 
			
		||||
     def createLock(self):  # noqa: N802
 | 
			
		||||
-        return None
 | 
			
		||||
+        self.lock = MockLock()
 | 
			
		||||
 
 | 
			
		||||
 
 | 
			
		||||
 def format_function(record):
 | 
			
		||||
Index: loguru-0.7.2/loguru/_better_exceptions.py
 | 
			
		||||
===================================================================
 | 
			
		||||
--- loguru-0.7.2.orig/loguru/_better_exceptions.py
 | 
			
		||||
+++ loguru-0.7.2/loguru/_better_exceptions.py
 | 
			
		||||
@@ -497,7 +497,7 @@ class ExceptionFormatter:
 | 
			
		||||
             else:
 | 
			
		||||
                 yield from self._indent(introduction + "\n", group_nesting)
 | 
			
		||||
 
 | 
			
		||||
-        frames_lines = traceback.format_list(frames) + exception_only
 | 
			
		||||
+        frames_lines = self._format_list(frames) + exception_only
 | 
			
		||||
         if self._colorize or self._backtrace or self._diagnose:
 | 
			
		||||
             frames_lines = self._format_locations(frames_lines, has_introduction=has_introduction)
 | 
			
		||||
 
 | 
			
		||||
@@ -524,5 +524,39 @@ class ExceptionFormatter:
 | 
			
		||||
             if not is_exception_group(exc) or group_nesting == 10:
 | 
			
		||||
                 yield from self._indent("-" * 35, group_nesting + 1, prefix="+-")
 | 
			
		||||
 
 | 
			
		||||
+    def _format_list(self, frames):
 | 
			
		||||
+        result = []
 | 
			
		||||
+        last_file = None
 | 
			
		||||
+        last_line = None
 | 
			
		||||
+        last_name = None
 | 
			
		||||
+        count = 0
 | 
			
		||||
+        for filename, lineno, name, line in frames:
 | 
			
		||||
+            if (
 | 
			
		||||
+                last_file is not None
 | 
			
		||||
+                and last_file == filename
 | 
			
		||||
+                and last_line is not None
 | 
			
		||||
+                and last_line == lineno
 | 
			
		||||
+                and last_name is not None
 | 
			
		||||
+                and last_name == name
 | 
			
		||||
+            ):
 | 
			
		||||
+                count += 1
 | 
			
		||||
+            else:
 | 
			
		||||
+                if count > 3:
 | 
			
		||||
+                    result.append(f"  [Previous line repeated {count-3} more times]\n")
 | 
			
		||||
+                last_file = filename
 | 
			
		||||
+                last_line = lineno
 | 
			
		||||
+                last_name = name
 | 
			
		||||
+                count = 0
 | 
			
		||||
+            if count >= 3:
 | 
			
		||||
+                continue
 | 
			
		||||
+            row = []
 | 
			
		||||
+            row.append('  File "{}", line {}, in {}\n'.format(filename, lineno, name))
 | 
			
		||||
+            if line:
 | 
			
		||||
+                row.append("    {}\n".format(line.strip()))
 | 
			
		||||
+            result.append("".join(row))
 | 
			
		||||
+        if count > 3:
 | 
			
		||||
+            result.append(f"  [Previous line repeated {count-3} more times]\n")
 | 
			
		||||
+        return result
 | 
			
		||||
+
 | 
			
		||||
     def format_exception(self, type_, value, tb, *, from_decorator=False):
 | 
			
		||||
         yield from self._format_exception(value, tb, is_first=True, from_decorator=from_decorator)
 | 
			
		||||
							
								
								
									
										105
									
								
								py314.patch
									
									
									
									
									
								
							
							
						
						
									
										105
									
								
								py314.patch
									
									
									
									
									
								
							@@ -1,105 +0,0 @@
 | 
			
		||||
From 3a901de465b0dbb398f455dc3393d976fd0affbe Mon Sep 17 00:00:00 2001
 | 
			
		||||
From: Delgan <delgan.py@gmail.com>
 | 
			
		||||
Date: Sat, 19 Oct 2024 21:45:17 +0200
 | 
			
		||||
Subject: [PATCH] Fix tests for Python 3.14 dev (#1218)
 | 
			
		||||
 | 
			
		||||
Tests were failing for two reasons:
 | 
			
		||||
- "asyncio.iscoroutinefunction()" is deprecated and must be replaced
 | 
			
		||||
with "inspect.iscoroutinefunction()"
 | 
			
		||||
- it seems the "PicklingError" now displays additional context at the
 | 
			
		||||
end of the exception message. I changed the implemntation of the tests
 | 
			
		||||
so that we check the presence of the expected string regardless of the
 | 
			
		||||
line it appears. It wasn't strictly required for the other non-failing
 | 
			
		||||
tests, but I generalized the implementation for consistency and
 | 
			
		||||
simplification.
 | 
			
		||||
---
 | 
			
		||||
 loguru/_simple_sinks.py          |  4 ++--
 | 
			
		||||
 tests/test_add_option_enqueue.py | 14 +++++++-------
 | 
			
		||||
 2 files changed, 9 insertions(+), 9 deletions(-)
 | 
			
		||||
 | 
			
		||||
diff --git a/loguru/_simple_sinks.py b/loguru/_simple_sinks.py
 | 
			
		||||
index 068f1e13..658f1ad6 100644
 | 
			
		||||
--- a/loguru/_simple_sinks.py
 | 
			
		||||
+++ b/loguru/_simple_sinks.py
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
-import asyncio
 | 
			
		||||
+import inspect
 | 
			
		||||
 import logging
 | 
			
		||||
 import weakref
 | 
			
		||||
 
 | 
			
		||||
@@ -10,7 +10,7 @@ def __init__(self, stream):
 | 
			
		||||
         self._stream = stream
 | 
			
		||||
         self._flushable = callable(getattr(stream, "flush", None))
 | 
			
		||||
         self._stoppable = callable(getattr(stream, "stop", None))
 | 
			
		||||
-        self._completable = asyncio.iscoroutinefunction(getattr(stream, "complete", None))
 | 
			
		||||
+        self._completable = inspect.iscoroutinefunction(getattr(stream, "complete", None))
 | 
			
		||||
 
 | 
			
		||||
     def write(self, message):
 | 
			
		||||
         self._stream.write(message)
 | 
			
		||||
diff --git a/tests/test_add_option_enqueue.py b/tests/test_add_option_enqueue.py
 | 
			
		||||
index c367e1d7..b393f3dc 100644
 | 
			
		||||
--- a/tests/test_add_option_enqueue.py
 | 
			
		||||
+++ b/tests/test_add_option_enqueue.py
 | 
			
		||||
@@ -101,7 +101,7 @@ def test_caught_exception_queue_put(writer, capsys):
 | 
			
		||||
     assert out == ""
 | 
			
		||||
     assert lines[0] == "--- Logging error in Loguru Handler #0 ---"
 | 
			
		||||
     assert re.match(r"Record was: \{.*Bye bye.*\}", lines[1])
 | 
			
		||||
-    assert lines[-2].endswith("PicklingError: You shall not serialize me!")
 | 
			
		||||
+    assert "PicklingError: You shall not serialize me!" in err
 | 
			
		||||
     assert lines[-1] == "--- End of logging error ---"
 | 
			
		||||
 
 | 
			
		||||
 
 | 
			
		||||
@@ -119,7 +119,7 @@ def test_caught_exception_queue_get(writer, capsys):
 | 
			
		||||
     assert out == ""
 | 
			
		||||
     assert lines[0] == "--- Logging error in Loguru Handler #0 ---"
 | 
			
		||||
     assert lines[1] == "Record was: None"
 | 
			
		||||
-    assert lines[-2].endswith("UnpicklingError: You shall not de-serialize me!")
 | 
			
		||||
+    assert "UnpicklingError: You shall not de-serialize me!" in err
 | 
			
		||||
     assert lines[-1] == "--- End of logging error ---"
 | 
			
		||||
 
 | 
			
		||||
 
 | 
			
		||||
@@ -136,7 +136,7 @@ def test_caught_exception_sink_write(capsys):
 | 
			
		||||
     assert out == "It's fine\nIt's fine again\n"
 | 
			
		||||
     assert lines[0] == "--- Logging error in Loguru Handler #0 ---"
 | 
			
		||||
     assert re.match(r"Record was: \{.*Bye bye.*\}", lines[1])
 | 
			
		||||
-    assert lines[-2] == "RuntimeError: You asked me to fail..."
 | 
			
		||||
+    assert "RuntimeError: You asked me to fail..." in err
 | 
			
		||||
     assert lines[-1] == "--- End of logging error ---"
 | 
			
		||||
 
 | 
			
		||||
 
 | 
			
		||||
@@ -171,7 +171,7 @@ def test_not_caught_exception_queue_get(writer, capsys):
 | 
			
		||||
     assert out == ""
 | 
			
		||||
     assert lines[0] == "--- Logging error in Loguru Handler #0 ---"
 | 
			
		||||
     assert lines[1] == "Record was: None"
 | 
			
		||||
-    assert lines[-2].endswith("UnpicklingError: You shall not de-serialize me!")
 | 
			
		||||
+    assert "UnpicklingError: You shall not de-serialize me!" in err
 | 
			
		||||
     assert lines[-1] == "--- End of logging error ---"
 | 
			
		||||
 
 | 
			
		||||
 
 | 
			
		||||
@@ -189,7 +189,7 @@ def test_not_caught_exception_sink_write(capsys):
 | 
			
		||||
     assert out == "It's fine\nIt's fine again\n"
 | 
			
		||||
     assert lines[0] == "--- Logging error in Loguru Handler #0 ---"
 | 
			
		||||
     assert re.match(r"Record was: \{.*Bye bye.*\}", lines[1])
 | 
			
		||||
-    assert lines[-2] == "RuntimeError: You asked me to fail..."
 | 
			
		||||
+    assert "RuntimeError: You asked me to fail..." in err
 | 
			
		||||
     assert lines[-1] == "--- End of logging error ---"
 | 
			
		||||
 
 | 
			
		||||
 
 | 
			
		||||
@@ -207,7 +207,7 @@ def test_not_caught_exception_sink_write_then_complete(capsys):
 | 
			
		||||
     assert out == ""
 | 
			
		||||
     assert lines[0] == "--- Logging error in Loguru Handler #0 ---"
 | 
			
		||||
     assert re.match(r"Record was: \{.*Bye bye.*\}", lines[1])
 | 
			
		||||
-    assert lines[-2] == "RuntimeError: You asked me to fail..."
 | 
			
		||||
+    assert "RuntimeError: You asked me to fail..." in err
 | 
			
		||||
     assert lines[-1] == "--- End of logging error ---"
 | 
			
		||||
 
 | 
			
		||||
 
 | 
			
		||||
@@ -226,7 +226,7 @@ def test_not_caught_exception_queue_get_then_complete(writer, capsys):
 | 
			
		||||
     assert out == ""
 | 
			
		||||
     assert lines[0] == "--- Logging error in Loguru Handler #0 ---"
 | 
			
		||||
     assert lines[1] == "Record was: None"
 | 
			
		||||
-    assert lines[-2].endswith("UnpicklingError: You shall not de-serialize me!")
 | 
			
		||||
+    assert "UnpicklingError: You shall not de-serialize me!" in err
 | 
			
		||||
     assert lines[-1] == "--- End of logging error ---"
 | 
			
		||||
 
 | 
			
		||||
 
 | 
			
		||||
@@ -1,3 +1,17 @@
 | 
			
		||||
-------------------------------------------------------------------
 | 
			
		||||
Wed May  7 05:28:06 UTC 2025 - Guang Yee <gyee@suse.com>
 | 
			
		||||
 | 
			
		||||
- Update to 0.7.3
 | 
			
		||||
  * Fix Cython incompatibility caused by the absence of underlying stack frames, which resulted in a ValueError during logging (#88).
 | 
			
		||||
  * Fix possible RuntimeError when removing all handlers with logger.remove() due to thread-safety issue (#1183)
 | 
			
		||||
  * Fix diagnose=True option of exception formatting not working as expected with Python 3.13 (#1235).
 | 
			
		||||
  * Fix non-standard level names not fully compatible with logging.Formatter() (#1231).
 | 
			
		||||
  * Fix inability to display a literal "\" immediately before color markups (#988).
 | 
			
		||||
  * Fix possible infinite recursion when an exception is raised from a __repr__ method decorated with logger.catch() (#1044).
 | 
			
		||||
  * Improve performance of datetime formatting while logging messages (#1201).
 | 
			
		||||
  * Reduce startup time in the presence of installed but unused IPython third-party library (#1001).
 | 
			
		||||
- Remove py313.patch and py314.patch as they had landed in 0.7.3
 | 
			
		||||
 | 
			
		||||
-------------------------------------------------------------------
 | 
			
		||||
Mon Oct 28 12:13:51 UTC 2024 - Dirk Müller <dmueller@suse.com>
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
#
 | 
			
		||||
# spec file for package python-loguru
 | 
			
		||||
#
 | 
			
		||||
# Copyright (c) 2024 SUSE LLC
 | 
			
		||||
# Copyright (c) 2025 SUSE LLC
 | 
			
		||||
#
 | 
			
		||||
# All modifications and additions to the file contributed by third parties
 | 
			
		||||
# remain the property of their copyright owners, unless otherwise agreed
 | 
			
		||||
@@ -18,20 +18,22 @@
 | 
			
		||||
 | 
			
		||||
%{?sle15_python_module_pythons}
 | 
			
		||||
Name:           python-loguru
 | 
			
		||||
Version:        0.7.2
 | 
			
		||||
Version:        0.7.3
 | 
			
		||||
Release:        0
 | 
			
		||||
Summary:        Python logging component with a simple interface
 | 
			
		||||
License:        MIT
 | 
			
		||||
Group:          Development/Languages/Python
 | 
			
		||||
URL:            https://github.com/Delgan/loguru
 | 
			
		||||
Source:         https://files.pythonhosted.org/packages/source/l/loguru/loguru-%{version}.tar.gz
 | 
			
		||||
# PATCH-FIX-UPSTREAM: taken from https://github.com/Delgan/loguru/pull/1079.patch
 | 
			
		||||
Patch1:         py313.patch
 | 
			
		||||
Patch2:         https://github.com/Delgan/loguru/commit/3a901de465b0dbb398f455dc3393d976fd0affbe.patch#/py314.patch
 | 
			
		||||
Source:         https://github.com/Delgan/loguru/archive/refs/tags/%{version}.tar.gz#/loguru-%{version}.tar.gz
 | 
			
		||||
BuildRequires:  %{python_module colorama}
 | 
			
		||||
BuildRequires:  %{python_module flit-core}
 | 
			
		||||
BuildRequires:  %{python_module freezegun}
 | 
			
		||||
BuildRequires:  %{python_module pip}
 | 
			
		||||
BuildRequires:  %{python_module pytest-mypy-plugins}
 | 
			
		||||
BuildRequires:  %{python_module pytest-mypy}
 | 
			
		||||
BuildRequires:  %{python_module pytest}
 | 
			
		||||
BuildRequires:  %{python_module setuptools}
 | 
			
		||||
BuildRequires:  %{python_module wheel}
 | 
			
		||||
BuildRequires:  fdupes
 | 
			
		||||
BuildRequires:  python-rpm-macros
 | 
			
		||||
Recommends:     python-colorama
 | 
			
		||||
@@ -47,10 +49,10 @@ which dispatches log messages to configured handlers.
 | 
			
		||||
%autosetup -p1 -n loguru-%{version}
 | 
			
		||||
 | 
			
		||||
%build
 | 
			
		||||
%python_build
 | 
			
		||||
%pyproject_wheel
 | 
			
		||||
 | 
			
		||||
%install
 | 
			
		||||
%python_install
 | 
			
		||||
%pyproject_install
 | 
			
		||||
%python_expand %fdupes %{buildroot}%{$python_sitelib}
 | 
			
		||||
 | 
			
		||||
%check
 | 
			
		||||
@@ -64,7 +66,7 @@ fi
 | 
			
		||||
 | 
			
		||||
%files %{python_files}
 | 
			
		||||
%license LICENSE
 | 
			
		||||
%doc README.rst
 | 
			
		||||
%doc README.md
 | 
			
		||||
%{python_sitelib}/loguru
 | 
			
		||||
%{python_sitelib}/loguru-%{version}*-info
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user