From b7720ef867c591d45966c3af9191a1d7c632abd2a262699eb38545e5401df196 Mon Sep 17 00:00:00 2001 From: Eric Schirra Date: Mon, 17 Nov 2025 09:12:03 +0000 Subject: [PATCH] - Update to 3.0.1 * Replace ast.Str usages with ast.Constant (#157) * Bump jinja2 from 3.1.4 to 3.1.6 in /docs * Bump urllib3 from 2.2.2 to 2.5.0 in /docs * Bump requests from 2.32.2 to 2.32.4 in /docs * Various links improvements (#163) * Adapt asttokens for astroid 4.x (#165) * Add tests for astroid v2, v3, and v4 to the CI (#166) * Update mypy; add 3.14 to the CI; drop python 3.8 support (#167) - Drop py314-deprecations.patch, merged upstream OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-asttokens?expand=0&rev=28 --- .gitattributes | 23 +++++++ .gitignore | 1 + asttokens-3.0.0.tar.gz | 3 + asttokens-3.0.1.tar.gz | 3 + py314-deprecations.patch | 59 +++++++++++++++++ python-asttokens.changes | 134 +++++++++++++++++++++++++++++++++++++++ python-asttokens.spec | 69 ++++++++++++++++++++ 7 files changed, 292 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 asttokens-3.0.0.tar.gz create mode 100644 asttokens-3.0.1.tar.gz create mode 100644 py314-deprecations.patch create mode 100644 python-asttokens.changes create mode 100644 python-asttokens.spec diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,23 @@ +## Default LFS +*.7z filter=lfs diff=lfs merge=lfs -text +*.bsp filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.gem filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.jar filter=lfs diff=lfs merge=lfs -text +*.lz filter=lfs diff=lfs merge=lfs -text +*.lzma filter=lfs diff=lfs merge=lfs -text +*.obscpio filter=lfs diff=lfs merge=lfs -text +*.oxt filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.rpm filter=lfs diff=lfs merge=lfs -text +*.tbz filter=lfs diff=lfs merge=lfs -text +*.tbz2 filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.txz filter=lfs diff=lfs merge=lfs -text +*.whl filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57affb6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.osc diff --git a/asttokens-3.0.0.tar.gz b/asttokens-3.0.0.tar.gz new file mode 100644 index 0000000..27387b7 --- /dev/null +++ b/asttokens-3.0.0.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0dcd8baa8d62b0c1d118b399b2ddba3c4aff271d0d7a9e0d4c1681c79035bbc7 +size 61978 diff --git a/asttokens-3.0.1.tar.gz b/asttokens-3.0.1.tar.gz new file mode 100644 index 0000000..0e7c236 --- /dev/null +++ b/asttokens-3.0.1.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:71a4ee5de0bde6a31d64f6b13f2293ac190344478f081c3d1bccfcf5eacb0cb7 +size 62308 diff --git a/py314-deprecations.patch b/py314-deprecations.patch new file mode 100644 index 0000000..0c15969 --- /dev/null +++ b/py314-deprecations.patch @@ -0,0 +1,59 @@ +From bb1df1417159f6ad0ec5c6c8b27118d50b35f70a Mon Sep 17 00:00:00 2001 +From: Karolina Surma <33810531+befeleme@users.noreply.github.com> +Date: Tue, 7 Jan 2025 13:58:06 +0100 +Subject: [PATCH] Replace ast.Str usages with ast.Constant (#157) + +--- + tests/test_asttokens.py | 2 +- + tests/test_tokenless.py | 4 ++-- + tests/test_util.py | 2 +- + 3 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/tests/test_asttokens.py b/tests/test_asttokens.py +index b9489cb..c654af3 100644 +--- a/tests/test_asttokens.py ++++ b/tests/test_asttokens.py +@@ -125,7 +125,7 @@ def test_unicode_offsets(self): + + # Verify that ast parser produces offsets as we expect. This is just to inform the + # implementation. +- string_node = next(n for n in ast.walk(root) if isinstance(n, ast.Str)) ++ string_node = next(n for n in ast.walk(root) if isinstance(n, ast.Constant)) + self.assertEqual(string_node.lineno, 1) + self.assertEqual(string_node.col_offset, 4) + +diff --git a/tests/test_tokenless.py b/tests/test_tokenless.py +index ab2f3d6..881c69a 100644 +--- a/tests/test_tokenless.py ++++ b/tests/test_tokenless.py +@@ -47,7 +47,7 @@ def is_fstring_format_spec(node): + and len(node.values) == 1 + and ( + ( +- isinstance(node.values[0], ast.Str) ++ isinstance(node.values[0], ast.Constant) + and node.values[0].value in ['.2f'] + ) or ( + isinstance(node.values[0], ast.FormattedValue) +@@ -97,7 +97,7 @@ def check_node(self, atok, node): + atok_text = atok.get_text(node, padded=padded) + if ast_text: + if sys.version_info < (3, 12) and ( +- ast_text.startswith("f") and isinstance(node, (ast.Str, ast.FormattedValue)) ++ ast_text.startswith("f") and isinstance(node, (ast.Constant, ast.FormattedValue)) + or is_fstring_format_spec(node) + or (not fstring_positions_work() and is_fstring_internal_node(node)) + ): +diff --git a/tests/test_util.py b/tests/test_util.py +index a38fef2..0c7f94d 100644 +--- a/tests/test_util.py ++++ b/tests/test_util.py +@@ -98,7 +98,7 @@ def test_replace(self): + source = "foo(bar(1 + 2), 'hello' + ', ' + 'world')" + atok = asttokens.ASTTokens(source, parse=True) + names = [n for n in asttokens.util.walk(atok.tree) if isinstance(n, ast.Name)] +- strings = [n for n in asttokens.util.walk(atok.tree) if isinstance(n, ast.Str)] ++ strings = [n for n in asttokens.util.walk(atok.tree) if isinstance(n, ast.Constant) and isinstance(n.value, str)] + repl1 = [atok.get_text_range(n) + ('TEST',) for n in names] + repl2 = [atok.get_text_range(n) + ('val',) for n in strings] + self.assertEqual(asttokens.util.replace(source, repl1 + repl2), diff --git a/python-asttokens.changes b/python-asttokens.changes new file mode 100644 index 0000000..b5cc056 --- /dev/null +++ b/python-asttokens.changes @@ -0,0 +1,134 @@ +------------------------------------------------------------------- +Mon Nov 17 08:44:09 UTC 2025 - John Paul Adrian Glaubitz + +- Update to 3.0.1 + * Replace ast.Str usages with ast.Constant (#157) + * Bump jinja2 from 3.1.4 to 3.1.6 in /docs + * Bump urllib3 from 2.2.2 to 2.5.0 in /docs + * Bump requests from 2.32.2 to 2.32.4 in /docs + * Various links improvements (#163) + * Adapt asttokens for astroid 4.x (#165) + * Add tests for astroid v2, v3, and v4 to the CI (#166) + * Update mypy; add 3.14 to the CI; drop python 3.8 support (#167) +- Drop py314-deprecations.patch, merged upstream + +------------------------------------------------------------------- +Sun Sep 21 20:18:07 UTC 2025 - Dirk Müller + +- add py314-deprecations.patch + +------------------------------------------------------------------- +Fri Jun 13 05:35:07 UTC 2025 - Steve Kowalik + +- Switch to pyproject macros. + +------------------------------------------------------------------- +Wed Apr 30 12:07:17 UTC 2025 - Daniel Garcia + +- skip test_deep_recursion, it fails in s390x, + gh#gristlabs/asttokens#159 + +------------------------------------------------------------------- +Tue Jan 14 12:38:36 UTC 2025 - pgajdos@suse.com + +- version update to 3.0.0 + * no upstream changelog found + * remove dependency on six + +------------------------------------------------------------------- +Fri Oct 27 08:14:19 UTC 2023 - ecsos + +- Update to version 2.4.1 + * Support Astroid v3 + +------------------------------------------------------------------- +Mon Sep 18 20:07:19 UTC 2023 - Dirk Müller + +- update to 2.4.0: + * no upstream changelog available + +------------------------------------------------------------------- +Fri Apr 21 12:22:13 UTC 2023 - Dirk Müller + +- add sle15_python_module_pythons (jsc#PED-68) + +------------------------------------------------------------------- +Thu Apr 13 22:40:05 UTC 2023 - Matej Cepl + +- Make calling of %{sle15modernpython} optional. + +------------------------------------------------------------------- +Mon Dec 5 12:26:12 UTC 2022 - ecsos + +- Update to version 2.2.1 + * Test 3.11 +- Update to version 2.2.0 + * Fixes for newer astroid versions + +------------------------------------------------------------------- +Thu Dec 1 22:18:13 UTC 2022 - Yogalakshmi Arunachalam + +- Update to version 2.1.0 + * Merge pull request #93 from gristlabs/unmarked2 + ASTText class that doesn't require tokens + +------------------------------------------------------------------- +Fri Sep 23 11:59:52 UTC 2022 - ecsos + +- Update to version 2.0.8: + * Merge pull request #90 from palfrey/fix-explicit-import + * Fix mypy explicit re-export issues +- Changes from version 2.0.7: + * Merge pull request #87 from gristlabs/astroid-type-checking + * Fix astroid type checking import errors + +------------------------------------------------------------------- +Fri Sep 23 02:15:13 UTC 2022 - Yogalakshmi Arunachalam + +- Update to 2.0.8 + * Merge pull request #90 from palfrey/fix-explicit-import + * Fix mypy explicit re-export issues + +- Update to 2.0.7 + * Merge pull request #87 from gristlabs/astroid-type-checking + * Fix astroid type checking import errors +------------------------------------------------------------------- +Fri Nov 19 10:21:46 UTC 2021 - ecsos + +- Fix build error for Leap outside repo d:l:p. +- Disable build of python2 and python36. + End of support since: python2 (2020-01-01), python36 (2021-12-23) +- Insert reuired versions for required python-modules. + +------------------------------------------------------------------- +Sun Sep 5 22:20:08 UTC 2021 - malcolmlewis@opensuse.org + +- Updated to version 2.0.5: + * Add 3.9 support. +- Drop py39.patch as this is upstreamed. +- Skip failed test for the moment - TestAstroid. + +------------------------------------------------------------------- +Fri Apr 16 12:42:11 UTC 2021 - Markéta Machová + +- Add patch py39.patch to fix build with Python 3.9 + +------------------------------------------------------------------- +Thu Nov 12 14:38:22 UTC 2020 - malcolmlewis@opensuse.org + +- Updated to version 2.0.4: + * Fix for Python 3.9 keyword arguments. + * Don't verify slice nodes. + * Test 3.9 in tox and travis. +- Changes from version 2.0.3: + * Bump patch version. + +------------------------------------------------------------------- +Wed Jan 8 15:00:01 UTC 2020 - malcolmlewis@opensuse.org + +- Disable python2 build. + +------------------------------------------------------------------- +Tue Nov 19 17:45:21 UTC 2019 - malcolmlewis@opensuse.org + +- Initial build at version 2.0.2. diff --git a/python-asttokens.spec b/python-asttokens.spec new file mode 100644 index 0000000..6320a29 --- /dev/null +++ b/python-asttokens.spec @@ -0,0 +1,69 @@ +# +# spec file for package python-asttokens +# +# Copyright (c) 2025 SUSE LLC and contributors +# Copyright (c) 2019-2021 Malcolm J Lewis +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via https://bugs.opensuse.org/ +# + + +%{?sle15_python_module_pythons} +Name: python-asttokens +Version: 3.0.1 +Release: 0 +Summary: Annotate AST trees with source code positions +License: Apache-2.0 +Group: Development/Languages/Python +URL: https://github.com/gristlabs/asttokens +Source: https://files.pythonhosted.org/packages/source/a/asttokens/asttokens-%{version}.tar.gz +BuildRequires: %{python_module astroid} +BuildRequires: %{python_module devel} +BuildRequires: %{python_module pip} +BuildRequires: %{python_module pytest} +BuildRequires: %{python_module setuptools >= 44} +BuildRequires: %{python_module setuptools_scm >= 3.4.3} +BuildRequires: %{python_module toml} +BuildRequires: %{python_module wheel} +BuildRequires: fdupes +BuildRequires: python-rpm-macros +BuildArch: noarch +%python_subpackages + +%description +Annotate AST trees with source code positions + +%prep +%autosetup -p1 -n asttokens-%{version} + +%build +export LC_ALL=en_US.utf8 +%pyproject_wheel + +%install +export LC_ALL=en_US.utf8 +%pyproject_install +%python_expand %fdupes %{buildroot}%{$python_sitelib} + +%check +donttest="TestAstroid" +# Fails in s390x gh#gristlabs/asttokens#159 +donttest+=" or test_deep_recursion" +%pytest -k "not ($donttest)" + +%files %{python_files} +%doc README.rst +%license LICENSE +%{python_sitelib}/asttokens-%{version}.dist-info +%{python_sitelib}/asttokens + +%changelog