html5_parser-0.4.9.recipe revision b793bd7a
1SUMMARY="Fast C based HTML 5 parsing for python" 2DESCRIPTION="A fast implementation of the HTML 5 parsing spec for Python. \ 3Parsing is done in C using a variant of the gumbo parser. The gumbo parse \ 4tree is then transformed into an lxml tree, also in C, yielding parse times \ 5that can be a thirtieth of the html5lib parse times. That is a speedup of \ 630x. This differs, for instance, from the gumbo python bindings, where the \ 7initial parsing is done in C but the transformation into the final tree \ 8is done in python." 9HOMEPAGE="https://html5-parser.readthedocs.io/ 10 https://pypi.python.org/pypi/html5-parser/" 11COPYRIGHT="2017 Kovid Goyal 12 2010, 2011 Google Inc. 13 2015-2016 Kevin B. Hendricks, Stratford Ontario 14 2008-2009 Bjoern Hoehrmann" 15LICENSE="Apache v2" 16REVISION="1" 17SOURCE_URI="https://files.pythonhosted.org/packages/source/h/html5-parser/html5-parser-$portVersion.tar.gz" 18CHECKSUM_SHA256="25fe8f6848cbc15187f6748c0695df32bcf1b37df6420b6a01b4ebe1ec1ed48f" 19SOURCE_DIR="html5-parser-$portVersion" 20 21ARCHITECTURES="!x86_gcc2 x86 x86_64" 22SECONDARY_ARCHITECTURES="x86" 23 24PROVIDES=" 25 html5_parser$secondaryArchSuffix = $portVersion 26 " 27REQUIRES=" 28 haiku$secondaryArchSuffix 29 " 30 31BUILD_REQUIRES=" 32 haiku${secondaryArchSuffix}_devel 33 devel:libxml2$secondaryArchSuffix 34 " 35BUILD_PREREQUIRES=" 36 cmd:gcc$secondaryArchSuffix 37 cmd:pkg_config$secondaryArchSuffix 38 " 39 40PYTHON_PACKAGES=() 41PYTHON_VERSIONS=() 42PYTHON_LIBSUFFIXES=() 43# We don't have python2 for secondaryArch 44if [ -z "$secondaryArchSuffix" ]; then 45 PYTHON_PACKAGES+=(python) 46 PYTHON_VERSIONS+=(2.7) 47 PYTHON_LIBSUFFIXES+=("") 48 BUILD_REQUIRES+=" 49 setuptools_python 50 " 51 BUILD_PREREQUIRES+=" 52 cmd:python2 53 " 54fi 55# gcc2 does not support the flags passed by python3 56if [ "$effectiveTargetArchitecture" != x86_gcc2 ]; then 57 PYTHON_PACKAGES+=(python3) 58 PYTHON_VERSIONS+=(3.7) 59 PYTHON_LIBSUFFIXES+=(m) 60 BUILD_REQUIRES+=" 61 setuptools_python3 62 " 63 BUILD_PREREQUIRES+=" 64 cmd:python3 65 " 66fi 67for i in "${!PYTHON_PACKAGES[@]}"; do 68 pythonPackage=${PYTHON_PACKAGES[i]} 69 pythonVersion=${PYTHON_VERSIONS[$i]} 70 pythonLibSuffix=${PYTHON_LIBSUFFIXES[$i]} 71 72 eval "PROVIDES_$pythonPackage=\" 73 ${portName}_$pythonPackage = $portVersion 74 \"" 75 eval "REQUIRES_$pythonPackage=\" 76 haiku$secondaryArchSuffix 77 chardet_$pythonPackage 78 lxml${secondaryArchSuffix}_$pythonPackage 79 lib:libpython$pythonVersion$pythonLibSuffix$secondaryArchSuffix 80 \"" 81 82 TEST_REQUIRES+=" 83 ${portName}_$pythonPackage 84 beautifulsoup_$pythonPackage 85 chardet_$pythonPackage 86 lxml${secondaryArchSuffix}_$pythonPackage 87 " 88done 89if [ "$targetArchitecture" = x86_gcc2 -a -n "$secondaryArchSuffix" ]; then 90 PROVIDES_python3+=" 91 html5_parser_python3 = $portVersion 92 " 93fi 94 95BUILD() 96{ 97 for i in "${!PYTHON_PACKAGES[@]}"; do 98 pythonPackage=${PYTHON_PACKAGES[i]} 99 pythonVersion=${PYTHON_VERSIONS[$i]} 100 101 rm -rf "$sourceDir"-$pythonPackage 102 cp -a "$sourceDir" "$sourceDir"-$pythonPackage 103 cd "$sourceDir"-$pythonPackage 104 105 python=python$pythonVersion 106 $python setup.py build 107 done 108} 109 110INSTALL() 111{ 112 for i in "${!PYTHON_PACKAGES[@]}"; do 113 pythonPackage=${PYTHON_PACKAGES[i]} 114 pythonVersion=${PYTHON_VERSIONS[$i]} 115 116 cd "$sourceDir"-$pythonPackage 117 118 python=python$pythonVersion 119 installLocation=$prefix/lib/$python/vendor-packages 120 export PYTHONPATH=$installLocation 121 mkdir -p "$installLocation" 122 $python setup.py install \ 123 --root=/ --prefix="$prefix" 124 125 packageEntries $pythonPackage \ 126 "$prefix"/lib/$python 127 done 128 129 cd "$sourceDir" 130 install -m 755 -d "$docDir" 131 install -m 644 -t "$docDir" README.rst 132} 133 134TEST() 135{ 136 for i in "${!PYTHON_PACKAGES[@]}"; do 137 pythonPackage=${PYTHON_PACKAGES[i]} 138 pythonVersion=${PYTHON_VERSIONS[$i]} 139 140 cd "$sourceDir"-$pythonPackage 141 142 python=python$pythonVersion 143 $python run_tests.py 144 done 145} 146