From cf8e557e0f67b12f0acf380bf5bf8975cca3652062e1da5a9b56dac09caf217d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20Schr=C3=B6ter?= Date: Fri, 13 Dec 2024 11:53:55 +0100 Subject: [PATCH] Sync from SUSE:SLFO:Main python-parso revision 249c40e48866466ac3ecbb4b630b79e9 --- ...69d7a109798adbf9538d70e92138f077d700.patch | 181 ------------------ parso-0.8.3.tar.gz | 3 - parso-0.8.4.tar.gz | 3 + python-parso.changes | 19 ++ python-parso.spec | 18 +- 5 files changed, 32 insertions(+), 192 deletions(-) delete mode 100644 cf5969d7a109798adbf9538d70e92138f077d700.patch delete mode 100644 parso-0.8.3.tar.gz create mode 100644 parso-0.8.4.tar.gz diff --git a/cf5969d7a109798adbf9538d70e92138f077d700.patch b/cf5969d7a109798adbf9538d70e92138f077d700.patch deleted file mode 100644 index 0a329df..0000000 --- a/cf5969d7a109798adbf9538d70e92138f077d700.patch +++ /dev/null @@ -1,181 +0,0 @@ -From cf5969d7a109798adbf9538d70e92138f077d700 Mon Sep 17 00:00:00 2001 -From: Jochen Sprickerhof -Date: Sun, 4 Dec 2022 13:29:25 +0100 -Subject: [PATCH] Fix unit tests in Python 3.10 (Closes: #192) - ---- - parso/python/errors.py | 51 ++++++++++++++++++++++++++++++-------- - test/test_python_errors.py | 23 +++++++++++++++++ - 2 files changed, 64 insertions(+), 10 deletions(-) - -diff --git a/parso/python/errors.py b/parso/python/errors.py -index 5da046a..09c5047 100644 ---- a/parso/python/errors.py -+++ b/parso/python/errors.py -@@ -1,5 +1,6 @@ - # -*- coding: utf-8 -*- - import codecs -+import sys - import warnings - import re - from contextlib import contextmanager -@@ -33,7 +34,10 @@ def _get_rhs_name(node, version): - return "literal" - else: - if second.children[1] == ":" or second.children[0] == "**": -- return "dict display" -+ if version < (3, 10): -+ return "dict display" -+ else: -+ return "dict literal" - else: - return "set display" - elif ( -@@ -47,7 +51,10 @@ def _get_rhs_name(node, version): - elif first == "[": - return "list" - elif first == "{" and second == "}": -- return "dict display" -+ if version < (3, 10): -+ return "dict display" -+ else: -+ return "dict literal" - elif first == "{" and len(node.children) > 2: - return "set display" - elif type_ == "keyword": -@@ -58,7 +65,10 @@ def _get_rhs_name(node, version): - else: - return str(node.value) - elif type_ == "operator" and node.value == "...": -- return "Ellipsis" -+ if version < (3, 10): -+ return "Ellipsis" -+ else: -+ return "ellipsis" - elif type_ == "comparison": - return "comparison" - elif type_ in ("string", "number", "strings"): -@@ -83,7 +93,10 @@ def _get_rhs_name(node, version): - or "_test" in type_ - or type_ in ("term", "factor") - ): -- return "operator" -+ if version < (3, 10): -+ return "operator" -+ else: -+ return "expression" - elif type_ == "star_expr": - return "starred" - elif type_ == "testlist_star_expr": -@@ -610,7 +623,10 @@ def is_issue(self, leaf): - - @ErrorFinder.register_rule(type='string') - class _StringChecks(SyntaxRule): -- message = "bytes can only contain ASCII literal characters." -+ if sys.version_info < (3, 10): -+ message = "bytes can only contain ASCII literal characters." -+ else: -+ message = "bytes can only contain ASCII literal characters" - - def is_issue(self, leaf): - string_prefix = leaf.string_prefix.lower() -@@ -1043,14 +1059,20 @@ def _check_assignment(self, node, is_deletion=False, is_namedexpr=False, is_aug_ - error = 'literal' - else: - if second.children[1] == ':': -- error = 'dict display' -+ if self._normalizer.version < (3, 10): -+ error = 'dict display' -+ else: -+ error = 'dict literal' - else: - error = 'set display' - elif first == "{" and second == "}": - if self._normalizer.version < (3, 8): - error = 'literal' - else: -- error = "dict display" -+ if self._normalizer.version < (3, 10): -+ error = "dict display" -+ else: -+ error = "dict literal" - elif first == "{" and len(node.children) > 2: - if self._normalizer.version < (3, 8): - error = 'literal' -@@ -1083,7 +1105,10 @@ def _check_assignment(self, node, is_deletion=False, is_namedexpr=False, is_aug_ - error = str(node.value) - elif type_ == 'operator': - if node.value == '...': -- error = 'Ellipsis' -+ if self._normalizer.version < (3, 10): -+ error = 'Ellipsis' -+ else: -+ error = 'ellipsis' - elif type_ == 'comparison': - error = 'comparison' - elif type_ in ('string', 'number', 'strings'): -@@ -1098,7 +1123,10 @@ def _check_assignment(self, node, is_deletion=False, is_namedexpr=False, is_aug_ - if node.children[0] == 'await': - error = 'await expression' - elif node.children[-2] == '**': -- error = 'operator' -+ if self._normalizer.version < (3, 10): -+ error = 'operator' -+ else: -+ error = 'expression' - else: - # Has a trailer - trailer = node.children[-1] -@@ -1120,7 +1148,10 @@ def _check_assignment(self, node, is_deletion=False, is_namedexpr=False, is_aug_ - elif ('expr' in type_ and type_ != 'star_expr' # is a substring - or '_test' in type_ - or type_ in ('term', 'factor')): -- error = 'operator' -+ if self._normalizer.version < (3, 10): -+ error = 'operator' -+ else: -+ error = 'expression' - elif type_ == "star_expr": - if is_deletion: - if self._normalizer.version >= (3, 9): -diff --git a/test/test_python_errors.py b/test/test_python_errors.py -index adf5f06..9686d14 100644 ---- a/test/test_python_errors.py -+++ b/test/test_python_errors.py -@@ -1,6 +1,7 @@ - """ - Testing if parso finds syntax errors and indentation errors. - """ -+import re - import sys - import warnings - -@@ -136,6 +137,28 @@ def _get_actual_exception(code): - wanted = 'SyntaxError: invalid syntax' - elif wanted == "SyntaxError: f-string: single '}' is not allowed": - wanted = 'SyntaxError: invalid syntax' -+ elif "Maybe you meant '==' instead of '='?" in wanted: -+ wanted = wanted.removesuffix(" here. Maybe you meant '==' instead of '='?") -+ elif re.match( -+ r"SyntaxError: unterminated string literal \(detected at line \d+\)", wanted -+ ): -+ wanted = "SyntaxError: EOL while scanning string literal" -+ elif re.match( -+ r"SyntaxError: unterminated triple-quoted string literal \(detected at line \d+\)", -+ wanted, -+ ): -+ wanted = 'SyntaxError: EOF while scanning triple-quoted string literal' -+ elif wanted == 'SyntaxError: cannot use starred expression here': -+ wanted = "SyntaxError: can't use starred expression here" -+ elif wanted == 'SyntaxError: f-string: cannot use starred expression here': -+ wanted = "SyntaxError: f-string: can't use starred expression here" -+ elif re.match( -+ r"IndentationError: expected an indented block after '[^']*' statement on line \d", -+ wanted, -+ ): -+ wanted = 'IndentationError: expected an indented block' -+ elif wanted == 'SyntaxError: unterminated string literal': -+ wanted = 'SyntaxError: EOL while scanning string literal' - return [wanted], line_nr - - diff --git a/parso-0.8.3.tar.gz b/parso-0.8.3.tar.gz deleted file mode 100644 index ae44ef3..0000000 --- a/parso-0.8.3.tar.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:8c07be290bb59f03588915921e29e8a50002acaf2cdc5fa0e0114f91709fafa0 -size 400064 diff --git a/parso-0.8.4.tar.gz b/parso-0.8.4.tar.gz new file mode 100644 index 0000000..dcb64d0 --- /dev/null +++ b/parso-0.8.4.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:eb3a7b58240fb99099a345571deecc0f9540ea5f4dd2fe14c2a99d6b281ab92d +size 400609 diff --git a/python-parso.changes b/python-parso.changes index 2d0f87a..5f4dcaf 100644 --- a/python-parso.changes +++ b/python-parso.changes @@ -1,3 +1,22 @@ +------------------------------------------------------------------- +Fri Aug 2 08:36:21 UTC 2024 - John Paul Adrian Glaubitz + +- Skip test_python_exception_matches on Python 3.13 as well + +------------------------------------------------------------------- +Mon Jul 22 11:38:30 UTC 2024 - John Paul Adrian Glaubitz + +- Update to 0.8.4 + * Add basic support for Python 3.13 +- Drop patches for issues fixed upstream + * cf5969d7a109798adbf9538d70e92138f077d700.patch + +------------------------------------------------------------------- +Tue Oct 3 02:36:16 UTC 2023 - Steve Kowalik + +- Switch to pyproject macros. +- Also skip the recalcitrant test under Python 3.12. + ------------------------------------------------------------------- Fri Apr 21 12:29:02 UTC 2023 - Dirk Müller diff --git a/python-parso.spec b/python-parso.spec index 2421790..e5a4914 100644 --- a/python-parso.spec +++ b/python-parso.spec @@ -1,7 +1,7 @@ # # spec file for package python-parso # -# Copyright (c) 2023 SUSE LLC +# Copyright (c) 2024 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -16,19 +16,18 @@ # -%{?!python_module:%define python_module() python-%{**} python3-%{**}} -%define skip_python2 1 %{?sle15_python_module_pythons} Name: python-parso -Version: 0.8.3 +Version: 0.8.4 Release: 0 Summary: An autocompletion tool for Python License: MIT AND Python-2.0 URL: https://github.com/davidhalter/parso Source0: https://files.pythonhosted.org/packages/source/p/parso/parso-%{version}.tar.gz -Patch1: https://github.com/davidhalter/parso/commit/cf5969d7a109798adbf9538d70e92138f077d700.patch +BuildRequires: %{python_module pip} BuildRequires: %{python_module pytest >= 3.0.7} BuildRequires: %{python_module setuptools} +BuildRequires: %{python_module wheel} BuildRequires: fdupes BuildRequires: python-rpm-macros BuildArch: noarch @@ -50,21 +49,24 @@ tree. %autosetup -p1 -n parso-%{version} %build -%python_build +%pyproject_wheel %install -%python_install +%pyproject_install %python_expand %fdupes %{buildroot}%{$python_sitelib} %check # Python 3.10 has deviating exception messages -- gh#davidhalter/parso#192 python310_args=("-k" "not test_python_exception_matches") +# Python 3.12 and newer also changes how f-strings are parsed +python312_args=("-k" "not test_python_exception_matches") +python313_args=("-k" "not test_python_exception_matches") %pytest "${$python_args[@]}" %files %{python_files} %license LICENSE.txt %doc AUTHORS.txt CHANGELOG.rst README.rst -%{python_sitelib}/parso-%{version}-py*.egg-info +%{python_sitelib}/parso-%{version}.dist-info %{python_sitelib}/parso/ %changelog