summaryrefslogtreecommitdiff
blob: c82239603325c45986565b6f2a14c9478f10e63a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=7

PYTHON_COMPAT=( python3_{8..10} )
inherit distutils-r1

EGIT_COMMIT="b4db17e4d43f27a040b4bf087695cc200512e4ea"
MY_P=py-tree-sitter-${EGIT_COMMIT}

# TODO: unbundle
TS_PV=0.19.5
FIXTURE_PV=0.19.0

DESCRIPTION="Python bindings to the Tree-sitter parsing library"
HOMEPAGE="https://github.com/tree-sitter/py-tree-sitter/"
SRC_URI="
	https://github.com/tree-sitter/py-tree-sitter/archive/${EGIT_COMMIT}.tar.gz
		-> ${MY_P}.tar.gz
	https://github.com/tree-sitter/tree-sitter/archive/v${TS_PV}.tar.gz
		-> tree-sitter-${TS_PV}.gh.tar.gz
	test? (
		https://github.com/tree-sitter/tree-sitter-javascript/archive/v${FIXTURE_PV}.tar.gz
			-> tree-sitter-javascript-${FIXTURE_PV}.tar.gz
		https://github.com/tree-sitter/tree-sitter-python/archive/v${FIXTURE_PV}.tar.gz
			-> tree-sitter-python-${FIXTURE_PV}.tar.gz
	)"
S=${WORKDIR}/${MY_P}

LICENSE="MIT"
SLOT="0"
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~x64-macos"
IUSE="test"
RESTRICT="!test? ( test )"

distutils_enable_tests setup.py

src_unpack() {
	default
	rmdir "${S}/tree_sitter/core" || die
	mv "tree-sitter-${TS_PV}" "${S}/tree_sitter/core" || die

	if use test; then
		mkdir "${S}/tests/fixtures" || die
		local f
		for f in tree-sitter-{javascript,python}; do
			mv "${f}-${FIXTURE_PV}" "${S}/tests/fixtures/${f}" || die
		done
	fi
}