1 |
commit: 85c9426652e2495dbb3c6381d994f003aabad059 |
2 |
Author: Michał Górny <mgorny <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri Jun 4 13:02:35 2021 +0000 |
4 |
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri Jun 4 13:04:32 2021 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=85c94266 |
7 |
|
8 |
dev-python/tree-sitter: Unbundle dev-libs/tree-sitter |
9 |
|
10 |
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org> |
11 |
|
12 |
.../tree-sitter-0.19.0_p20210506-unbundle.patch | 18 ++++++++ |
13 |
.../tree-sitter-0.19.0_p20210506-r1.ebuild | 50 ++++++++++++++++++++++ |
14 |
2 files changed, 68 insertions(+) |
15 |
|
16 |
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 |
17 |
new file mode 100644 |
18 |
index 00000000000..3eb9d103a0e |
19 |
--- /dev/null |
20 |
+++ b/dev-python/tree-sitter/files/tree-sitter-0.19.0_p20210506-unbundle.patch |
21 |
@@ -0,0 +1,18 @@ |
22 |
+diff --git a/setup.py b/setup.py |
23 |
+index 2528827..bb2a817 100644 |
24 |
+--- a/setup.py |
25 |
++++ b/setup.py |
26 |
+@@ -33,11 +33,11 @@ setup( |
27 |
+ ext_modules=[ |
28 |
+ Extension( |
29 |
+ "tree_sitter.binding", |
30 |
+- ["tree_sitter/core/lib/src/lib.c", "tree_sitter/binding.c"], |
31 |
+- include_dirs=["tree_sitter/core/lib/include", "tree_sitter/core/lib/src"], |
32 |
++ ["tree_sitter/binding.c"], |
33 |
+ extra_compile_args=( |
34 |
+ ["-std=c99", "-Wno-unused-variable"] if system() != "Windows" else None |
35 |
+ ), |
36 |
++ libraries=["tree-sitter"], |
37 |
+ ) |
38 |
+ ], |
39 |
+ project_urls={"Source": "https://github.com/tree-sitter/py-tree-sitter"}, |
40 |
|
41 |
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 |
42 |
new file mode 100644 |
43 |
index 00000000000..a3ef55d401f |
44 |
--- /dev/null |
45 |
+++ b/dev-python/tree-sitter/tree-sitter-0.19.0_p20210506-r1.ebuild |
46 |
@@ -0,0 +1,50 @@ |
47 |
+# Copyright 1999-2021 Gentoo Authors |
48 |
+# Distributed under the terms of the GNU General Public License v2 |
49 |
+ |
50 |
+EAPI=7 |
51 |
+ |
52 |
+PYTHON_COMPAT=( python3_{8..10} ) |
53 |
+inherit distutils-r1 |
54 |
+ |
55 |
+EGIT_COMMIT="b4db17e4d43f27a040b4bf087695cc200512e4ea" |
56 |
+MY_P=py-tree-sitter-${EGIT_COMMIT} |
57 |
+FIXTURE_PV=0.19.0 |
58 |
+ |
59 |
+DESCRIPTION="Python bindings to the Tree-sitter parsing library" |
60 |
+HOMEPAGE="https://github.com/tree-sitter/py-tree-sitter/" |
61 |
+SRC_URI=" |
62 |
+ https://github.com/tree-sitter/py-tree-sitter/archive/${EGIT_COMMIT}.tar.gz |
63 |
+ -> ${MY_P}.tar.gz |
64 |
+ test? ( |
65 |
+ https://github.com/tree-sitter/tree-sitter-javascript/archive/v${FIXTURE_PV}.tar.gz |
66 |
+ -> tree-sitter-javascript-${FIXTURE_PV}.tar.gz |
67 |
+ https://github.com/tree-sitter/tree-sitter-python/archive/v${FIXTURE_PV}.tar.gz |
68 |
+ -> tree-sitter-python-${FIXTURE_PV}.tar.gz |
69 |
+ )" |
70 |
+S=${WORKDIR}/${MY_P} |
71 |
+ |
72 |
+LICENSE="MIT" |
73 |
+SLOT="0" |
74 |
+KEYWORDS="~amd64 ~x86" |
75 |
+ |
76 |
+RDEPEND="dev-libs/tree-sitter:=" |
77 |
+DEPEND=${RDEPEND} |
78 |
+ |
79 |
+distutils_enable_tests setup.py |
80 |
+ |
81 |
+PATCHES=( |
82 |
+ "${FILESDIR}"/${P}-unbundle.patch |
83 |
+) |
84 |
+ |
85 |
+src_unpack() { |
86 |
+ default |
87 |
+ rmdir "${S}/tree_sitter/core" || die |
88 |
+ |
89 |
+ if use test; then |
90 |
+ mkdir "${S}/tests/fixtures" || die |
91 |
+ local f |
92 |
+ for f in tree-sitter-{javascript,python}; do |
93 |
+ mv "${f}-${FIXTURE_PV}" "${S}/tests/fixtures/${f}" || die |
94 |
+ done |
95 |
+ fi |
96 |
+} |