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

qboosh qboosh at pld-linux.org
Sun Jan 18 20:52:46 CET 2026


commit 77381b0563f9af987083b19507016bff70dd8ff6
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date:   Sun Jan 18 20:52:48 2026 +0100

    - added python3 binding

 tree-sitter-bash.spec | 47 +++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 47 insertions(+)
---
diff --git a/tree-sitter-bash.spec b/tree-sitter-bash.spec
index a16b854..f47c335 100644
--- a/tree-sitter-bash.spec
+++ b/tree-sitter-bash.spec
@@ -1,3 +1,7 @@
+#
+# Conditional build:
+%bcond_without	python3	# Python 3.x binding
+
 Summary:	Bash grammar for tree-sitter
 Summary(pl.UTF-8):	Gramatyka Basha dla biblioteki Tree-sitter
 Name:		tree-sitter-bash
@@ -9,6 +13,13 @@ Group:		Libraries
 Source0:	https://github.com/tree-sitter/tree-sitter-bash/archive/v%{version}/%{name}-%{version}.tar.gz
 # Source0-md5:	97bcbab21f49b375bcf9e6834235f3ee
 URL:		https://github.com/tree-sitter/tree-sitter-bash
+%if %{with python3}
+# c11
+BuildRequires:	gcc >= 6:4.7
+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 @@ Bash parser for Neovim.
 %description -n neovim-parser-bash -l pl.UTF-8
 Analizator składni Basha dla Neovima.
 
+%package -n python3-tree-sitter-bash
+Summary:	Bash parser for Python
+Summary(pl.UTF-8):	Analizator składni Basha dla Pythona
+Group:		Libraries/Python
+Requires:	python3-tree-sitter >= 0.25
+
+%description -n python3-tree-sitter-bash
+Bash parser for Python.
+
+%description -n python3-tree-sitter-bash -l pl.UTF-8
+Analizator składni Basha dla Pythona.
+
 %prep
 %setup -q
 
 %build
 %{__cc} %{rpmldflags} %{rpmcppflags} %{rpmcflags} -fPIC -shared -Wl,-soname,libtree-sitter-bash.so.%{soname_ver} src/*.c -o libtree-sitter-bash.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-bash.so.%{version} $RPM_BUILD_ROOT%{_libdir}
 
 %{__ln_s} %{_libdir}/libtree-sitter-bash.so.%{soname_ver} $RPM_BUILD_ROOT%{_libdir}/nvim/parser/bash.so
 
+%if %{with python3}
+%py3_install
+
+%{__rm} $RPM_BUILD_ROOT%{py3_sitedir}/tree_sitter_bash/*.c
+
+%endif
+
 %clean
 rm -rf $RPM_BUILD_ROOT
 
@@ -61,3 +95,16 @@ rm -rf $RPM_BUILD_ROOT
 %files -n neovim-parser-bash
 %defattr(644,root,root,755)
 %{_libdir}/nvim/parser/bash.so
+
+%if %{with python3}
+%files -n python3-tree-sitter-bash
+%defattr(644,root,root,755)
+%dir %{py3_sitedir}/tree_sitter_bash
+%{py3_sitedir}/tree_sitter_bash/_binding.abi3.so
+%{py3_sitedir}/tree_sitter_bash/__init__.py
+%{py3_sitedir}/tree_sitter_bash/__init__.pyi
+%{py3_sitedir}/tree_sitter_bash/py.typed
+%{py3_sitedir}/tree_sitter_bash/__pycache__
+%{py3_sitedir}/tree_sitter_bash/queries
+%{py3_sitedir}/tree_sitter_bash-%{version}-py*.egg-info
+%endif
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/tree-sitter-bash.git/commitdiff/77381b0563f9af987083b19507016bff70dd8ff6



More information about the pld-cvs-commit mailing list