1SUMMARY="Convert HTML to Markdown-formatted text"
2DESCRIPTION="
3	html2text is a Python script that converts a page of HTML into clean,
4	easy-to-read plain ASCII text. Better yet, that ASCII also happens to be
5	valid Markdown (a text-to-HTML format)."
6HOMEPAGE="https://github.com/html2text/html2text.py
7	https://github.com/Alir3z4/html2text
8	https://pypi.python.org/pypi/html2text"
9COPYRIGHT="2004-2008 Aaron Swartz"
10LICENSE="GNU GPL v3"
11REVISION="4"
12SOURCE_URI="https://github.com/Alir3z4/html2text/archive/$portVersion.tar.gz"
13CHECKSUM_SHA256="209a2c4d7897e83a6999160ef51ae71bdb8c3eede99e103f12edb25199d4d11e"
14
15ARCHITECTURES="any"
16
17PROVIDES="
18	$portName = $portVersion
19	"
20REQUIRES="
21	haiku
22	"
23
24BUILD_REQUIRES="
25	haiku_devel
26	"
27
28PYTHON_PACKAGES=(python39 python310)
29PYTHON_VERSIONS=(3.9 3.10)
30commandSuffixes=(3.8 "" 3.10)
31for i in "${!PYTHON_PACKAGES[@]}"; do
32pythonPackage=${PYTHON_PACKAGES[i]}
33pythonVersion=${PYTHON_VERSIONS[$i]}
34commandSuffix=${commandSuffixes[$i]}
35eval "PROVIDES_${pythonPackage}=\"\
36	${portName}_$pythonPackage = $portVersion\n\
37	cmd:html2text$commandSuffix = $portVersion\n\
38	\"; \
39REQUIRES_$pythonPackage=\"\
40	haiku\n\
41	cmd:python$pythonVersion\
42	\""
43BUILD_REQUIRES="$BUILD_REQUIRES
44	setuptools_$pythonPackage"
45BUILD_PREREQUIRES="$BUILD_PREREQUIRES
46	cmd:python$pythonVersion"
47done
48
49
50INSTALL()
51{
52	for i in "${!PYTHON_PACKAGES[@]}"; do
53		pythonPackage=${PYTHON_PACKAGES[i]}
54		pythonVersion=${PYTHON_VERSIONS[$i]}
55		commandSuffix=${commandSuffixes[$i]}
56
57		python=python$pythonVersion
58		installLocation=$prefix/lib/$python/vendor-packages/
59		export PYTHONPATH=$installLocation:$PYTHONPATH
60
61		mkdir -p $installLocation
62		rm -rf build
63
64		$python setup.py build install \
65			--root=/ --prefix=$prefix
66
67		if [ "$pythonVersion" = "$commandSuffix" ]; then
68			for f in $binDir/*; do
69				mv $f ${f}$commandSuffix
70			done
71		fi
72
73		packageEntries  $pythonPackage \
74			$prefix/lib/python* \
75			$binDir
76	done
77}
78