mirror of
https://github.com/yann64/haikuports.git
synced 2026-04-09 13:20:08 +02:00
Only use in-tree of this is from calibre, and that's 3.10 only. Use beautifulsoup4 for tests instead of the older "beautifulsoup" that isn't there anymore.
135 lines
3.2 KiB
Bash
135 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="3"
|
|
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_VERSIONS=(3.10)
|
|
|
|
for i in "${!PYTHON_VERSIONS[@]}"; do
|
|
pythonVersion=${PYTHON_VERSIONS[$i]}
|
|
pythonPackage=python${pythonVersion//.}
|
|
|
|
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
|
|
beautifulsoup4_$pythonPackage
|
|
chardet_$pythonPackage
|
|
lxml${secondaryArchSuffix}_$pythonPackage
|
|
"
|
|
done
|
|
|
|
|
|
BUILD()
|
|
{
|
|
for i in "${!PYTHON_VERSIONS[@]}"; do
|
|
pythonVersion=${PYTHON_VERSIONS[$i]}
|
|
pythonPackage=python${pythonVersion//.}
|
|
|
|
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_VERSIONS[@]}"; do
|
|
pythonVersion=${PYTHON_VERSIONS[$i]}
|
|
pythonPackage=python${pythonVersion//.}
|
|
|
|
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
|
|
}
|
|
|
|
|
|
|
|
# Reference results:
|
|
# Ran 28 tests in 1.363s
|
|
# OK (skipped=1)
|
|
TEST()
|
|
{
|
|
for i in "${!PYTHON_VERSIONS[@]}"; do
|
|
pythonVersion=${PYTHON_VERSIONS[$i]}
|
|
pythonPackage=python${pythonVersion//.}
|
|
|
|
cd "$sourceDir"-$pythonPackage
|
|
|
|
python=python$pythonVersion
|
|
$python run_tests.py
|
|
done
|
|
}
|