Files
haikuports/dev-python/html5-parser/html5_parser-0.4.10.recipe

131 lines
3.2 KiB
Bash

SUMMARY="Fast C based HTML 5 parsing for python"
DESCRIPTION="A fast implementation of the HTML 5 parsing spec for Python. \
Parsing is done in C using a variant of the gumbo parser. The gumbo parse \
tree is then transformed into an lxml tree, also in C, yielding parse times \
that can be a thirtieth of the html5lib parse times. That is a speedup of \
30x. This differs, for instance, from the gumbo python bindings, where the \
initial parsing is done in C but the transformation into the final tree \
is done in python."
HOMEPAGE="https://html5-parser.readthedocs.io/
https://pypi.python.org/pypi/html5-parser/"
COPYRIGHT="2017 Kovid Goyal
2010, 2011 Google Inc.
2015-2016 Kevin B. Hendricks, Stratford Ontario
2008-2009 Bjoern Hoehrmann"
LICENSE="Apache v2"
REVISION="1"
SOURCE_URI="https://files.pythonhosted.org/packages/source/h/html5-parser/html5-parser-$portVersion.tar.gz"
CHECKSUM_SHA256="f9294418c0da95c2d5facc19d3dc32941093a6b8e3b3e4b36cc7b5a1697fbca4"
SOURCE_DIR="html5-parser-$portVersion"
ARCHITECTURES="all !x86_gcc2"
SECONDARY_ARCHITECTURES="x86"
PROVIDES="
html5_parser$secondaryArchSuffix = $portVersion
"
REQUIRES="
haiku$secondaryArchSuffix
"
BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel
devel:libxml2$secondaryArchSuffix
"
BUILD_PREREQUIRES="
cmd:gcc$secondaryArchSuffix
cmd:pkg_config$secondaryArchSuffix
"
PYTHON_PACKAGES=(python38 python39 python310)
PYTHON_VERSIONS=(3.8 3.9 3.10)
for i in "${!PYTHON_PACKAGES[@]}"; do
pythonPackage=${PYTHON_PACKAGES[i]}
pythonVersion=${PYTHON_VERSIONS[$i]}
eval "PROVIDES_$pythonPackage=\"
${portName}_$pythonPackage = $portVersion
\""
if [ "$targetArchitecture" = "x86_gcc2" ]; then
eval "PROVIDES_$pythonPackage+=\"
html5_parser_$pythonPackage = $portVersion
\""
fi
eval "REQUIRES_$pythonPackage=\"
haiku$secondaryArchSuffix
chardet_$pythonPackage
lxml${secondaryArchSuffix}_$pythonPackage
lib:libpython$pythonVersion$secondaryArchSuffix
\""
BUILD_REQUIRES+="
setuptools_$pythonPackage
"
BUILD_PREREQUIRES+="
cmd:python$pythonVersion
"
TEST_REQUIRES+="
${portName}_$pythonPackage
beautifulsoup_$pythonPackage
chardet_$pythonPackage
lxml${secondaryArchSuffix}_$pythonPackage
"
done
BUILD()
{
for i in "${!PYTHON_PACKAGES[@]}"; do
pythonPackage=${PYTHON_PACKAGES[i]}
pythonVersion=${PYTHON_VERSIONS[$i]}
rm -rf "$sourceDir"-$pythonPackage
cp -a "$sourceDir" "$sourceDir"-$pythonPackage
cd "$sourceDir"-$pythonPackage
python=python$pythonVersion
$python setup.py build
done
}
INSTALL()
{
for i in "${!PYTHON_PACKAGES[@]}"; do
pythonPackage=${PYTHON_PACKAGES[i]}
pythonVersion=${PYTHON_VERSIONS[$i]}
cd "$sourceDir"-$pythonPackage
python=python$pythonVersion
installLocation=$prefix/lib/$python/vendor-packages
export PYTHONPATH=$installLocation
mkdir -p "$installLocation"
$python setup.py install \
--root=/ --prefix="$prefix"
packageEntries $pythonPackage \
"$prefix"/lib/$python
done
cd "$sourceDir"
install -m 755 -d "$docDir"
install -m 644 -t "$docDir" README.rst
}
TEST()
{
for i in "${!PYTHON_PACKAGES[@]}"; do
pythonPackage=${PYTHON_PACKAGES[i]}
pythonVersion=${PYTHON_VERSIONS[$i]}
cd "$sourceDir"-$pythonPackage
python=python$pythonVersion
$python run_tests.py
done
}