public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/tree-sitter-python] rawhide: tree-sitter-python: Add Python bindings
@ 2026-10-13  9:36 Maxime Ripard
  0 siblings, 0 replies; only message in thread
From: Maxime Ripard @ 2026-10-13  9:36 UTC (permalink / raw)
  To: git-commits

            A new commit has been pushed.

            Repo   : rpms/tree-sitter-python
            Branch : rawhide
            Commit : bfa80c389d79231f347cc6a0209646ab5c386e11
            Author : Maxime Ripard <mripard@kernel.org>
            Date   : 2026-10-13T10:07:45+02:00
            Stats  : +46/-1 in 2 file(s)
            URL    : https://src.fedoraproject.org/rpms/tree-sitter-python/c/bfa80c389d79231f347cc6a0209646ab5c386e11?branch=rawhide

            Log:
            tree-sitter-python: Add Python bindings

The py-tree-sitter package was recently merged into Fedora, and the
tree_sitter macro supports generating Python bindings for a tree-sitter
parser through the -P flag.

Pass it to generate the python3-tree-sitter-python subpackage.

Signed-off-by: Maxime Ripard <mripard@kernel.org>

---
diff --git a/0001-python-Drop-C-source-from-installed-package.patch b/0001-python-Drop-C-source-from-installed-package.patch
new file mode 100644
index 0000000..a6663c8
--- /dev/null
+++ b/0001-python-Drop-C-source-from-installed-package.patch
@@ -0,0 +1,44 @@
+From d54a75c99445bc46bbb7b0f17114c1461d2dcbf4 Mon Sep 17 00:00:00 2001
+From: Maxime Ripard <mripard@kernel.org>
+Date: Tue, 13 Oct 2026 10:06:06 +0200
+Subject: [PATCH] python: Drop C source from installed package
+
+Modern setuptools with pyproject.toml defaults to
+include_package_data=True, which includes all version-controlled files
+in package directories. Since binding.c lives inside the
+tree_sitter_python package directory, it gets installed alongside the
+compiled extension.
+
+This triggers rpmlint devel-file-in-non-devel-package warnings on
+distributions that lint for development files in runtime packages.
+
+Exclude *.c files from the installed package data. The C sources are
+still used as compilation inputs during the build, but are no longer
+shipped in the wheel or installed site-packages.
+
+Signed-off-by: Maxime Ripard <mripard@kernel.org>
+---
+ setup.py | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/setup.py b/setup.py
+index fe677f150748..b61f28d6ca3f 100644
+--- a/setup.py
++++ b/setup.py
+@@ -49,10 +49,13 @@ setup(
+     package_dir={"": "bindings/python"},
+     package_data={
+         "tree_sitter_python": ["*.pyi", "py.typed"],
+         "tree_sitter_python.queries": ["*.scm"],
+     },
++    exclude_package_data={
++        "tree_sitter_python": ["*.c"],
++    },
+     ext_package="tree_sitter_python",
+     ext_modules=[
+         Extension(
+             name="_binding",
+             sources=[
+-- 
+2.55.0
+

diff --git a/tree-sitter-python.spec b/tree-sitter-python.spec
index 6e87876..cb2f5fe 100644
--- a/tree-sitter-python.spec
+++ b/tree-sitter-python.spec
@@ -4,9 +4,10 @@ Release:        %{autorelease}
 License:        MIT
 URL:            https://github.com/tree-sitter/%{name}
 Source:         %{url}/archive/v%{version}/%{name}-%{version}.tar.gz
+Patch1:         0001-python-Drop-C-source-from-installed-package.patch
 BuildSystem:    tree_sitter
 
-%{tree_sitter -l Python}
+%{tree_sitter -P -l Python}
 
 %changelog
 %autochangelog

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-10-13  9:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-13  9:36 [rpms/tree-sitter-python] rawhide: tree-sitter-python: Add Python bindings Maxime Ripard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox