From f5a75ecf99c2eb8734d505c4875c55e5fd584a28e074e57a05a89a810c4a58ee Mon Sep 17 00:00:00 2001 From: Nico Krapp Date: Mon, 12 May 2025 06:10:41 +0000 Subject: [PATCH] Accepting request 1276340 from home:yeey:branches:devel:languages:python - 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 OBS-URL: https://build.opensuse.org/request/show/1276340 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-loguru?expand=0&rev=30 --- loguru-0.7.2.tar.gz | 3 -- loguru-0.7.3.tar.gz | 3 ++ py313.patch | 100 ---------------------------------------- py314.patch | 105 ------------------------------------------ python-loguru.changes | 14 ++++++ python-loguru.spec | 20 ++++---- 6 files changed, 28 insertions(+), 217 deletions(-) delete mode 100644 loguru-0.7.2.tar.gz create mode 100644 loguru-0.7.3.tar.gz delete mode 100644 py313.patch delete mode 100644 py314.patch diff --git a/loguru-0.7.2.tar.gz b/loguru-0.7.2.tar.gz deleted file mode 100644 index ed8eb1e..0000000 --- a/loguru-0.7.2.tar.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:e671a53522515f34fd406340ee968cb9ecafbc4b36c679da03c18fd8d0bd51ac -size 145103 diff --git a/loguru-0.7.3.tar.gz b/loguru-0.7.3.tar.gz new file mode 100644 index 0000000..f6a42fb --- /dev/null +++ b/loguru-0.7.3.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1cad8860aa0ecf9567125381e4430046526246e075224350a6a624addac05f5e +size 459102 diff --git a/py313.patch b/py313.patch deleted file mode 100644 index 1abf719..0000000 --- a/py313.patch +++ /dev/null @@ -1,100 +0,0 @@ -From a7a2d72d9e3495ddec9dde2852fa7a932b76d0c4 Mon Sep 17 00:00:00 2001 -From: Dave Hall -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) diff --git a/py314.patch b/py314.patch deleted file mode 100644 index 2c2509a..0000000 --- a/py314.patch +++ /dev/null @@ -1,105 +0,0 @@ -From 3a901de465b0dbb398f455dc3393d976fd0affbe Mon Sep 17 00:00:00 2001 -From: Delgan -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 ---" - - diff --git a/python-loguru.changes b/python-loguru.changes index 373dc7d..07e1b00 100644 --- a/python-loguru.changes +++ b/python-loguru.changes @@ -1,3 +1,17 @@ +------------------------------------------------------------------- +Wed May 7 05:28:06 UTC 2025 - Guang Yee + +- 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 diff --git a/python-loguru.spec b/python-loguru.spec index f39d173..0ccdde9 100644 --- a/python-loguru.spec +++ b/python-loguru.spec @@ -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/v%{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