commit:     85c9426652e2495dbb3c6381d994f003aabad059
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Fri Jun  4 13:02:35 2021 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Fri Jun  4 13:04:32 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=85c94266

dev-python/tree-sitter: Unbundle dev-libs/tree-sitter

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 .../tree-sitter-0.19.0_p20210506-unbundle.patch    | 18 ++++++++
 .../tree-sitter-0.19.0_p20210506-r1.ebuild         | 50 ++++++++++++++++++++++
 2 files changed, 68 insertions(+)

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 00000000000..3eb9d103a0e
--- /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 00000000000..a3ef55d401f
--- /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
+}

Reply via email to