chardet-3.0.4.recipe revision 1e021193
1SUMMARY="Universal Character Encoding Detector"
2DESCRIPTION="Python module for character encoding auto-detection."
3HOMEPAGE="https://github.com/chardet/chardet"
4COPYRIGHT="2011-2017 Mark Pilgrim, Dan Blanchard"
5LICENSE="GNU LGPL v2.1"
6REVISION="1"
7SOURCE_URI="https://pypi.io/packages/source/c/chardet/chardet-$portVersion.tar.gz"
8CHECKSUM_SHA256="84ab92ed1c4d4f16916e05906b6b75a6c0fb5db821cc65e70cbd64a3e2a5eaae"
9
10ARCHITECTURES="any"
11
12PROVIDES="
13	$portName = $portVersion
14	"
15REQUIRES="
16	haiku
17	"
18
19BUILD_REQUIRES="
20	haiku_devel
21	"
22
23PYTHON_PACKAGES=(python python36 python3)
24PYTHON_VERSIONS=(2.7 3.6 3.7)
25for i in "${!PYTHON_PACKAGES[@]}"; do
26pythonPackage=${PYTHON_PACKAGES[i]}
27pythonVersion=${PYTHON_VERSIONS[$i]}
28eval "PROVIDES_${pythonPackage}=\"\
29	${portName}_$pythonPackage = $portVersion\
30	\"; \
31REQUIRES_$pythonPackage=\"\
32	haiku\n\
33	cmd:python$pythonVersion\
34	\""
35BUILD_REQUIRES="$BUILD_REQUIRES
36	setuptools_$pythonPackage"
37BUILD_PREREQUIRES="$BUILD_PREREQUIRES
38	cmd:python$pythonVersion"
39done
40
41PROVIDES_python="$PROVIDES_python
42	cmd:chardetect
43	"
44PROVIDES_python3="$PROVIDES_python3
45	cmd:chardetect3
46	"
47PROVIDES_python36="$PROVIDES_python36
48	cmd:chardetect3.6
49	"
50
51INSTALL()
52{
53	for i in "${!PYTHON_PACKAGES[@]}"; do
54		pythonPackage=${PYTHON_PACKAGES[i]}
55		pythonVersion=${PYTHON_VERSIONS[$i]}
56
57		python=python$pythonVersion
58		installLocation=$prefix/lib/$python/vendor-packages/
59		export PYTHONPATH=$installLocation:$PYTHONPATH
60		mkdir -p $installLocation
61		rm -rf build
62		$python setup.py build install \
63			--root=/ --prefix=$prefix
64
65		if [ $pythonPackage = python3 ]; then
66			for f in $binDir/*; do
67				mv $f ${f}3
68			done
69		fi
70
71		if [ $pythonPackage = python36 ]; then
72			for f in $binDir/*; do
73				mv $f ${f}3.6
74			done
75		fi
76
77		packageEntries  $pythonPackage \
78			$prefix/lib/python* \
79			$binDir
80	done
81}
82