[gentoo-commits] repo/gentoo:master commit in: dev-python/astunparse/, dev-python/astunparse/files/
commit: 50257231b0acd884ebd7c2dc7cdb1f6e222bf201 Author: Pacho Ramos gentoo org> AuthorDate: Fri May 5 13:32:25 2023 + Commit: Pacho Ramos gentoo org> CommitDate: Fri May 5 13:48:10 2023 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=50257231 dev-python/astunparse: enable py3.11 Closes: https://bugs.gentoo.org/896750 Signed-off-by: Pacho Ramos gentoo.org> dev-python/astunparse/astunparse-1.6.3-r1.ebuild | 6 +++-- .../files/astunparse-1.6.3-test-py311.patch| 26 ++ 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/dev-python/astunparse/astunparse-1.6.3-r1.ebuild b/dev-python/astunparse/astunparse-1.6.3-r1.ebuild index c00b8c24a796..9b2343f7d389 100644 --- a/dev-python/astunparse/astunparse-1.6.3-r1.ebuild +++ b/dev-python/astunparse/astunparse-1.6.3-r1.ebuild @@ -4,7 +4,7 @@ EAPI=8 DISTUTILS_USE_PEP517=setuptools -PYTHON_COMPAT=( python3_{9..10} ) +PYTHON_COMPAT=( python3_{9..11} ) inherit distutils-r1 pypi @@ -25,8 +25,10 @@ RDEPEND=" PATCHES=( "${FILESDIR}/astunparse-1.6.2-tests.patch" - # from Fedora + # From Fedora "${FILESDIR}/${P}-py39.patch" + # From Debian + "${FILESDIR}/${P}-test-py311.patch" ) distutils_enable_tests unittest diff --git a/dev-python/astunparse/files/astunparse-1.6.3-test-py311.patch b/dev-python/astunparse/files/astunparse-1.6.3-test-py311.patch new file mode 100644 index ..f17ff76f0f6f --- /dev/null +++ b/dev-python/astunparse/files/astunparse-1.6.3-test-py311.patch @@ -0,0 +1,26 @@ +From: Carsten Schoenert +Date: Sat, 31 Dec 2022 12:01:26 +0100 +Subject: tests: Skip test_files() on Python >= 3.11 + +Given functions from astunparse are now mostly "battery included" in +Python 3.10 and ongoing und the test itself is only a small part of the +testing I think it's o.k. to simply skip now this test until upstream +will probably do some adjustment. + +Forwarded: https://github.com/simonpercivall/astunparse/issues/67 +--- + tests/common.py | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/tests/common.py b/tests/common.py +index 95b9755..7c8fa27 100644 +--- a/tests/common.py b/tests/common.py +@@ -179,6 +179,7 @@ class AstunparseCommonTestCase: + os.path.join(getattr(sys, 'real_prefix', sys.prefix), + 'lib', 'python%s.%s' % sys.version_info[:2])] + ++@unittest.skipIf(sys.version_info >= (3, 11), "Ignoring if Python >= 3.11") + def test_files(self): + names = [] + for test_dir in self.test_directories:
[gentoo-commits] repo/gentoo:master commit in: dev-python/astunparse/, dev-python/astunparse/files/
commit: e238a834faa392a28291189b9a72b6d325b0685e Author: Michał Górny gentoo org> AuthorDate: Mon Jun 21 09:56:17 2021 + Commit: Michał Górny gentoo org> CommitDate: Mon Jun 21 10:00:22 2021 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e238a834 dev-python/astunparse: Enable py3.9 & py3.10 Signed-off-by: Michał Górny gentoo.org> dev-python/astunparse/astunparse-1.6.3.ebuild | 6 +- .../astunparse/files/astunparse-1.6.3-py39.patch | 74 ++ 2 files changed, 78 insertions(+), 2 deletions(-) diff --git a/dev-python/astunparse/astunparse-1.6.3.ebuild b/dev-python/astunparse/astunparse-1.6.3.ebuild index 4f9d5b0158f..0339e4a52d9 100644 --- a/dev-python/astunparse/astunparse-1.6.3.ebuild +++ b/dev-python/astunparse/astunparse-1.6.3.ebuild @@ -1,9 +1,9 @@ -# Copyright 2020 Gentoo Authors +# Copyright 2020-2021 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI=7 -PYTHON_COMPAT=( python3_{7,8} ) +PYTHON_COMPAT=( python3_{8..10} ) inherit distutils-r1 DESCRIPTION="Astun parser for python" @@ -20,6 +20,8 @@ RDEPEND=" " PATCHES=( "${FILESDIR}/astunparse-1.6.2-tests.patch" + # from Fedora + "${FILESDIR}/${P}-py39.patch" ) distutils_enable_tests setup.py diff --git a/dev-python/astunparse/files/astunparse-1.6.3-py39.patch b/dev-python/astunparse/files/astunparse-1.6.3-py39.patch new file mode 100644 index 000..ab8116a559a --- /dev/null +++ b/dev-python/astunparse/files/astunparse-1.6.3-py39.patch @@ -0,0 +1,74 @@ +From 0388a0d2f42401dcedf7f89d3c291cfed3e4a3d5 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= +Date: Wed, 8 Jul 2020 20:15:57 +0200 +Subject: [PATCH 1/2] Adapt dump() behavior to match ast.dump() on Python 3.9+ + +In Python 3.9+, ast.dump() omits optional fields/attributes from the output if +their value is None. Such defaults are defined as class attributes. + +See https://bugs.python.org/issue36287 +And https://github.com/python/cpython/pull/18843 + +This patch does not change the output on previous Python versions, +because the class attributes are missing there. + +Fixes https://github.com/simonpercivall/astunparse/issues/56 +--- + lib/astunparse/printer.py | 7 ++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/lib/astunparse/printer.py b/lib/astunparse/printer.py +index 92d64f7..7a33deb 100644 +--- a/lib/astunparse/printer.py b/lib/astunparse/printer.py +@@ -4,6 +4,9 @@ + import six + + ++_NOPE = object() ++ ++ + class Printer(ast.NodeVisitor): + + def __init__(self, file=sys.stdout, indent=" "): +@@ -19,6 +22,7 @@ def write(self, text): + self.f.write(six.text_type(text)) + + def generic_visit(self, node): ++cls = type(node) + + if isinstance(node, list): + nodestart = "[" +@@ -27,7 +31,8 @@ def generic_visit(self, node): + else: + nodestart = type(node).__name__ + "(" + nodeend = ")" +-children = [(name + "=", value) for name, value in ast.iter_fields(node)] ++children = [(name + "=", value) for name, value in ast.iter_fields(node) ++if not (value is None and getattr(cls, name, _NOPE) is None)] + + if len(children) > 1: + self.indentation += 1 + +From ea2b578a1b653e73696db2392b8e3d5bf75dadc7 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= +Date: Wed, 8 Jul 2020 20:21:17 +0200 +Subject: [PATCH 2/2] Test and support Python 3.9 + +--- + setup.py | 1 + + tox.ini | 2 +- + 2 files changed, 2 insertions(+), 1 deletion(-) + +diff --git a/setup.py b/setup.py +index e5a277a..29b384b 100755 +--- a/setup.py b/setup.py +@@ -52,6 +52,7 @@ def read_version(): + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', ++'Programming Language :: Python :: 3.9', + 'Topic :: Software Development :: Code Generators', + ], + test_suite='tests',
[gentoo-commits] repo/gentoo:master commit in: dev-python/astunparse/, dev-python/astunparse/files/
commit: 7d989fd8c1cba17b9c913baacca013695eca9c37 Author: Patrick McLean sony com> AuthorDate: Wed May 6 22:23:42 2020 + Commit: Patrick McLean gentoo org> CommitDate: Thu May 7 00:16:23 2020 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7d989fd8 dev-python/astunparse-1.6.2: enable tests, add py38 Copyright: Sony Interactive Entertainment Inc. Package-Manager: Portage-2.3.99, Repoman-2.3.22 Signed-off-by: Patrick McLean gentoo.org> dev-python/astunparse/astunparse-1.6.2.ebuild | 10 +- .../astunparse/files/astunparse-1.6.2-py38.patch | 259 + .../astunparse/files/astunparse-1.6.2-tests.patch | 23 ++ 3 files changed, 291 insertions(+), 1 deletion(-) diff --git a/dev-python/astunparse/astunparse-1.6.2.ebuild b/dev-python/astunparse/astunparse-1.6.2.ebuild index 304fa3dd21c..824af0fdce1 100644 --- a/dev-python/astunparse/astunparse-1.6.2.ebuild +++ b/dev-python/astunparse/astunparse-1.6.2.ebuild @@ -3,7 +3,7 @@ EAPI=7 -PYTHON_COMPAT=( python3_6 python3_7 ) +PYTHON_COMPAT=( python3_{6,7,8} ) inherit distutils-r1 DESCRIPTION="Astun parser for python" @@ -18,6 +18,14 @@ RDEPEND=" >=dev-python/six-1.6.1[${PYTHON_USEDEP}] >=dev-python/wheel-0.23.0[${PYTHON_USEDEP}] " +PATCHES=( + "${FILESDIR}/astunparse-1.6.2-tests.patch" + + # https://github.com/simonpercivall/astunparse/commit/2bd946919076f993cee1173611914372a0a25f00 + "${FILESDIR}/astunparse-1.6.2-py38.patch" +) + +distutils_enable_tests setup.py python_install_all() { distutils-r1_python_install_all diff --git a/dev-python/astunparse/files/astunparse-1.6.2-py38.patch b/dev-python/astunparse/files/astunparse-1.6.2-py38.patch new file mode 100644 index 000..aa27112393c --- /dev/null +++ b/dev-python/astunparse/files/astunparse-1.6.2-py38.patch @@ -0,0 +1,259 @@ +diff --git a/lib/astunparse/unparser.py b/lib/astunparse/unparser.py +index edf8c68..0ef6fd8 100644 +--- a/lib/astunparse/unparser.py b/lib/astunparse/unparser.py +@@ -29,7 +29,7 @@ class Unparser: + output source code for the abstract syntax; original formatting + is disregarded. """ + +-def __init__(self, tree, file=sys.stdout): ++def __init__(self, tree, file = sys.stdout): + """Unparser(tree, file=sys.stdout) -> None. + Print the source for tree to file.""" + self.f = file +@@ -89,6 +89,13 @@ class Unparser: + self.fill() + self.dispatch(tree.value) + ++def _NamedExpr(self, tree): ++self.write("(") ++self.dispatch(tree.target) ++self.write(" := ") ++self.dispatch(tree.value) ++self.write(")") ++ + def _Import(self, t): + self.fill("import ") + interleave(lambda: self.write(", "), self.dispatch, t.names) +@@ -120,11 +127,11 @@ class Unparser: + + def _AnnAssign(self, t): + self.fill() +-if not t.simple: +-self.write("(") ++if not t.simple and isinstance(t.target, ast.Name): ++self.write('(') + self.dispatch(t.target) +-if not t.simple: +-self.write(")") ++if not t.simple and isinstance(t.target, ast.Name): ++self.write(')') + self.write(": ") + self.dispatch(t.annotation) + if t.value: +@@ -189,6 +196,14 @@ class Unparser: + self.fill("nonlocal ") + interleave(lambda: self.write(", "), self.write, t.names) + ++def _Await(self, t): ++self.write("(") ++self.write("await") ++if t.value: ++self.write(" ") ++self.dispatch(t.value) ++self.write(")") ++ + def _Yield(self, t): + self.write("(") + self.write("yield") +@@ -328,12 +343,19 @@ class Unparser: + self.dispatch(t.body) + self.leave() + +-def _generic_FunctionDef(self, t, async_=False): ++def _FunctionDef(self, t): ++self.__FunctionDef_helper(t, "def") ++ ++def _AsyncFunctionDef(self, t): ++self.__FunctionDef_helper(t, "async def") ++ ++def __FunctionDef_helper(self, t, fill_suffix): + self.write("\n") + for deco in t.decorator_list: + self.fill("@") + self.dispatch(deco) +-self.fill(("async " if async_ else "") + "def " + t.name + "(") ++def_str = fill_suffix+" "+t.name + "(" ++self.fill(def_str) + self.dispatch(t.args) + self.write(")") + if getattr(t, "returns", False): +@@ -343,14 +365,14 @@ class Unparser: + self.dispatch(t.body) + self.leave() + +-def _FunctionDef(self, t): +-self._generic_FunctionDef(t) ++def _For(self, t): ++self.__For_helper("for ", t) + +-def _AsyncFunctionDef(self, t): +-self._generic_FunctionDef(t, async_=True) ++def _AsyncFor(self, t): ++self.__For_helper("async for ", t) + +-def _generic_For(self, t, async_=False): +-self.fill