Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-loguru for openSUSE:Factory checked in at 2021-04-19 21:06:11 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-loguru (Old) and /work/SRC/openSUSE:Factory/.python-loguru.new.12324 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-loguru" Mon Apr 19 21:06:11 2021 rev:6 rq:886595 version:0.5.3 Changes: -------- --- /work/SRC/openSUSE:Factory/python-loguru/python-loguru.changes 2021-02-19 23:45:24.275371585 +0100 +++ /work/SRC/openSUSE:Factory/.python-loguru.new.12324/python-loguru.changes 2021-04-19 21:06:30.364074952 +0200 @@ -1,0 +2,7 @@ +Sun Apr 18 12:17:42 UTC 2021 - Ben Greiner <c...@bnavigator.de> + +- Add loguru-exception-formatting-py39.patch + https://github.com/Delgan/loguru/commit/19f518c5 for changed + exception formatting in Python 3.9 + +------------------------------------------------------------------- New: ---- loguru-exception-formatting-py39.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-loguru.spec ++++++ --- /var/tmp/diff_new_pack.ckhPBO/_old 2021-04-19 21:06:30.820075636 +0200 +++ /var/tmp/diff_new_pack.ckhPBO/_new 2021-04-19 21:06:30.824075641 +0200 @@ -26,13 +26,16 @@ 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 pytest-6.2-excepthooks.patch Patch0: https://github.com/Delgan/loguru/commit/31cf758ee9d22dbfa125f38153782fe20ac9dce5.patch#/pytest-6.2-excepthooks.patch +# PATCH-FIX-UPSTREAM loguru-exception-formatting-py39.patch +Patch1: https://github.com/Delgan/loguru/commit/19f518c5f1f355703ffc4ee62f0e1e397605863e.patch#/loguru-exception-formatting-py39.patch +BuildRequires: %{python_module aiocontextvars if %python-base < 3.7} BuildRequires: %{python_module colorama} BuildRequires: %{python_module pytest} BuildRequires: %{python_module setuptools} BuildRequires: fdupes BuildRequires: python-rpm-macros -BuildRequires: ((python3-aiocontextvars and python3-base < 3.7) or (python36-aiocontextvars and python36-base)) %if 0%{?python_version_nodots} < 37 Requires: python-aiocontextvars %endif @@ -46,8 +49,7 @@ which dispatches log messages to configured handlers. %prep -%setup -q -n loguru-%{version} -%patch0 -p1 +%autosetup -p1 -n loguru-%{version} %build %python_build ++++++ loguru-exception-formatting-py39.patch ++++++ >From 19f518c5f1f355703ffc4ee62f0e1e397605863e Mon Sep 17 00:00:00 2001 From: Delgan <delgan...@gmail.com> Date: Sat, 13 Mar 2021 12:47:47 +0100 Subject: [PATCH] Fix unit tests for exception formatting for Python 3.9 Formatting changed, notably because absolute instead of relative paths are used in traceback: https://bugs.python.org/issue20443 --- .../output/diagnose/indentation_error.txt | 1 - .../output/diagnose/syntax_error.txt | 2 +- .../others/syntaxerror_without_traceback.txt | 8 ++--- .../output/ownership/syntaxerror.txt | 10 +++--- tests/test_exceptions_formatting.py | 31 ++++++++++++++++++- 5 files changed, 40 insertions(+), 12 deletions(-) diff --git a/tests/exceptions/output/diagnose/indentation_error.txt b/tests/exceptions/output/diagnose/indentation_error.txt index b2faa4d..d5b950a 100644 --- a/tests/exceptions/output/diagnose/indentation_error.txt +++ b/tests/exceptions/output/diagnose/indentation_error.txt @@ -7,6 +7,5 @@ File "<string>", line 4 print("foobar") #intentional faulty indentation here. - ^ [31m[1mIndentationError[0m:[1m unexpected indent[0m diff --git a/tests/exceptions/output/diagnose/syntax_error.txt b/tests/exceptions/output/diagnose/syntax_error.txt index 6e1f612..c8b0761 100644 --- a/tests/exceptions/output/diagnose/syntax_error.txt +++ b/tests/exceptions/output/diagnose/syntax_error.txt @@ -7,6 +7,6 @@ File "<string>", line 4 b = 7 * - ^ + ^ [31m[1mSyntaxError[0m:[1m invalid syntax[0m diff --git a/tests/exceptions/output/others/syntaxerror_without_traceback.txt b/tests/exceptions/output/others/syntaxerror_without_traceback.txt index a4747ee..d798ba1 100644 --- a/tests/exceptions/output/others/syntaxerror_without_traceback.txt +++ b/tests/exceptions/output/others/syntaxerror_without_traceback.txt @@ -1,20 +1,20 @@ File "<string>", line 1 foo = - ^ + ^ [31m[1mSyntaxError[0m:[1m invalid syntax[0m File "<string>", line 1 foo = - ^ + ^ [31m[1mSyntaxError[0m:[1m invalid syntax[0m File "<string>", line 1 foo = - ^ + ^ [31m[1mSyntaxError[0m:[1m invalid syntax[0m File "<string>", line 1 foo = - ^ + ^ [31m[1mSyntaxError[0m:[1m invalid syntax[0m diff --git a/tests/exceptions/output/ownership/syntaxerror.txt b/tests/exceptions/output/ownership/syntaxerror.txt index 1dc88ef..00763f6 100644 --- a/tests/exceptions/output/ownership/syntaxerror.txt +++ b/tests/exceptions/output/ownership/syntaxerror.txt @@ -13,7 +13,7 @@ exec("foo =") File "<string>", line 1 foo = - ^ + ^ [31m[1mSyntaxError[0m:[1m invalid syntax[0m @@ -27,7 +27,7 @@ exec("foo =") File "<string>", line 1 foo = - ^ + ^ [31m[1mSyntaxError[0m:[1m invalid syntax[0m @@ -40,7 +40,7 @@ exec("foo =") File "<string>", line 1 foo = - ^ + ^ [31m[1mSyntaxError[0m:[1m invalid syntax[0m [33m[1mTraceback (most recent call last):[0m @@ -50,7 +50,7 @@ exec("foo =") File "<string>", line 1 foo = - ^ + ^ [31m[1mSyntaxError[0m:[1m invalid syntax[0m Traceback (most recent call last): @@ -60,5 +60,5 @@ Traceback (most recent call last): exec("foo =") File "<string>", line 1 foo = - ^ + ^ SyntaxError: invalid syntax diff --git a/tests/test_exceptions_formatting.py b/tests/test_exceptions_formatting.py index 79c41f6..cad2dba 100644 --- a/tests/test_exceptions_formatting.py +++ b/tests/test_exceptions_formatting.py @@ -9,12 +9,41 @@ def normalize(exception): """Normalize exception output for reproducible test cases""" - if os.name: + if os.name == "nt": exception = re.sub( r'File[^"]+"[^"]+\.py[^"]*"', lambda m: m.group().replace("\\", "/"), exception ) exception = re.sub(r"(\r\n|\r|\n)", "\n", exception) + if sys.version_info >= (3, 9, 0): + + def fix_filepath(match): + filepath = match.group(1) + pattern = ( + r'((?:\x1b\[[0-9]*m)+)([^"]+?)((?:\x1b\[[0-9]*m)+)([^"]+?)((?:\x1b\[[0-9]*m)+)' + ) + match = re.match(pattern, filepath) + start_directory = os.path.dirname(os.path.dirname(__file__)) + if match: + groups = list(match.groups()) + groups[1] = os.path.relpath(os.path.abspath(groups[1]), start_directory) + "/" + relpath = "".join(groups) + else: + relpath = os.path.relpath(os.path.abspath(filepath), start_directory) + return 'File "%s"' % relpath + + exception = re.sub( + r'File "([^"]+\.py[^"]*)"', + fix_filepath, + exception, + ) + + if sys.version_info < (3, 9, 0): + if "SyntaxError" in exception: + exception = re.sub(r"(\n *)(\^ *\n)", r"\1 \2", exception) + elif "IndentationError" in exception: + exception = re.sub(r"\n *\^ *\n", "\n", exception) + exception = re.sub( r'"[^"]*/somelib/__init__.py"', '"/usr/lib/python/somelib/__init__.py"', exception )