diff options
author | V3n3RiX <venerix@koprulu.sector> | 2025-05-15 12:59:17 +0100 |
---|---|---|
committer | V3n3RiX <venerix@koprulu.sector> | 2025-05-15 12:59:17 +0100 |
commit | 317f7ab04be81dbdfa5b1c9c42729927c5bde946 (patch) | |
tree | b90afe9d6ef62b771a6ddb9eb1968d6338ccd206 /dev-python/asttokens | |
parent | 5e9cf59ef591ef814092c1f6f32d2ef2369d3882 (diff) |
Diffstat (limited to 'dev-python/asttokens')
-rw-r--r-- | dev-python/asttokens/Manifest | 2 | ||||
-rw-r--r-- | dev-python/asttokens/asttokens-3.0.0-r1.ebuild | 39 | ||||
-rw-r--r-- | dev-python/asttokens/files/asttokens-3.0.0-py314.patch | 63 |
3 files changed, 104 insertions, 0 deletions
diff --git a/dev-python/asttokens/Manifest b/dev-python/asttokens/Manifest index 7c400e61081c..b834abfc1795 100644 --- a/dev-python/asttokens/Manifest +++ b/dev-python/asttokens/Manifest @@ -1,3 +1,5 @@ +AUX asttokens-3.0.0-py314.patch 2881 BLAKE2B dbb3cb2e426da2e5093836a5fa23686794532de4ce0f2373561a792d862f50e7b97fb3374ab1c07272940e98ae6c64a883d4faf6c6a530793be461d1e22ddb8e SHA512 e7e73a5918d70d08ee9d7132c2aed2225d00b33650862a1a571f735a9e0d67779fe8f4786b2d49098a397fcd7a9664c873d0ad1427c9c81277134d84d78d284a DIST asttokens-3.0.0.gh.tar.gz 56937 BLAKE2B 38b3c9271ba57c032f552cb6dedd2cd2ef2eb6294b2f5e2fde4821260b73453495576b6641fa9450bd86f08ed4a296e010a5ce5f0f3502cbeb27857e1792802f SHA512 9d0f78ee90758d52fd15ee2f1940ddc14e8fc0d15e83fb01e731c6b79e328510f6c588c7856935aed99017b98f1daa99ee25802964990d59f63c62a0a5646804 +EBUILD asttokens-3.0.0-r1.ebuild 899 BLAKE2B 4b450e00a5d51831bb398dc17b4deb1d29427c0b380c46acd5c504a13259fbacd967ba3dc4524904762f7a59164c3da618a2efdab3081405d41c28bd42650334 SHA512 ea2606d1662d1db53b0d0c34962ee73b0bebcff887645aa173c6d952d78fed3634b91378442cf6340ea7ad632d52f63233ae5db35faa868323ac6b54209d529f EBUILD asttokens-3.0.0.ebuild 801 BLAKE2B cb94411f553919cc53822c5a2acd41069064051dabebe543e3bdf44cf69c5850977c242c64868ec56ce36009be404b48db8f48bb198d43ae51134c75d6351588 SHA512 7b8d390337bea6643d9683cd984bb086ad94894492a1dfaff3dd7dc53a6568cea7128fe6b18b1d4368431905b68df0d6f1b1985e6e679c26ec25a4cf8310fdd0 MISC metadata.xml 374 BLAKE2B a66534fe071a1c8185eb8047241e979b1da80abf0527c50f08cb36cb2b876ac691185b3094e4b91a3c38320aeb4ed45a9ab8758513115bfd4d91cffa5f5c5830 SHA512 efa821c8b432187cc3386d382fcbf0c9ed95dce1309e2fef14c57032718e7409f6703806dc139cd85dd13d1a2722e93eeb742db427f88d923da1481fb8be9817 diff --git a/dev-python/asttokens/asttokens-3.0.0-r1.ebuild b/dev-python/asttokens/asttokens-3.0.0-r1.ebuild new file mode 100644 index 000000000000..430bddcfefc8 --- /dev/null +++ b/dev-python/asttokens/asttokens-3.0.0-r1.ebuild @@ -0,0 +1,39 @@ +# Copyright 2020-2025 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +DISTUTILS_USE_PEP517=setuptools +PYTHON_COMPAT=( pypy3_11 python3_{11..14} ) + +inherit distutils-r1 + +DESCRIPTION="Annotate Python AST trees with source text and token information" +HOMEPAGE=" + https://github.com/gristlabs/asttokens/ + https://pypi.org/project/asttokens/ +" +SRC_URI=" + https://github.com/gristlabs/asttokens/archive/v${PV}.tar.gz + -> ${P}.gh.tar.gz +" + +LICENSE="Apache-2.0" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~arm64-macos ~x64-macos" + +BDEPEND=" + dev-python/setuptools-scm[${PYTHON_USEDEP}] + test? ( + dev-python/astroid[${PYTHON_USEDEP}] + ) +" + +distutils_enable_tests pytest + +export SETUPTOOLS_SCM_PRETEND_VERSION=${PV} + +PATCHES=( + # https://github.com/gristlabs/asttokens/pull/157 + "${FILESDIR}/${P}-py314.patch" +) diff --git a/dev-python/asttokens/files/asttokens-3.0.0-py314.patch b/dev-python/asttokens/files/asttokens-3.0.0-py314.patch new file mode 100644 index 000000000000..a8b92f6d11cd --- /dev/null +++ b/dev-python/asttokens/files/asttokens-3.0.0-py314.patch @@ -0,0 +1,63 @@ +From 442d8615b2e60ba2274edd7cc24fc631a369bf02 Mon Sep 17 00:00:00 2001 +From: Karolina Surma <ksurma@redhat.com> +Date: Tue, 7 Jan 2025 10:29:52 +0100 +Subject: [PATCH] Replace ast.Str usages with ast.Constant + +Per What's new in Python 3.14: +ast.Str has been deprecated since Python 3.8, and have emitted deprecation +warnings since Python 3.12. +https://docs.python.org/dev/whatsnew/3.14.html#id3 +--- + 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), |