mirror of
https://github.com/yann64/haikuports.git
synced 2026-04-09 21:30:08 +02:00
x86_64 is used as a baseline: the "x86_64" entry, whatever status it has, is transformed into "all", and then the other entries in ARCHITECTURES either dropped or rearranged appropriately.
156 lines
3.9 KiB
Bash
156 lines
3.9 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="25fe8f6848cbc15187f6748c0695df32bcf1b37df6420b6a01b4ebe1ec1ed48f"
|
|
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=()
|
|
PYTHON_VERSIONS=()
|
|
PYTHON_LIBSUFFIXES=()
|
|
# We don't have python2 for secondaryArch
|
|
if [ -z "$secondaryArchSuffix" ]; then
|
|
PYTHON_PACKAGES+=(python)
|
|
PYTHON_VERSIONS+=(2.7)
|
|
PYTHON_LIBSUFFIXES+=("")
|
|
BUILD_REQUIRES+="
|
|
setuptools_python
|
|
"
|
|
BUILD_PREREQUIRES+="
|
|
cmd:python2
|
|
"
|
|
fi
|
|
# gcc2 does not support the flags passed by python3
|
|
if [ "$effectiveTargetArchitecture" != x86_gcc2 ]; then
|
|
PYTHON_PACKAGES+=(python3 python38 python39)
|
|
PYTHON_VERSIONS+=(3.7 3.8 3.9)
|
|
PYTHON_LIBSUFFIXES+=(m '' '')
|
|
BUILD_REQUIRES+="
|
|
setuptools_python3
|
|
setuptools_python38
|
|
setuptools_python39
|
|
"
|
|
BUILD_PREREQUIRES+="
|
|
cmd:python3
|
|
cmd:python3.8
|
|
cmd:python3.9
|
|
"
|
|
fi
|
|
for i in "${!PYTHON_PACKAGES[@]}"; do
|
|
pythonPackage=${PYTHON_PACKAGES[i]}
|
|
pythonVersion=${PYTHON_VERSIONS[$i]}
|
|
pythonLibSuffix=${PYTHON_LIBSUFFIXES[$i]}
|
|
|
|
eval "PROVIDES_$pythonPackage=\"
|
|
${portName}_$pythonPackage = $portVersion
|
|
\""
|
|
eval "REQUIRES_$pythonPackage=\"
|
|
haiku$secondaryArchSuffix
|
|
chardet_$pythonPackage
|
|
lxml${secondaryArchSuffix}_$pythonPackage
|
|
lib:libpython$pythonVersion$pythonLibSuffix$secondaryArchSuffix
|
|
\""
|
|
|
|
TEST_REQUIRES+="
|
|
${portName}_$pythonPackage
|
|
beautifulsoup_$pythonPackage
|
|
chardet_$pythonPackage
|
|
lxml${secondaryArchSuffix}_$pythonPackage
|
|
"
|
|
done
|
|
if [ "$targetArchitecture" = x86_gcc2 -a -n "$secondaryArchSuffix" ]; then
|
|
PROVIDES_python3+="
|
|
html5_parser_python3 = $portVersion
|
|
"
|
|
PROVIDES_python38+="
|
|
html5_parser_python38 = $portVersion
|
|
"
|
|
PROVIDES_python39+="
|
|
html5_parser_python39 = $portVersion
|
|
"
|
|
fi
|
|
|
|
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
|
|
}
|