diff options
| author | root <root@alpha.trunkmasters.com> | 2026-06-04 05:48:38 -0500 |
|---|---|---|
| committer | root <root@alpha.trunkmasters.com> | 2026-06-04 05:48:38 -0500 |
| commit | bfd9c39e4712ebdb442d4ca0673061faed1e70e1 (patch) | |
| tree | 0d7a74b4463ee387f9cf9368ceb1b757f694f72a /dev-python/astor | |
| parent | f716a9fe6455d39eef01e718aae68dae61c19704 (diff) | |
| download | baldeagleos-repo-bfd9c39e4712ebdb442d4ca0673061faed1e70e1.tar.gz baldeagleos-repo-bfd9c39e4712ebdb442d4ca0673061faed1e70e1.tar.xz baldeagleos-repo-bfd9c39e4712ebdb442d4ca0673061faed1e70e1.zip | |
Revert "Adding metadata"
This reverts commit f716a9fe6455d39eef01e718aae68dae61c19704.
Diffstat (limited to 'dev-python/astor')
| -rw-r--r-- | dev-python/astor/Manifest | 1 | ||||
| -rw-r--r-- | dev-python/astor/astor-0.8.1-r2.ebuild | 36 | ||||
| -rw-r--r-- | dev-python/astor/files/astor-0.8.1-py314.patch | 99 | ||||
| -rw-r--r-- | dev-python/astor/files/astor-0.8.1-tests-bigint.patch | 23 | ||||
| -rw-r--r-- | dev-python/astor/metadata.xml | 13 |
5 files changed, 172 insertions, 0 deletions
diff --git a/dev-python/astor/Manifest b/dev-python/astor/Manifest new file mode 100644 index 000000000000..f49f3b4e8378 --- /dev/null +++ b/dev-python/astor/Manifest @@ -0,0 +1 @@ +DIST astor-0.8.1.tar.gz 35090 BLAKE2B 11e5e77d4f8a8617d0330d3091a1571744bb5773df926f41b10208e1c5beb7e82ad8961a460dd326e9130591dade495c77a36456618a97a5c22e41237805a4ce SHA512 cfc69a21fcbc9842bc26fbe8372e5c700d9957cc0c3c62de415155d2036163951f0ece88557829afd7c4dabba8a8e238a2335994ddfc020cb3db913eed5b6f28 diff --git a/dev-python/astor/astor-0.8.1-r2.ebuild b/dev-python/astor/astor-0.8.1-r2.ebuild new file mode 100644 index 000000000000..2f3395af66a0 --- /dev/null +++ b/dev-python/astor/astor-0.8.1-r2.ebuild @@ -0,0 +1,36 @@ +# Copyright 1999-2025 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +DISTUTILS_USE_PEP517=setuptools +PYTHON_COMPAT=( python3_{13..14} ) + +inherit distutils-r1 pypi + +DESCRIPTION="Read/rewrite/write Python ASTs" +HOMEPAGE=" + https://pypi.org/project/astor/ + https://github.com/berkerpeksag/astor/ +" + +LICENSE="BSD" +SLOT="0" +KEYWORDS="~alpha amd64 arm arm64 ~hppa ~loong ~mips ppc ppc64 ~riscv ~s390 ~sparc x86" + +PATCHES=( + "${FILESDIR}/${P}-tests-bigint.patch" + # https://github.com/berkerpeksag/astor/pull/233 + "${FILESDIR}/${P}-py314.patch" +) + +distutils_enable_tests pytest + +python_test() { + local EPYTEST_IGNORE=( + tests/test_rtrip.py + ) + + local -x PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 + epytest +} diff --git a/dev-python/astor/files/astor-0.8.1-py314.patch b/dev-python/astor/files/astor-0.8.1-py314.patch new file mode 100644 index 000000000000..e5af45648393 --- /dev/null +++ b/dev-python/astor/files/astor-0.8.1-py314.patch @@ -0,0 +1,99 @@ +From d0b5563cc1e263f08df9312d89a7691167448f4d Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org> +Date: Wed, 14 May 2025 19:52:30 +0200 +Subject: [PATCH] Fix compatibility with Python 3.14 (mostly) + +Fix the code and the test suite to work with Python 3.14, where +deprecated constant-like AST nodes were removed. Notably: + +1. Skip tests for deprecated nodes in Python 3.14. + +2. Use `ast.Constant` over `ast.Num` for non-deprecated code + in Python 3.6+. + +3. Check for `ast.Str` only in Python < 3.14, and handle `ast.Constant` + being used to represent a string instead. + +With these changes, all tests except for: + + tests/test_rtrip.py::RtripTestCase::test_convert_stdlib + +pass. However, this particular test also hanged for me with older Python +versions. + +Related to #217 +--- + astor/code_gen.py | 9 +++++++-- + tests/test_code_gen.py | 11 ++++++++--- + 2 files changed, 15 insertions(+), 5 deletions(-) + +diff --git a/astor/code_gen.py b/astor/code_gen.py +index b2bae12..4330f49 100644 +--- a/astor/code_gen.py ++++ b/astor/code_gen.py +@@ -692,6 +692,7 @@ def _handle_string_constant(self, node, value, is_joined=False): + current_line = ''.join(current_line) + + has_ast_constant = sys.version_info >= (3, 6) ++ has_ast_str = sys.version_info < (3, 14) + + if is_joined: + # Handle new f-strings. This is a bit complicated, because +@@ -700,7 +701,7 @@ def _handle_string_constant(self, node, value, is_joined=False): + + def recurse(node): + for value in node.values: +- if isinstance(value, ast.Str): ++ if has_ast_str and isinstance(value, ast.Str): + # Double up braces to escape them. + self.write(value.s.replace('{', '{{').replace('}', '}}')) + elif isinstance(value, ast.FormattedValue): +@@ -713,7 +714,11 @@ def recurse(node): + self.write(':') + recurse(value.format_spec) + elif has_ast_constant and isinstance(value, ast.Constant): +- self.write(value.value) ++ if isinstance(value.value, str): ++ # Double up braces to escape them. ++ self.write(value.value.replace('{', '{{').replace('}', '}}')) ++ else: ++ self.write(value.value) + else: + kind = type(value).__name__ + assert False, 'Invalid node %s inside JoinedStr' % kind +diff --git a/tests/test_code_gen.py b/tests/test_code_gen.py +index e828eb9..1825030 100644 +--- a/tests/test_code_gen.py ++++ b/tests/test_code_gen.py +@@ -28,7 +28,10 @@ def astorexpr(x): + return eval(astor.to_source(ast.Expression(body=x))) + + def astornum(x): +- return astorexpr(ast.Num(n=x)) ++ if sys.version_info >= (3, 6): ++ return astorexpr(ast.Constant(x)) ++ else: ++ return astorexpr(ast.Num(n=x)) + + class Comparisons(object): + +@@ -515,8 +518,8 @@ def test_deprecated_constants_as_name(self): + ast.Assign(targets=[ast.Name(id='spam')], value=ast.Name(id='None')), + "spam = None") + +- @unittest.skipUnless(sys.version_info >= (3, 4), +- "ast.NameConstant introduced in Python 3.4") ++ @unittest.skipUnless((3, 4) <= sys.version_info < (3, 14), ++ "ast.NameConstant introduced in Python 3.4, removed in 3.14") + def test_deprecated_name_constants(self): + self.assertAstEqualsSource( + ast.Assign(targets=[ast.Name(id='spam')], value=ast.NameConstant(value=True)), +@@ -530,6 +533,8 @@ def test_deprecated_name_constants(self): + ast.Assign(targets=[ast.Name(id='spam')], value=ast.NameConstant(value=None)), + "spam = None") + ++ @unittest.skipIf(sys.version_info >= (3, 14), ++ "Deprecated Constant nodes removed in Python 3.14") + def test_deprecated_constant_nodes(self): + self.assertAstEqualsSource( + ast.Assign(targets=[ast.Name(id='spam')], value=ast.Num(3)), diff --git a/dev-python/astor/files/astor-0.8.1-tests-bigint.patch b/dev-python/astor/files/astor-0.8.1-tests-bigint.patch new file mode 100644 index 000000000000..777e9390b9bf --- /dev/null +++ b/dev-python/astor/files/astor-0.8.1-tests-bigint.patch @@ -0,0 +1,23 @@ +https://bugs.gentoo.org/868711 +https://github.com/berkerpeksag/astor/commit/8342d6aa5dcdcf20f89a19057527510c245c7a2e + +From 8342d6aa5dcdcf20f89a19057527510c245c7a2e Mon Sep 17 00:00:00 2001 +From: Jochen Sprickerhof <jspricke@debian.org> +Date: Fri, 30 Dec 2022 14:47:57 +0100 +Subject: [PATCH] Reduce huge int in test (Closes: #212) + +Int was above limits: + +https://docs.python.org/3/library/stdtypes.html#int-max-str-digits +--- a/tests/test_code_gen.py ++++ b/tests/test_code_gen.py +@@ -291,7 +291,7 @@ def test_with(self): + self.assertAstRoundtripsGtVer(source, (2, 7)) + + def test_huge_int(self): +- for n in (10**10000, ++ for n in (10**1000, + 0xdfa21cd2a530ccc8c870aa60d9feb3b35deeab81c3215a96557abbd683d21f4600f38e475d87100da9a4404220eeb3bb5584e5a2b5b48ffda58530ea19104a32577d7459d91e76aa711b241050f4cc6d5327ccee254f371bcad3be56d46eb5919b73f20dbdb1177b700f00891c5bf4ed128bb90ed541b778288285bcfa28432ab5cbcb8321b6e24760e998e0daa519f093a631e44276d7dd252ce0c08c75e2ab28a7349ead779f97d0f20a6d413bf3623cd216dc35375f6366690bcc41e3b2d5465840ec7ee0dc7e3f1c101d674a0c7dbccbc3942788b111396add2f8153b46a0e4b50d66e57ee92958f1c860dd97cc0e40e32febff915343ed53573142bdf4b): + self.assertEqual(astornum(n), n) + + diff --git a/dev-python/astor/metadata.xml b/dev-python/astor/metadata.xml new file mode 100644 index 000000000000..4870a5e8d346 --- /dev/null +++ b/dev-python/astor/metadata.xml @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <maintainer type="project"> + <email>python@gentoo.org</email> + <name>Python</name> + </maintainer> + <stabilize-allarches/> + <upstream> + <remote-id type="pypi">astor</remote-id> + <remote-id type="github">berkerpeksag/astor</remote-id> + </upstream> +</pkgmetadata> |
