summaryrefslogtreecommitdiff
path: root/dev-python/pure-eval
diff options
context:
space:
mode:
Diffstat (limited to 'dev-python/pure-eval')
-rw-r--r--dev-python/pure-eval/Manifest2
-rw-r--r--dev-python/pure-eval/files/pure-eval-0.2.2-py313.patch63
-rw-r--r--dev-python/pure-eval/pure-eval-0.2.2-r1.ebuild43
3 files changed, 108 insertions, 0 deletions
diff --git a/dev-python/pure-eval/Manifest b/dev-python/pure-eval/Manifest
index 45e37f19c156..344ca0814cb5 100644
--- a/dev-python/pure-eval/Manifest
+++ b/dev-python/pure-eval/Manifest
@@ -1,3 +1,5 @@
+AUX pure-eval-0.2.2-py313.patch 2161 BLAKE2B 83f6baedd54f1710a70154e78740328b1635dd2e27680e59dcf7387ce073b9d240431ab4fd837be37df5bc942785e095d21b0ecc8edb4a13812f232eae568a15 SHA512 8fc71c9dd4a9a2eeee347f3aaffb112e98bb87eff3d214cff1e6337889400ec4ac43307ccdda562ea4cdf34280cbdf5b37e33b55939d38100aff5c66f6d2b7fc
DIST pure_eval-0.2.2.tar.gz 19395 BLAKE2B 19f86a1436e5f1a026a24f62c435e8970d84960f4cde1de80c58949b1aede6aa7562e8430e10e3f7171212c31d5699a3321fad5fb2ea1eed961a30d43a632a79 SHA512 35d20cbbfd513b7ac341759e619401a5f57b7b9df8abd09ce6414d4ee6bfa45dcadbad7529d067e81ad7ea2107c14fd03783a3a77f8074dad30d2e5161656804
+EBUILD pure-eval-0.2.2-r1.ebuild 1033 BLAKE2B e696e0c2ca27c480b6054e2e88163a278ba6f403545549c84573e1211ec5d0524e26f4d84a97de7e749e72c1879411d365d51f81c821d6b63c92d9dffede3817 SHA512 c58adf561b3f13f9e6b8dc6bb86cc6f5f64276732e49fedc8b244b808762c2d136c013b4274ec8b95e82a7de974c1c50779bfe65eb222a7c092ad26aca5957f6
EBUILD pure-eval-0.2.2.ebuild 838 BLAKE2B b3da897aa80832cac8014b79b6a120aa2f5c6500f33c061ce0271471c6f5980495ffeaec3164a0bf9ab778735d8548c3b8174a2e15cda900a99f65fd0cfb45c5 SHA512 b3a60cf8a0fdcf551bc1b2731d38196724281f9aa4debd1a86bd19fc9bf3ecb9e7cd45c15ff03f864a42475845bdb3a6ce0f2d31b30c33520aef3f7b234ff136
MISC metadata.xml 373 BLAKE2B 56f08bfb33fbfefff3f37063133e1a5dab14daf3d30b0674e9b39d8ed72e5d1468f02ed3d353d508a28c4af1c5c7f858043246e043a9ce0da4937aa2b07d4993 SHA512 69be5163434e36fed944075b834e8fba4745698759e12258cdb9ed968e523528e1e11d291892f3a8992390edd9c54cc08b5fbb70d7473db5e274329cfceea101
diff --git a/dev-python/pure-eval/files/pure-eval-0.2.2-py313.patch b/dev-python/pure-eval/files/pure-eval-0.2.2-py313.patch
new file mode 100644
index 000000000000..9ec2d680b616
--- /dev/null
+++ b/dev-python/pure-eval/files/pure-eval-0.2.2-py313.patch
@@ -0,0 +1,63 @@
+From 42e8a1f4a41b60c51619868f543e7b3ee82ac42f Mon Sep 17 00:00:00 2001
+From: Lumir Balhar <lbalhar@redhat.com>
+Date: Wed, 15 May 2024 10:14:31 +0200
+Subject: [PATCH] Fix compatibility of check_copy_ast_without_context with Py
+ 3.13b1
+
+Resolves: https://github.com/alexmojaki/pure_eval/issues/16
+---
+ tests/test_utils.py | 11 ++++++++++-
+ 1 file changed, 10 insertions(+), 1 deletion(-)
+
+diff --git a/tests/test_utils.py b/tests/test_utils.py
+index 172f50e..3a9cc9b 100644
+--- a/tests/test_utils.py
++++ b/tests/test_utils.py
+@@ -58,7 +58,16 @@ def check_copy_ast_without_context(tree):
+ dump1 = ast.dump(tree)
+ dump2 = ast.dump(tree2)
+ normalised_dump1 = re.sub(
+- r", ctx=(Load|Store|Del)\(\)",
++ # Two possible matches:
++ # - first one like ", ctx=…" where ", " should be removed
++ # - second one like "(ctx=…" where "(" should be kept
++ (
++ r"("
++ r", ctx=(Load|Store|Del)\(\)"
++ r"|"
++ r"(?<=\()ctx=(Load|Store|Del)\(\)"
++ r")"
++ ),
+ "",
+ dump1
+ )
+From 89645cfd19d1480d586af50842f0ac264a036fa8 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <miro@hroncok.cz>
+Date: Sun, 9 Jun 2024 21:45:31 +0200
+Subject: [PATCH] Explicitly remove the ctx attribute in
+ copy_ast_without_context
+
+Python 3.13.0b2+ defaults to Load when we don't pass ctx
+See https://github.com/python/cpython/pull/118871
+---
+ pure_eval/utils.py | 7 ++++++-
+ 1 file changed, 6 insertions(+), 1 deletion(-)
+
+diff --git a/pure_eval/utils.py b/pure_eval/utils.py
+index a8a3730..19ead65 100644
+--- a/pure_eval/utils.py
++++ b/pure_eval/utils.py
+@@ -184,7 +184,12 @@ def copy_ast_without_context(x):
+ if field != 'ctx'
+ if hasattr(x, field)
+ }
+- return type(x)(**kwargs)
++ a = type(x)(**kwargs)
++ if hasattr(a, 'ctx'):
++ # Python 3.13.0b2+ defaults to Load when we don't pass ctx
++ # https://github.com/python/cpython/pull/118871
++ del a.ctx
++ return a
+ elif isinstance(x, list):
+ return list(map(copy_ast_without_context, x))
+ else:
diff --git a/dev-python/pure-eval/pure-eval-0.2.2-r1.ebuild b/dev-python/pure-eval/pure-eval-0.2.2-r1.ebuild
new file mode 100644
index 000000000000..3268f08fd3f0
--- /dev/null
+++ b/dev-python/pure-eval/pure-eval-0.2.2-r1.ebuild
@@ -0,0 +1,43 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+DISTUTILS_USE_PEP517=setuptools
+PYTHON_COMPAT=( pypy3 python3_{10..13} )
+
+inherit distutils-r1 pypi
+
+DESCRIPTION="Safely evaluate AST nodes without side effects"
+HOMEPAGE="
+ https://github.com/alexmojaki/pure_eval/
+ https://pypi.org/project/pure-eval/
+"
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~arm64-macos ~x64-macos"
+
+distutils_enable_tests pytest
+
+PATCHES=(
+ # https://github.com/alexmojaki/pure_eval/commit/42e8a1f4a41b60c51619868f543e7b3ee82ac42f
+ # https://github.com/alexmojaki/pure_eval/pull/18
+ "${FILESDIR}/${P}-py313.patch"
+)
+
+python_test() {
+ local EPYTEST_DESELECT=()
+
+ case ${EPYTHON} in
+ pypy3)
+ EPYTEST_DESELECT+=(
+ # https://github.com/alexmojaki/pure_eval/issues/15
+ tests/test_getattr_static.py::TestGetattrStatic::test_custom_object_dict
+ tests/test_utils.py::test_safe_name_samples
+ )
+ ;;
+ esac
+
+ epytest
+}