mirror of
https://github.com/yann64/haikuports.git
synced 2026-04-09 05:10:05 +02:00
html5-parser: new recipe (#3271)
This commit is contained in:
145
dev-python/html5-parser/html5_parser-0.4.5.recipe
Normal file
145
dev-python/html5-parser/html5_parser-0.4.5.recipe
Normal file
@@ -0,0 +1,145 @@
|
||||
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="a903ef8b93b51788a6d1604b3833303e9f2f8db488306ee4241436d2f518bd06"
|
||||
SOURCE_DIR="html5-parser-$portVersion"
|
||||
|
||||
ARCHITECTURES="!x86_gcc2 x86 x86_64"
|
||||
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)
|
||||
PYTHON_VERSIONS+=(3.6)
|
||||
PYTHON_LIBSUFFIXES+=(m)
|
||||
BUILD_REQUIRES+="
|
||||
setuptools_python3
|
||||
"
|
||||
BUILD_PREREQUIRES+="
|
||||
cmd:python3
|
||||
"
|
||||
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
|
||||
"
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user