Files
haikuports/dev-python/asttokens/asttokens-2.2.1.recipe
2023-06-09 08:58:22 +02:00

78 lines
1.9 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="1"
SOURCE_URI="https://pypi.io/packages/source/a/$portName/$portName-$portVersion.tar.gz"
CHECKSUM_SHA256="4622110b2a6f30b77e1473affaa97e711bc2f07d3f10848420ff1898edbe94f3"
ARCHITECTURES="any"
PROVIDES="
$portName = $portVersion
"
REQUIRES="
haiku
"
PYTHON_PACKAGES=(python39 python310)
PYTHON_VERSIONS=(3.9 3.10)
for i in "${!PYTHON_PACKAGES[@]}"; do
pythonPackage=${PYTHON_PACKAGES[i]}
pythonVersion=${PYTHON_VERSIONS[i]}
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 i in "${!PYTHON_PACKAGES[@]}"; do
python=python${PYTHON_VERSIONS[$i]}
$python -m build --wheel --skip-dependency-check --no-isolation
$python -m installer -p $prefix dist/*.whl
packageEntries ${PYTHON_PACKAGES[i]} \
$prefix/lib/python*
done
}
TEST()
{
for i in "${!PYTHON_VERSIONS[@]}"; do
python=python${PYTHON_VERSIONS[$i]}
$python -m pytest
done
# Current results:
# Python 3.9: 113 passed, 1 skipped, 2325 warnings
# Python 3.10: 115 passed, 1 skipped, 2273 warnings
}