1SUMMARY="Annotate Python AST trees with source text and token information"
2DESCRIPTION="The asttokens module annotates Python abstract syntax trees (ASTs) with the \
3positions of tokens and text in the source code that generated them.
4
5It makes it possible for tools that work with logical AST nodes to find the particular text \
6that resulted in those nodes, for example for automated refactoring or highlighting."
7HOMEPAGE="https://github.com/gristlabs/asttokens"
8COPYRIGHT="2016 Grist Labs"
9LICENSE="Apache v2"
10REVISION="1"
11SOURCE_URI="https://pypi.io/packages/source/a/$portName/$portName-$portVersion.tar.gz"
12CHECKSUM_SHA256="4622110b2a6f30b77e1473affaa97e711bc2f07d3f10848420ff1898edbe94f3"
13
14ARCHITECTURES="any"
15
16PROVIDES="
17	$portName = $portVersion
18	"
19REQUIRES="
20	haiku
21	"
22
23PYTHON_PACKAGES=(python39 python310)
24PYTHON_VERSIONS=(3.9 3.10)
25for i in "${!PYTHON_PACKAGES[@]}"; do
26	pythonPackage=${PYTHON_PACKAGES[i]}
27	pythonVersion=${PYTHON_VERSIONS[i]}
28
29	eval "PROVIDES_$pythonPackage=\"
30		${portName}_$pythonPackage = $portVersion
31		\""
32	eval "REQUIRES_$pythonPackage=\"
33		six_$pythonPackage
34		cmd:python$pythonVersion
35		\""
36	BUILD_REQUIRES+="
37		build_$pythonPackage
38		installer_$pythonPackage
39		setuptools_$pythonPackage
40		wheel_$pythonPackage
41		"
42	BUILD_PREREQUIRES+="
43		cmd:python$pythonVersion
44		"
45	TEST_REQUIRES+="
46		astroid_$pythonPackage
47		asttokens_$pythonPackage
48		pytest_$pythonPackage
49		"
50done
51
52
53INSTALL()
54{
55	for i in "${!PYTHON_PACKAGES[@]}"; do
56		python=python${PYTHON_VERSIONS[$i]}
57
58		$python -m build --wheel --skip-dependency-check --no-isolation
59		$python -m installer -p $prefix dist/*.whl
60
61		packageEntries ${PYTHON_PACKAGES[i]} \
62			$prefix/lib/python*
63	done
64}
65
66
67TEST()
68{
69	for i in "${!PYTHON_VERSIONS[@]}"; do
70		python=python${PYTHON_VERSIONS[$i]}
71		$python -m pytest
72	done
73
74	# Current results:
75	# Python 3.9: 113 passed, 1 skipped, 2325 warnings
76	# Python 3.10: 115 passed, 1 skipped, 2273 warnings
77}
78