1SUMMARY="A Python lib for parsing .editorconfig"
2DESCRIPTION="EditorConfig makes it easy to maintain the correct  \
3coding style when switching between different text editors and \
4between different projects. The EditorConfig project maintains \
5a file format and plugins for various text editors which allow this \
6file format to be read and used by those editors. For information \
7on the file format and supported text editors, see the EditorConfig \
8website."
9HOMEPAGE="https://editorconfig.org/"
10COPYRIGHT="2011-2018 EditorConfig Team"
11LICENSE="BSD (2-clause)"
12REVISION="1"
13pyName="EditorConfig"
14SOURCE_URI="https://pypi.io/packages/source/${pyName:0:1}/$pyName/$pyName-$portVersion.tar.gz"
15CHECKSUM_SHA256="57f8ce78afcba15c8b18d46b5170848c88d56fd38f05c2ec60dbbfcb8996e89e"
16SOURCE_DIR="$pyName-$portVersion"
17
18ARCHITECTURES="any"
19
20PROVIDES="
21	$portName = $portVersion
22	"
23REQUIRES="
24	haiku
25	"
26
27BUILD_REQUIRES="
28	haiku_devel
29	"
30
31PYTHON_PACKAGES=(python39 python310)
32PYTHON_VERSIONS=(3.9 3.10)
33defaultVersion=3.10
34for i in "${!PYTHON_PACKAGES[@]}"; do
35	pythonPackage=${PYTHON_PACKAGES[i]}
36	pythonVersion=${PYTHON_VERSIONS[$i]}
37
38	eval "PROVIDES_${pythonPackage}=\"
39		${portName}_$pythonPackage = $portVersion
40		cmd:editorconfig_$pythonVersion
41		\""
42
43	if [ $pythonVersion = $defaultVersion ]; then
44		eval "PROVIDES_${pythonPackage}+=\"
45			cmd:editorconfig
46			\""
47	fi
48
49	eval "REQUIRES_$pythonPackage=\"
50		haiku
51		cmd:python$pythonVersion
52		\""
53
54	BUILD_REQUIRES+="
55		setuptools_$pythonPackage
56		"
57	BUILD_PREREQUIRES+="
58		cmd:cmake
59		cmd:python$pythonVersion
60		"
61done
62
63INSTALL()
64{
65	for i in "${!PYTHON_PACKAGES[@]}"; do
66		pythonPackage=${PYTHON_PACKAGES[i]}
67		pythonVersion=${PYTHON_VERSIONS[$i]}
68
69		python=python$pythonVersion
70		installLocation=$prefix/lib/$python/vendor-packages/
71		export PYTHONPATH=$installLocation:$PYTHONPATH
72
73		mkdir -p $installLocation
74		rm -rf build
75
76		$python setup.py build install \
77			--root=/ --prefix=$prefix
78
79		# Version suffix all the scripts
80		for f in $binDir/*; do
81			mv $f $f-$pythonVersion
82		done
83
84		# And provide suffix-less symlinks for the default version
85		if [ $pythonVersion = $defaultVersion ]; then
86			for f in $binDir/*; do
87				ln -sr $f ${f%-$pythonVersion}
88			done
89		fi
90
91		packageEntries $pythonPackage \
92			$prefix/lib/python* \
93			$binDir
94	done
95}
96