[packages/tree-sitter-c] - added python3 binding

qboosh qboosh at pld-linux.org
Sun Jan 18 21:18:14 CET 2026


commit 5425f81d026020dec81e1e7b4e54463af4ca983a
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date:   Sun Jan 18 21:18:15 2026 +0100

    - added python3 binding

 tree-sitter-c.spec | 47 +++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 47 insertions(+)
---
diff --git a/tree-sitter-c.spec b/tree-sitter-c.spec
index 0940998..8e2b5bc 100644
--- a/tree-sitter-c.spec
+++ b/tree-sitter-c.spec
@@ -1,3 +1,7 @@
+#
+# Conditional build:
+%bcond_without	python3	# Python 3.x binding
+
 Summary:	C grammar for tree-sitter
 Summary(pl.UTF-8):	Gramatyka języka C dla tree-sittera
 Name:		tree-sitter-c
@@ -9,6 +13,13 @@ Group:		Libraries
 Source0:	https://github.com/tree-sitter/tree-sitter-c/archive/v%{version}/%{name}-%{version}.tar.gz
 # Source0-md5:	e399309a829fa3bcb09609c9de2472f2
 URL:		https://github.com/tree-sitter/tree-sitter-c
+# c11
+BuildRequires:	gcc >= 6:4.7
+%if %{with python3}
+BuildRequires:	python3-devel >= 1:3.10
+BuildRequires:	python3-setuptools
+BuildRequires:	python3-wheel
+%endif
 BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
 %define		soname_ver	0
@@ -31,12 +42,28 @@ C parser for Neovim.
 %description -n neovim-parser-c -l pl.UTF-8
 Analizator składni języka C dla Neovima.
 
+%package -n python3-tree-sitter-c
+Summary:	C parser for Python
+Summary(pl.UTF-8):	Analizator składni języka C dla Pythona
+Group:		Libraries/Python
+Requires:	python3-tree-sitter >= 0.24
+
+%description -n python3-tree-sitter-c
+C parser for Python.
+
+%description -n python3-tree-sitter-c -l pl.UTF-8
+Analizator składni języka C dla Pythona.
+
 %prep
 %setup -q
 
 %build
 %{__cc} %{rpmldflags} %{rpmcppflags} %{rpmcflags} -fPIC -shared -Wl,-soname,libtree-sitter-c.so.%{soname_ver} src/parser.c -o libtree-sitter-c.so.%{version}
 
+%if %{with python3}
+%py3_build
+%endif
+
 %install
 rm -rf $RPM_BUILD_ROOT
 install -d $RPM_BUILD_ROOT{%{_libdir},%{_libdir}/nvim/parser}
@@ -46,6 +73,13 @@ cp -p libtree-sitter-c.so.%{version} $RPM_BUILD_ROOT%{_libdir}
 
 %{__ln_s} %{_libdir}/libtree-sitter-c.so.%{soname_ver} $RPM_BUILD_ROOT%{_libdir}/nvim/parser/c.so
 
+%if %{with python3}
+%py3_install
+
+%{__rm} $RPM_BUILD_ROOT%{py3_sitedir}/tree_sitter_c/*.c
+
+%endif
+
 %clean
 rm -rf $RPM_BUILD_ROOT
 
@@ -61,3 +95,16 @@ rm -rf $RPM_BUILD_ROOT
 %files -n neovim-parser-c
 %defattr(644,root,root,755)
 %{_libdir}/nvim/parser/c.so
+
+%if %{with python3}
+%files -n python3-tree-sitter-c
+%defattr(644,root,root,755)
+%dir %{py3_sitedir}/tree_sitter_c
+%{py3_sitedir}/tree_sitter_c/_binding.abi3.so
+%{py3_sitedir}/tree_sitter_c/__init__.py
+%{py3_sitedir}/tree_sitter_c/__init__.pyi
+%{py3_sitedir}/tree_sitter_c/py.typed
+%{py3_sitedir}/tree_sitter_c/__pycache__
+%{py3_sitedir}/tree_sitter_c/queries
+%{py3_sitedir}/tree_sitter_c-%{version}-py*.egg-info
+%endif
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/tree-sitter-c.git/commitdiff/5425f81d026020dec81e1e7b4e54463af4ca983a



More information about the pld-cvs-commit mailing list