Files
haikuports/dev-python/asttokens/asttokens-2.2.1.recipe
2025-08-04 13:20:08 +00:00

79 lines
1.8 KiB
Bash

SUMMARY="Annotate Python AST trees with source text and token information"
DESCRIPTION="The asttokens module annotates Python abstract syntax trees (ASTs) with the \
positions of tokens and text in the source code that generated them.
It makes it possible for tools that work with logical AST nodes to find the particular text \
that resulted in those nodes, for example for automated refactoring or highlighting."
HOMEPAGE="https://github.com/gristlabs/asttokens"
COPYRIGHT="2016 Grist Labs"
LICENSE="Apache v2"
REVISION="2"
SOURCE_URI="https://pypi.io/packages/source/a/$portName/$portName-$portVersion.tar.gz"
CHECKSUM_SHA256="4622110b2a6f30b77e1473affaa97e711bc2f07d3f10848420ff1898edbe94f3"
ARCHITECTURES="any"
PROVIDES="
$portName = $portVersion
"
REQUIRES="
haiku
"
PYTHON_VERSIONS=(3.10)
for pythonVersion in ${PYTHON_VERSIONS[@]}; do
pythonPackage=python${pythonVersion//.}
eval "PROVIDES_$pythonPackage=\"
${portName}_$pythonPackage = $portVersion
\""
eval "REQUIRES_$pythonPackage=\"
six_$pythonPackage
cmd:python$pythonVersion
\""
BUILD_REQUIRES+="
build_$pythonPackage
installer_$pythonPackage
setuptools_$pythonPackage
wheel_$pythonPackage
"
BUILD_PREREQUIRES+="
cmd:python$pythonVersion
"
TEST_REQUIRES+="
astroid_$pythonPackage
asttokens_$pythonPackage
pytest_$pythonPackage
"
done
INSTALL()
{
for pythonVersion in ${PYTHON_VERSIONS[@]}; do
pythonPackage=python${pythonVersion//.}
python=python$pythonVersion
$python -m build --wheel --skip-dependency-check --no-isolation
$python -m installer -p $prefix dist/*.whl
packageEntries $pythonPackage \
$prefix/lib/python*
done
}
TEST()
{
for i in "${!PYTHON_VERSIONS[@]}"; do
python=python$pythonVersion
$python -m pytest
done
# Current results:
# Python 3.9: 113 passed, 1 skipped, 2325 warnings
# Python 3.10: 115 passed, 1 skipped, 2273 warnings
}