summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2021-06-04 15:02:35 +0200
committerMichał Górny <mgorny@gentoo.org>2021-06-04 15:04:32 +0200
commit85c9426652e2495dbb3c6381d994f003aabad059 (patch)
tree3ba56e32f7e04b33cd4abff6f165c96d08449a70 /dev-python/tree-sitter
parentwww-client/firefox: amd64 & x86 stable (diff)
downloadgentoo-85c9426652e2495dbb3c6381d994f003aabad059.tar.gz
gentoo-85c9426652e2495dbb3c6381d994f003aabad059.tar.bz2
gentoo-85c9426652e2495dbb3c6381d994f003aabad059.zip
dev-python/tree-sitter: Unbundle dev-libs/tree-sitter
Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'dev-python/tree-sitter')
-rw-r--r--dev-python/tree-sitter/files/tree-sitter-0.19.0_p20210506-unbundle.patch18
-rw-r--r--dev-python/tree-sitter/tree-sitter-0.19.0_p20210506-r1.ebuild50
2 files changed, 68 insertions, 0 deletions
diff --git a/dev-python/tree-sitter/files/tree-sitter-0.19.0_p20210506-unbundle.patch b/dev-python/tree-sitter/files/tree-sitter-0.19.0_p20210506-unbundle.patch
new file mode 100644
index 000000000000..3eb9d103a0e0
--- /dev/null
+++ b/dev-python/tree-sitter/files/tree-sitter-0.19.0_p20210506-unbundle.patch
@@ -0,0 +1,18 @@
+diff --git a/setup.py b/setup.py
+index 2528827..bb2a817 100644
+--- a/setup.py
++++ b/setup.py
+@@ -33,11 +33,11 @@ setup(
+ ext_modules=[
+ Extension(
+ "tree_sitter.binding",
+- ["tree_sitter/core/lib/src/lib.c", "tree_sitter/binding.c"],
+- include_dirs=["tree_sitter/core/lib/include", "tree_sitter/core/lib/src"],
++ ["tree_sitter/binding.c"],
+ extra_compile_args=(
+ ["-std=c99", "-Wno-unused-variable"] if system() != "Windows" else None
+ ),
++ libraries=["tree-sitter"],
+ )
+ ],
+ project_urls={"Source": "https://github.com/tree-sitter/py-tree-sitter"},
diff --git a/dev-python/tree-sitter/tree-sitter-0.19.0_p20210506-r1.ebuild b/dev-python/tree-sitter/tree-sitter-0.19.0_p20210506-r1.ebuild
new file mode 100644
index 000000000000..a3ef55d401f3
--- /dev/null
+++ b/dev-python/tree-sitter/tree-sitter-0.19.0_p20210506-r1.ebuild
@@ -0,0 +1,50 @@
+# 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}
+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
+ 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="~amd64 ~x86"
+
+RDEPEND="dev-libs/tree-sitter:="
+DEPEND=${RDEPEND}
+
+distutils_enable_tests setup.py
+
+PATCHES=(
+ "${FILESDIR}"/${P}-unbundle.patch
+)
+
+src_unpack() {
+ default
+ rmdir "${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
+}